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.

How to evaluate a vector integral using Comsol

Please login with a confirmed email address before reporting spam

Hi:
I want to evaluate the integral of Xdx+Ydy+Zdz, which is a vector integral. However, I'm not sure if the line integral in Comsol is evaluating a scalar integral or not. Could someone let me know how to evaluate a vector integral?
Thanks a lot!

4 Replies Last Post 02.05.2012, 03:49 GMT-4
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 17.11.2011, 07:52 GMT-5
Hi

your notation is not "COMSOL compliant" so I'm not sure I understand what you want.

When you integrate over a line you are using the "implicit" a *ds=sqrt(dx^2+dy^2+dz^2) line integration elementary element that multiplies your formula, hence the gain of [m] for the results, for 2D surface you have the implicit *dx*dy (hence *[m^2], respectively *dx*dy*dz for 3D (hence *[m^3], and not to forget the 2*pi*r*dr for 2D-axi (this is not always the case, you might need to turn the 2*pi*r multiplier "on" manually, see the integration options

Basically you get scalar integrations, so if you need the sum separately for each dx, dy, dz you need to do 3 integrations and sum them. Except if you can write out your equation differently and mighr have COMSOL to solve it directly as an global ODE

--
Good luck
Ivar
Hi your notation is not "COMSOL compliant" so I'm not sure I understand what you want. When you integrate over a line you are using the "implicit" a *ds=sqrt(dx^2+dy^2+dz^2) line integration elementary element that multiplies your formula, hence the gain of [m] for the results, for 2D surface you have the implicit *dx*dy (hence *[m^2], respectively *dx*dy*dz for 3D (hence *[m^3], and not to forget the 2*pi*r*dr for 2D-axi (this is not always the case, you might need to turn the 2*pi*r multiplier "on" manually, see the integration options Basically you get scalar integrations, so if you need the sum separately for each dx, dy, dz you need to do 3 integrations and sum them. Except if you can write out your equation differently and mighr have COMSOL to solve it directly as an global ODE -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 22.11.2011, 16:58 GMT-5
I have a 2D transient acoustic solid interaction model. I want to integrate the pressure along a cylinder to find the force - the circle in the geometry (with thickness H). I am only interested in the X component of the force. The expression I want to integrate (a line integral around the circle) is force = H*integral over L p(x,y)*dot(N(x,y),I)*ds, whre N is the outward normal vector of the circle and I the standard basis vector in the X direction, I = [1, 0].

I am having difficulty converting this vector expression into a scalar one for Comsol's use, specifically how to apply some kind of vector dot product operator. The closest thing I can come up is to set the integrand to p*sys1.e_1*nx, but I understand this product sys1.e_1*nx is not mathematically equal to the dot product.

Thanks for the help!
I have a 2D transient acoustic solid interaction model. I want to integrate the pressure along a cylinder to find the force - the circle in the geometry (with thickness H). I am only interested in the X component of the force. The expression I want to integrate (a line integral around the circle) is force = H*integral over L p(x,y)*dot(N(x,y),I)*ds, whre N is the outward normal vector of the circle and I the standard basis vector in the X direction, I = [1, 0]. I am having difficulty converting this vector expression into a scalar one for Comsol's use, specifically how to apply some kind of vector dot product operator. The closest thing I can come up is to set the integrand to p*sys1.e_1*nx, but I understand this product sys1.e_1*nx is not mathematically equal to the dot product. Thanks for the help!

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 23.11.2011, 01:43 GMT-5
Hi

isn't it simply "p*nx" you need to integrate ? nx being the normal at any point (x,y) or "s" along the edge, while "p" is always normal to the boundary (edge in your 2D case)

Check it out with a few coordinate plots and simple test integration, you should also check the signs depending on how you handle the analysis, if you use "s" it might revert on close loops

--
Good luck
Ivar
Hi isn't it simply "p*nx" you need to integrate ? nx being the normal at any point (x,y) or "s" along the edge, while "p" is always normal to the boundary (edge in your 2D case) Check it out with a few coordinate plots and simple test integration, you should also check the signs depending on how you handle the analysis, if you use "s" it might revert on close loops -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 02.05.2012, 03:49 GMT-4
Hi,

I'm starting a new job and I'm using Comsol (I'm a novice user) but I need to be able to integrate a vector function. I have looked at the reference guide and I only found how to integrate a scalar (complex or real). As an example, we need to compute the following integral (in latex form) :

\frac{1}{\lambda(\Omega)} \int_{\Omega} \vec{f}(x) d\lambda_x

where f is a vector function in \mathbb{R}^N with N=3 or 4, given by

f(x) = [ x, y, z, 1] (cartesian coordinate)

Until now, i use the call to 'postint' with some trick in order to limit the number of call :

cmplx1 = postint( fem, 'x+j*y', 'unit', 'm^4', 'recover', 'off', 'dl', k );
cmplx2 = postint( fem, 'z+j*1', 'unit', 'm^4', 'recover', 'off', 'dl', k );

The final objectives is to obtain the centroids of \Omega. Before that, we used 4 call to 'postint' but now, we want to reduce the number of call to a single one because it seems to be possible and less expensive in CPU time. In our application we have to compute a significant number of centroids coordinates, that's why we need to solve this problem.

Thank you for your help.



Hi, I'm starting a new job and I'm using Comsol (I'm a novice user) but I need to be able to integrate a vector function. I have looked at the reference guide and I only found how to integrate a scalar (complex or real). As an example, we need to compute the following integral (in latex form) : \frac{1}{\lambda(\Omega)} \int_{\Omega} \vec{f}(x) d\lambda_x where f is a vector function in \mathbb{R}^N with N=3 or 4, given by f(x) = [ x, y, z, 1] (cartesian coordinate) Until now, i use the call to 'postint' with some trick in order to limit the number of call : cmplx1 = postint( fem, 'x+j*y', 'unit', 'm^4', 'recover', 'off', 'dl', k ); cmplx2 = postint( fem, 'z+j*1', 'unit', 'm^4', 'recover', 'off', 'dl', k ); The final objectives is to obtain the centroids of \Omega. Before that, we used 4 call to 'postint' but now, we want to reduce the number of call to a single one because it seems to be possible and less expensive in CPU time. In our application we have to compute a significant number of centroids coordinates, that's why we need to solve this problem. Thank you for your help.

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.