CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

How to initialize flat interface with setExprFields (and "complex" mesh) ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 15, 2023, 05:47
Default How to initialize flat interface with setExprFields (and "complex" mesh) ?
  #1
ALN
New Member
 
ALN
Join Date: Nov 2023
Posts: 3
Rep Power: 2
ALN is on a distinguished road
Hi, I would like to initialize a flat interface in a case with real bathymetry and cartesian mesh (generated with cfMesh). Some of the cells are wobbly, so interface is not flat. My idea is to put an alpha (phase volume fraction) proportional to the height of my interface in the cells (for example if the z_interface crosses the middle of the cell, alpha=0.5).

To do that, I would like to use setExprField (https://www.openfoam.com/documentation/guides/latest/doc/openfoam-guide-expression-syntax.html) . The trouble is : I can not find a way to access to the coordinates of nodes.

I try to put something with pts().z() in expression but this error appears :



--> FOAM FATAL ERROR: (openfoam-2206)
Mismatch between field-mask geometric type (cells) and
expression geometric type (points)



which makes sense. How to get pts().z()[0] for example ?

Many thanks for your attention !
ALN is offline   Reply With Quote

Old   November 16, 2023, 06:03
Default
  #2
ALN
New Member
 
ALN
Join Date: Nov 2023
Posts: 3
Rep Power: 2
ALN is on a distinguished road
Finally, I find a way to do what I want with setAlphaFieldDict. The file looks like this :

Code:
field "alpha.water";

type composedFunction;
mode add;
composedFunction
{
    plane
    {
        type plane;
        origin (723480 7594560 0.);
        normal (0 0 -1);
    }

}

and it is activated with setAlphaField
ALN is offline   Reply With Quote

Reply

Tags
initialisation, interface, openfoam, pre-processing, setexprfields


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 14:42.