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.

Mathematics Module: Coupled Simulation: How to access dependent variable at certain point?

Please login with a confirmed email address before reporting spam

Hello!

I want to couple a time dependent PDE with an ODE. The dependent variable of the PDE system is u1, the one for the ODE is v1. Now I want the value u1x(x_s) (i.e. the value of u1x at position x_s) to be included in the ODE. How could I possibly realise this?



Minimal example:

PDE: f(u1,u1x,u1t,t)=0
ODE: g(v1,u1x(x=x_s))=0

with u1=u1(x,t) and v1=v1(t)

(For me the ODE is only a transcendental equation without any derivatives of the dependent variable)

Thanks for your help!

7 Replies Last Post 12 nov 2012, 09:19 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 feb 2012, 03:49 GMT-5
You have to define a coupling operator, of the "integration" or "average" type, that acts only on the point x_s of your geometry. Since it integrates only over a point, you can thus probe any variable/expression at that point and use it however you want in your equation system. If you haven't already, you may have to modify the geometry sequence so that x_s is assigned a vertex number.
You have to define a coupling operator, of the "integration" or "average" type, that acts only on the point x_s of your geometry. Since it integrates only over a point, you can thus probe any variable/expression at that point and use it however you want in your equation system. If you haven't already, you may have to modify the geometry sequence so that x_s is assigned a vertex number.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 feb 2012, 06:41 GMT-5
That was good hint, thanks. But now I want to extract my value at a moving point x_s(t). Here I cannot define a geometric point since its position would be fixed. Any suggestions for this case?
That was good hint, thanks. But now I want to extract my value at a moving point x_s(t). Here I cannot define a geometric point since its position would be fixed. Any suggestions for this case?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 feb 2012, 07:29 GMT-5
Off the top of my head, I can't think of a straightforward way to do this in Comsol. (That obviously doesn't mean there is no straightforward way. Maybe I'm missing something and someone else can say more...)

However, though I've never had to deal with a problem like yours, I could think of a possible way around it. Maybe you could define, again, an integration coupling operator, but this time over the whole domain (or interval – I guess your problem is 1D). Then integrate the expression ("u1x" in your case) multiplied by a suitably defined Dirac delta function centered around x_s(t). By "suitably defined" I mean a delta function that is about as wide as the mesh size. You can use a combination of one of the built-in Heaviside functions – such as flc1hs(...) – to construct the delta function. Not sure if and how this will work out, but it might be worth a shot.
Off the top of my head, I can't think of a straightforward way to do this in Comsol. (That obviously doesn't mean there is no straightforward way. Maybe I'm missing something and someone else can say more...) However, though I've never had to deal with a problem like yours, I could think of a possible way around it. Maybe you could define, again, an integration coupling operator, but this time over the whole domain (or interval – I guess your problem is 1D). Then integrate the expression ("u1x" in your case) multiplied by a suitably defined Dirac delta function centered around x_s(t). By "suitably defined" I mean a delta function that is about as wide as the mesh size. You can use a combination of one of the built-in Heaviside functions – such as flc1hs(...) – to construct the delta function. Not sure if and how this will work out, but it might be worth a shot.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 feb 2012, 08:39 GMT-5
Yes that worked! Thanks again.

For those who are interested: I defined a small eps and used two Heaviside step functions which set the whole integration area to zero except from my small 2*eps zone around my x-value of interest. Then I multiplied the step functions by my variable field u1x and integrated this as defined in my operator definition (intop1). Furthermore I had to divide this by the length of the interval, which is 2*eps:

intop1(u1x*(x>x_s-eps)*(x<x_s+eps))/(2*eps)
Yes that worked! Thanks again. For those who are interested: I defined a small eps and used two Heaviside step functions which set the whole integration area to zero except from my small 2*eps zone around my x-value of interest. Then I multiplied the step functions by my variable field u1x and integrated this as defined in my operator definition (intop1). Furthermore I had to divide this by the length of the interval, which is 2*eps: intop1(u1x*(x>x_s-eps)*(x

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 9 feb 2012, 09:20 GMT-5
Hi

As "eps" is already defined in COMSOL, is it the internal one or your own "eps" you are using ?
--
Good luck
Ivar
Hi As "eps" is already defined in COMSOL, is it the internal one or your own "eps" you are using ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 feb 2012, 10:07 GMT-5
Yes you are right, I renamed it to epsT.
Yes you are right, I renamed it to epsT.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 nov 2012, 09:19 GMT-5
Hi,

I’m a new user in Comsol and would like to solve similar set of equations (PDE coupled to an ODE).
My question is how did you define the moving point variable x_s that you integrate on?

Thanks,
Tamir.
Hi, I’m a new user in Comsol and would like to solve similar set of equations (PDE coupled to an ODE). My question is how did you define the moving point variable x_s that you integrate on? Thanks, Tamir.

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.