CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   initial conditions (https://www.cfd-online.com/Forums/openfoam-solving/70479-initial-conditions.html)

openfoam_user November 25, 2009 10:50

initial conditions
 
Hi,

Inside the /0 directory I have the initialConditions file with
--------------------------
sideslip 20;
velocityMagnitude 20;
pressure 0;
turbulentKE 0.24;
turbulentOmega 1.78;
#inputMode merge
--------------------------

I have the U file with :
--------------------------
#include "initialConditions"

dimensions [0 1 -1 0 0 0 0];

internalField uniform ($velocityMagnitude*cos(sideslip) $velocityMagnitude*sin(sideslip) 0);

--------------------------

The last line (internalField uniform ...) is not valid.

Is it possible to write such an expression there ?

Regards,

Stephane

olesen November 26, 2009 02:25

Quote:

Originally Posted by openfoam_user (Post 237700)
I have the U file with :
--------------------------
#include "initialConditions"

dimensions [0 1 -1 0 0 0 0];

internalField uniform ($velocityMagnitude*cos(sideslip) $velocityMagnitude*sin(sideslip) 0);
--------------------------

The last line (internalField uniform ...) is not valid.

Is it possible to write such an expression there ?

No, what you are trying isn't possible. The code would need an extra interpreter in the dictionary processing for that to work.
If you don't mind having two passes, you could write an "initialConditions.m4" and pass it through the m4 processor first to produce your "initialConditions" file.
If you look through the tutorials, you can see a few examples where m4+perl has been used to create blockMeshDict files.

Here's a quick way to find those examples:
Code:

git ls-files | grep .m4


All times are GMT -4. The time now is 01:28.