Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Integration over limited region

Please login with a confirmed email address before reporting spam

Hi,

I want to calculate an integral of a function only on part of a subdomain.
For example
g(x)=integral of f(x') from x'=0 to x'=x

I think an integration coupling variable it is not possible since it always integrates over the hole subdomain.

Thanks for your help,
Oliver



9 Replies Last Post Mar 28, 2012, 5:40 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 10, 2010, 9:48 a.m. EDT
I believe the only way currently possible is to split your domains so you have internal boundaries. Then you can integrate on the part of the domain you want.
I believe the only way currently possible is to split your domains so you have internal boundaries. Then you can integrate on the part of the domain you want.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 10, 2010, 3:22 p.m. EDT
Hi

I would say too that Danial has right, the easiest is to sudivide your domains or boundaries. But if you know the coordinate limits you can also get around with a bolean expression of the type

Integr_variable = mises_smsld*((x-x0)^2+(y-y0)^2<=R^2)

where R is a constant, but you should then also normalise over the

Area=1*((x-x0)^2+(y-y0)^2<=R^2)

Have fun Comsoling
Ivar
Hi I would say too that Danial has right, the easiest is to sudivide your domains or boundaries. But if you know the coordinate limits you can also get around with a bolean expression of the type Integr_variable = mises_smsld*((x-x0)^2+(y-y0)^2

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 10, 2010, 4:20 p.m. EDT

Hi

I would say too that Danial has right, the easiest is to sudivide your domains or boundaries. But if you know the coordinate limits you can also get around with a bolean expression of the type

Integr_variable = mises_smsld*((x-x0)^2+(y-y0)^2<=R^2)

where R is a constant, but you should then also normalise over the

Area=1*((x-x0)^2+(y-y0)^2<=R^2)

Have fun Comsoling
Ivar


Everyday something new to learn. great tip Ivar.
[QUOTE] Hi I would say too that Danial has right, the easiest is to sudivide your domains or boundaries. But if you know the coordinate limits you can also get around with a bolean expression of the type Integr_variable = mises_smsld*((x-x0)^2+(y-y0)^2

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 10, 2010, 4:29 p.m. EDT
Hi Ivar and Daniel,

thank you for your answers.
Since I wanted to have a continuous function it does not work with the subdomain.
But I found an other option which seems to work.

I defined an integration coupling variable as.

g(x) = f * (dest(x')>=x')

this seems to be what I wanted.

Best regards,
Oli
Hi Ivar and Daniel, thank you for your answers. Since I wanted to have a continuous function it does not work with the subdomain. But I found an other option which seems to work. I defined an integration coupling variable as. g(x) = f * (dest(x')>=x') this seems to be what I wanted. Best regards, Oli

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 11, 2010, 1:16 a.m. EDT
Hi

If I understand you well you are also then playing with defined "destinations" and not just "global", otherwise you will get many items no ?
Perhaps not important with todays computer power

have fun Comsoling
Ivar
Hi If I understand you well you are also then playing with defined "destinations" and not just "global", otherwise you will get many items no ? Perhaps not important with todays computer power have fun Comsoling Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 11, 2010, 3:53 a.m. EDT
Hi,

Yes it is quite time consument...
But with your advice I can avoid the problem of defining new subdomains, but it just works for a certain value of R or?

So in particular I want to calculate a local generation rate depending on an integral from one boundary to that local point. To use your method I would have to change R localy - is that possible?
But then it is not fast than with dest(x), or?

I do have fun Comsoling!

Oli
Hi, Yes it is quite time consument... But with your advice I can avoid the problem of defining new subdomains, but it just works for a certain value of R or? So in particular I want to calculate a local generation rate depending on an integral from one boundary to that local point. To use your method I would have to change R localy - is that possible? But then it is not fast than with dest(x), or? I do have fun Comsoling! Oli

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 11, 2010, 4:24 p.m. EST
Hi Oliver,

I think I have a similar problem with you. Instead of integrating over a whole boundary/line, I want to integrate f(x) from x=0 to x itself over arbitrary line (probably only lines paralleled to x axis) within a subdomain. Did f * (dest(x')>=x') in "integration coupling variables" work out finally? Did you choose subdomain variable or boundary variable? Your help will be greatly appreciated.

Thanks,
Fan


Hi Oliver, I think I have a similar problem with you. Instead of integrating over a whole boundary/line, I want to integrate f(x) from x=0 to x itself over arbitrary line (probably only lines paralleled to x axis) within a subdomain. Did f * (dest(x')>=x') in "integration coupling variables" work out finally? Did you choose subdomain variable or boundary variable? Your help will be greatly appreciated. Thanks, Fan

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 15, 2010, 7:48 a.m. EST
Hi Fan,

it worked fine at the end and I chose subdomain varaiables. So just try it and perhaps play around with the integral definitions in order to get some feeling for this.

Best Regards,
Oliver
Hi Fan, it worked fine at the end and I chose subdomain varaiables. So just try it and perhaps play around with the integral definitions in order to get some feeling for this. Best Regards, Oliver

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 28, 2012, 5:40 a.m. EDT
Hi.

I have a somewhat related problem:

on a whole 3D (x, y, z) domain, I want to define a value f(x)=integral over y and z of k(x,y,z)

With k beeing my turbulent cinetic energy.

How can I do this?
Hi. I have a somewhat related problem: on a whole 3D (x, y, z) domain, I want to define a value f(x)=integral over y and z of k(x,y,z) With k beeing my turbulent cinetic energy. How can I do this?

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.