Is there documentation somewhere on how to use the “>” operator when defining formulas, for example when creating boundary conditions?
I am trying to define a velocity inlet boundary condition where the velocity starts at 0 and linearly increases to 400 in 10 seconds, and then stays at 400. I want to see if a function similar to “40*t t < 10, 400 t >= 10” is possible.
Hey @tryabin,
For formulation you can do something like this (please see attached picture below, in this case I have assumed that you are giving velocity in x direction. For other corresponding direction, please use the formula tab for that respective direction): 40t(t<=10)+400*(t>10)
Note: if your velocity is in km/h then you have to convert it to m/s as SimScale uses SI units for all cases. If this velocity value is in m/s then you may have to reconsider it as it is a high velocity which is not easy to simulate.
OR
you can upload a .csv file in table upload option, please have a look at the documentation here.
In your case, the file data will look something li`ke this in case you want to give velocity only in x direction (with comma delimiter):
time,velocity in x,velocity in y,velocity in z ← you can ignore this first line in your file
10,400,0,0
1000,400,0,0
The second row is just on a safe side. If you have used ‘Out of bound’ as Clamp then you can ignore this row since clamp will fix the value after 10 seconds.
I hope this helps. If you have any question/s, feel free to ask.
Best,
Ahmed
2 Likes
I tried running a simulation with the following function as a boundary condition:
40*t*(t<=10)+400*(t>10)
and the simulation failed with this error message:
[6] --> FOAM FATAL ERROR:
[6] Parser Error for driver PatchValueExpressionDriver at "1.32" :"syntax error, unexpected ')', expecting '?' or TOKEN_OR or TOKEN_AND"
"vector(((40*time()*(time()<=10))+(400*(time()>10))),0.0,0.0)"
^
---------------------------------|
Context of the error:
- From dictionary: processor6/0/U.boundaryField.boundingBox3
Evaluating expression "vector(((40*time()*(time()<=10))+(400*(time()>10))),0.0,0.0)"
Hey @tryabin!
Sorry my bad. It seems like this type of formulation works in structural mechanics simulation rather than CFD. Therefore, I would recommend you to use table for this case rather than formula.
Best,
Ahmed
1 Like
Thanks the table method worked for me.
2 Likes