Turbulence model struct in matlab

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Turbulence model struct in matlab

Leon Robers
I want to activate the k-epsilon turbulence model for solving with openFoam directly in matlab.
I know that it must be a struct with the 3 fields ( model, inlet [k,e/o], wallfcn [1/0]) but I'm not sure how the correct syntax looks like
I'd appreciate more specific information how to set up this struct. thanks!
attached is the same turbulence model directly edited in the feaTool-openFoam Interface
Reply | Threaded
Open this post in threaded view
|

Re: Turbulence model struct in matlab

Precise Simulation
Administrator
If I understand you correctly you wish to use the openfoam solver interface in a Matlab m-script file?

A general tip for learning the FEATool m-file syntax is to use the "File" > "Save As MATLAB Script..." from the GUI. This will export your GUI model to a MATLAB m-script file which you can run on the command line (and open and edit in a text editor).

In your case, if you run the "File" > "Model Examples And Tutorials" > "Fluid Dynamics" > "Turbulent Flow Over a Backwards Facing Step" tutorial model, and save it as an m-file when it is done. Then if you open that file you can see that the "openfoam(...)" solver is called with the arguments:

    struct( 'model', 'kEpsilon', 'inlet', [0.375,14.855], 'wallfcn', 1 )

which here defines the 'kEpsilon' turbulence model with inlet values 0.375 for the turbulent kinetic energy k, and 14.855 for the dissipation rate epsilon, with wall functions enabled. Alternatively, you can use the 'kOmega' turbulence model for which the second inlet value corresponds to the value for omega.


Leon Robers wrote
I want to activate the k-epsilon turbulence model for solving with openFoam directly in matlab.
I know that it must be a struct with the 3 fields ( model, inlet [k,e/o], wallfcn [1/0]) but I'm not sure how the correct syntax looks like
I'd appreciate more specific information how to set up this struct. thanks!
attached is the same turbulence model directly edited in the feaTool-openFoam Interface
Reply | Threaded
Open this post in threaded view
|

Re: Turbulence model struct in matlab

Leon Robers
perfect, thank you.

I do not want to use the openFoam solver interface but just implement the turbulent model in matlab, just as you explained.

Totally true, exporting the code from feaTool to a MATLAB.m file helps. I did this before but somehow forgot to do this in this specific case. Thanks again