how to avoid negative values for some variables such as concentration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to avoid negative values for some variables such as concentration

James
During simulations, I found that sometimes some variables such as concentration are in negative values, which does not make sense for plots. Can we enforce variables to be equal to zero when negative values occur? In either GUI or m code,  I cannot find a place to inset this condition. If this cannot be done, could you give a solution to avoid such negative values? Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: how to avoid negative values for some variables such as concentration

Precise Simulation
Administrator
You can enforce it during postprocessing and in equations using switch expressions such as "a*(a>0)", see for example the "Flow Over a Backward Facing Step" tutorial model:

https://www.featool.com/model-showcase/04_fluid_dynamics_04_backwards_facing_step1

and the section on "Discontiunous Functions" in the post:

https://www.featool.com/tutorial/2019/01/07/modeling-with-non-constant-coefficients-in-featool-multiphysics.html

If you really mean forcing solution variables to be positive it will require reformulating the PDEs as you are really solving a different problem. See for example the turbulence modeling papers by Pelletier, D. and Ilinca, F. where they reformulate the turbulent equations in logarithmic form to ensure positivity.
Reply | Threaded
Open this post in threaded view
|

Re: how to avoid negative values for some variables such as concentration

James
It will be better that featool can automatically avoid negative concentration values during simulations (e.g. in diffusion/convention case). Although it can be set up in the equation section or in the post-processing steps, the model would still use negative concentration values to go ahead, which does not make sense. Some reaction equations are well-known equations, so it will also be inappropriate to reformulate them. Thank you for consideration!
Reply | Threaded
Open this post in threaded view
|

Re: how to avoid negative values for some variables such as concentration

Precise Simulation
Administrator
If your negative values are due to numerical stabilization issues due to convection dominating terms it should also help to use monotonicity preserving FEM-TVD stabilization which can be switched on using the "Shock-Capturing" option in the "Artificial Stabilization" options dialog box:

https://www.featool.com/doc/physics.html#phys_artstab

But aside from that PDE problems are generally too complex for completely automatic reformulation of this type.