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.

How to define an integration for a variable?

Please login with a confirmed email address before reporting spam

First, for a 2-D problem, how can I use the x value and y value of a point evaluated?

Integration coupling variable is used to integrate a variable in the whole boundary or subdomian considered. How can I define an integration for a variable within limits?

In matlab, we can use int(f(x),x0,x1) which represents the integration of f(x) from x0 to x1?
In comsol, how can we get this kind of integration? For f(x) from 0 to x, is it int(f(x),0,x)?

A simple problem I'm interested in is the selfweight calculation for soils in civil engineering. In a certain depth of the soil, the total stress should be an integration of above selfweight.

Sincere thanks for your reply

Roger

7 Replies Last Post Oct 17, 2016, 1:56 p.m. EDT
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 Jan 5, 2010, 9:17 a.m. EST
Hi

You have to study the chapter of "Integration Coupling Variables" in the doc, there are different types, not only on a border or a subdomain (projection or extrusion items), in the worst case you add a few specific interiour subdomains, sometimes this is simpler. In the GUI environment these equivalent to the Postprocessing Cross Section Plot's

Good luck
Ivar
Hi You have to study the chapter of "Integration Coupling Variables" in the doc, there are different types, not only on a border or a subdomain (projection or extrusion items), in the worst case you add a few specific interiour subdomains, sometimes this is simpler. In the GUI environment these equivalent to the Postprocessing Cross Section Plot's Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 5, 2010, 11:21 a.m. EST
integrate over the whole domain the function f(x)*(x>x0)*(x<x1) and that does what you want
JF
integrate over the whole domain the function f(x)*(x>x0)*(x

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 13, 2012, 8:49 p.m. EDT
What you can do is draw 2 lines exactly at the positions you want to carry on the integration.
Then in integration you choose the boundaries , if it is domain or boundary you will see how you can pick up just the space between your lines.
What you can do is draw 2 lines exactly at the positions you want to carry on the integration. Then in integration you choose the boundaries , if it is domain or boundary you will see how you can pick up just the space between your lines.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 31, 2013, 5:34 a.m. EDT
Hi Roger,
I stumbled upon the same problem.
For integration of f(x,y) from 0 to x I use a separate "General form PDE" with a dependent variable intX on the domain of the function. In the settings I set all coefficients of the PDE to zero exept for the source term f. For the source term f I use: d(intX,x)-f(x,y). By doing so the problem is converted from an integration to a differentiation and therefore a boundary condition needs to be set. This is done by adding a "constraint" to the boundary where x=0 with reaction term R=-intX.

I hope this helps.

But I have another question related to this. Is there a better way to integrate over fixed boundaries? I want to integrate a function f(x,y) from y=0 to y=1. I know I could set up a "General projection" for this but I noticed that this is computationally very expensive. Is there a way to speed it up? Is the nojac()-operator somehow useful?
If I use the built-in integrate()-operator for this, I get an error-message. I think this is due to the fact that this operator is supposed to be used for postprocessing only but not for solving. Am I right on this one?

Hi Roger, I stumbled upon the same problem. For integration of f(x,y) from 0 to x I use a separate "General form PDE" with a dependent variable intX on the domain of the function. In the settings I set all coefficients of the PDE to zero exept for the source term f. For the source term f I use: d(intX,x)-f(x,y). By doing so the problem is converted from an integration to a differentiation and therefore a boundary condition needs to be set. This is done by adding a "constraint" to the boundary where x=0 with reaction term R=-intX. I hope this helps. But I have another question related to this. Is there a better way to integrate over fixed boundaries? I want to integrate a function f(x,y) from y=0 to y=1. I know I could set up a "General projection" for this but I noticed that this is computationally very expensive. Is there a way to speed it up? Is the nojac()-operator somehow useful? If I use the built-in integrate()-operator for this, I get an error-message. I think this is due to the fact that this operator is supposed to be used for postprocessing only but not for solving. Am I right on this one?

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Jun 8, 2015, 11:55 a.m. EDT

In matlab, we can use int(f(x),x0,x1) which represents the integration of f(x) from x0 to x1?
In comsol, how can we get this kind of integration? For f(x) from 0 to x, is it int(f(x),0,x)?


do it with integrate(expr,var,lower,upper) operator defining some variable tempInt. Here the excerpt from Comsol documentation :

integrate(expr,var,lower,upper) computes the integral of expr for the integration variable var over an interval specified by expressions lower for the lower limit and upper for the upper limit. The expressions for lower and upper limits do not have to be constants but are required to evaluate to real values.

Best
Peter
[QUOTE] In matlab, we can use int(f(x),x0,x1) which represents the integration of f(x) from x0 to x1? In comsol, how can we get this kind of integration? For f(x) from 0 to x, is it int(f(x),0,x)? [/QUOTE] do it with integrate(expr,var,lower,upper) operator defining some variable tempInt. Here the excerpt from Comsol documentation : integrate(expr,var,lower,upper) computes the integral of expr for the integration variable var over an interval specified by expressions lower for the lower limit and upper for the upper limit. The expressions for lower and upper limits do not have to be constants but are required to evaluate to real values. Best Peter

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Oct 16, 2016, 12:27 p.m. EDT
How to find the in built functions such as integrate.

I am specifically looking for summation as in Fourier and Taylor series.

Thanks
How to find the in built functions such as integrate. I am specifically looking for summation as in Fourier and Taylor series. Thanks

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Oct 17, 2016, 1:56 p.m. EDT
Check out Chapter 5 of the COMSOL Multiphysics Reference Manual, version 5.2a.
Best,
Jeff
Check out Chapter 5 of the COMSOL Multiphysics Reference Manual, version 5.2a. Best, Jeff

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.