Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Integrating an expression over discrete volumes within a domain

Please login with a confirmed email address before reporting spam

Dear COMSOL community,

I have a cylindrical domain as part of my COMSOL model, where I solve for the volumetric convective heat transfer (in W/m^3), among other things. When I use volume integration on this term in the Derived Values node, I get the total heat convected (in W) for the whole domain, which is good.

Now, I'd like to calculate and export the integrated heat value in W, but over discrete volumes within this domain in order to import and use them in another application. The other application uses a grid of 80 discrete volumes in the axial direction, each further divided into 20 volumes in radial direction, giving 1600 volumes in total (imagine a stack of concentric rings).

I would like to automate this volume integration and export process. I tried the following possibilities, but haven't reached a solution yet:

  1. Derived Values node: not sure if it is possible to use this feature for so many operations at once?
  2. Create a New Method under Application Builder: this seems like a solution, but my concern is, can I use the Volume Integration operator for a sub-domain, or does it work only on domain-level Selections?
  3. I saw some online discussions about creating artifical boundaries or splitting the domain in COMSOL already as per what is required by the other application. But would creating those 1600 domains make sense? Even then, I'd still have to automate the export somehow.
  4. I exported the Solution Data using the Export node to a text file (where I get W/m^3 values at x,y,z coordinates), which I could further process, say in Matlab. In that case, the question is what would be a scientifically correct way of integrating the per unit volume quantities at several coordinate locations within a discrete volume to obtain the total quantity for that discrete volume?

Any ideas?

Thanks a lot, Vikas


4 Replies Last Post Jun 7, 2019, 1:52 p.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Jun 4, 2019, 6:46 a.m. EDT
  1. I can't see a good way to do this automatically.
  2. I've no experience with the app builder.
  3. I don't know how to do that post solving
  4. I think post processing is a better option. I can't see a good way of cycling through domains in Comsol. Maybe with a result parameter. But say, in MatLab, you could probably do it using a scatteredInterpolant and 3 recursive trapz calls. There, google (and the MatLab documentation) can help you :)
1. I can't see a good way to do this automatically. 2. I've no experience with the app builder. 3. I don't know how to do that post solving 4. I think post processing is a better option. I can't see a good way of cycling through domains in Comsol. Maybe with a result parameter. But say, in MatLab, you could probably do it using a scatteredInterpolant and 3 recursive trapz calls. There, google (and the MatLab documentation) can help you :)

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Jun 4, 2019, 8:53 a.m. EDT

Hi Gustavo, Thanks for your answer. For me too, option 4 looks most feasible so far. I will update here if I manage to work it out, while waiting if there are any more inputs here. :)

Best regards, Vikas

Hi Gustavo, Thanks for your answer. For me too, option 4 looks most feasible so far. I will update here if I manage to work it out, while waiting if there are any more inputs here. :) Best regards, Vikas

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Jun 5, 2019, 10:23 a.m. EDT

Vikas,

you might consider to set up volume integrations with boolean expressions in the integrand. In a 1D case the integrand would look like:

(x>x0)&&(x<x1)*Q

This can be done in a component coupling during solving or in post processing. Though may be a challenge to do it for 1600 integrations.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Vikas, you might consider to set up volume integrations with boolean expressions in the integrand. In a 1D case the integrand would look like: (x>x0)&&(x

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Jun 7, 2019, 1:52 p.m. EDT

Hi Edgar,

Thanks for your answer. Yes, Boolean expressions in the integrand is a good idea. To repeat it for 1600 integrations, I guess it can be implemented inside a loop in a New Method under Application Builder. I am going to try out Option 4 first, and otherwise this seems to be the last resort.

Best, Vikas

Hi Edgar, Thanks for your answer. Yes, Boolean expressions in the integrand is a good idea. To repeat it for 1600 integrations, I guess it can be implemented inside a loop in a New Method under Application Builder. I am going to try out Option 4 first, and otherwise this seems to be the last resort. Best, Vikas

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.