CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   STAR-CCM+ (http://www.cfd-online.com/Forums/star-ccm/)
-   -   Field Function Conditional Expressions (http://www.cfd-online.com/Forums/star-ccm/113418-field-function-conditional-expressions.html)

 shanefarrell February 19, 2013 10:20

Field Function Conditional Expressions

Hi,
Im trying to use field functions to refine my mesh, but my conditional expression for my refinement table is written incorectly. I want my mesh to be finer in the areas where the velocity is over 0.4m/s and also in the areas where the temperature is over 293K. The two expressions shown below work fine individually but i need to combine the two to generate the one mesh refinement table...any ideas?

(\$RelativeVelocityMagnitude > 0.04) ? 0.038 : 0.08
(\$Temperature > 293) ? 0.038 : 0.08

 lava12005 February 19, 2013 21:02

Try using the and '&&' logical operator?
Maybe this?
((\$RelativeVelocityMagnitude > 0.04) && (\$Temperature > 293)) ? 0.038 : 0.08

 shanefarrell February 20, 2013 09:36

Thanks for the reply. I used the logical operator '&&' but this only refines the mesh in the areas where both the velocity is > 0.4 and the temperature is > 293. I need to refine the mesh in the areas where either of these conditions are met.

 lava12005 February 20, 2013 09:55

Then you can use the OR logical operator '||' since if either of these requirement are met, then it will refine the mesh.
So it should be
((\$RelativeVelocityMagnitude > 0.04) || (\$Temperature > 293)) ? 0.038 : 0.08

 shanefarrell February 21, 2013 09:44

It worked perfectly, thanks very much.

 All times are GMT -4. The time now is 17:22.