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.

IF statement in Bondary Condition

Please login with a confirmed email address before reporting spam

Hi friends,
Is it possible to use the conditional statement in a Boundary condition ( Like the wetted wall) ?
I want to define to different contact angles based on the velocity.
1) if (v>=0, Pi/3, Pi/4)
2) Pi/3*(v>=0)+Pi/4*(v<0)

which one is correct ?
If I generally use the velocity (v) in my model, Does the COMSOL automatically used the velocity magnitude related to my boundary condition (on the wall) OR should I first define the velocity on the wall as a separate variable ?

BEST REGARDS,

1 Reply Last Post 6 juil. 2012, 02:47 UTC−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 6 juil. 2012, 02:47 UTC−4
Hi

normally both are equivalent, but you must notice that you have a step function there, hence at the switching time/position/value you have a non defined derivative, which will give you some issues or solver ringing when you pass the transition in time, or value in sweep mode. Therefore it's better to use the step(), or ramp() or other built in functions that have also optional smooth transitions that will give a define derivative all along the scan process.

Variables are confusing in COMSOL (I'm from the "old" shool one should distinguish all items clearly;) therefor in COMSOL a variable "v" can be a global scalar variable defined everywhere, a local field variabe v(x,y,z,t...) (and applied to the local dx*dy*dz element of the selected Entities) or a variable that maps DIFFERENT fields on Respective Different ENTITIES.
It's as the confusion often appearing with the notation of derivatives and vector compoennts, Ex is the "x" component of the electric field vector, while Vx is the x derivative of the Voltage scalar, so you the user, must know which applies. Basically it means you nee to know your physics, but some better convention for differenting these could be usefull, nobody is perfect, and anyhow you get used to it

--
Good luck
Ivar
Hi normally both are equivalent, but you must notice that you have a step function there, hence at the switching time/position/value you have a non defined derivative, which will give you some issues or solver ringing when you pass the transition in time, or value in sweep mode. Therefore it's better to use the step(), or ramp() or other built in functions that have also optional smooth transitions that will give a define derivative all along the scan process. Variables are confusing in COMSOL (I'm from the "old" shool one should distinguish all items clearly;) therefor in COMSOL a variable "v" can be a global scalar variable defined everywhere, a local field variabe v(x,y,z,t...) (and applied to the local dx*dy*dz element of the selected Entities) or a variable that maps DIFFERENT fields on Respective Different ENTITIES. It's as the confusion often appearing with the notation of derivatives and vector compoennts, Ex is the "x" component of the electric field vector, while Vx is the x derivative of the Voltage scalar, so you the user, must know which applies. Basically it means you nee to know your physics, but some better convention for differenting these could be usefull, nobody is perfect, and anyhow you get used to it -- Good luck Ivar

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.