Code_Saturne

Salome-CFD

Daniel Weschke

May 12, 2021

1 Preliminary remarks

1.1 Installation

1.1.1 Salome-CFD

If python2 is not default create virtual environment with python2 as default python

sudo pacman -S python-virtualenv
# or/and: sudo pacman -S python2-virtualenv
mkdir ~/.virtualenvs
cd ~/.virtualenvs
virtualenv -p /usr/bin/python2.7 salome-meca
# or: virtualenv2 salome-meca
source ~/.virtualenvs/salome-meca/bin/activate
python -m pip install numpy

Download (https://www.code-saturne.org/cms/ - SALOME_CFD - http://www.salome-platform.org/contributions/edf_products - SALOME_CFD - Download Salome-CFD (Development version based on Code_Saturne 5.2 and SALOME 8.5), run installer

./Salome_CFD-SCFD_V8_5_0-Code_Saturne-5_2-univ_d54f597c.run
1.1.1.1 Start program from command line
~/salome-cfd/appli_SCFD_V8_5_0/salome  #  while virtualenv is active
# or
python2 ~/salome_meca/appli_V2018/salome
1.1.1.2 Start program with desktop file

Edit ~/Desktop/Salome-CFD_SCFD_V8_5_0.desktop and/or ~/.local/share/applicaton/Salome-CFD_SCFD_V8_5_0.desktop

# change from
Exec=$HOME/salome-cfd/appli_V8_5_0/salome %f
# to
Exec=python2 $HOME/salome-cfd/appli_SCFD_V8_5_0/salome %f
# or
Exec=sh -c "source $HOME/.virtualenvs/salome-meca/bin/activate; $HOME/salome-cfd/appli_SCFD_V8_5_0/salome %f"
1.1.1.3 Errors

Fix error if necessary (use system lib instead of the included lib)

Searching /Kernel/Session in Naming Service +SALOME_Session_Server: /home/<user>/salome-cfd/Salome_CFD-SCFD_V8_5_0-Code_Saturne-5_2-univ_d54f597c/prerequisites/debianForSalome/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /lib64/libGLU.so.1)
mv ~/salome-cfd/Salome_CFD-SCFD_V8_5_0-Code_Saturne-5_2-univ_d54f597c/prerequisites/debianForSalome/lib/libstdc++.so.6{,-bak}

1.2 Salome-CFD

2d analysis has to be performed with a 3d mesh. That is one element normal to the 2d mesh. Therefore either create a 3d geometry as a 2d structure with a small thickness or a 2d geometry but later during the meshing extrude the 2d mesh to have one element in the normal direction, this is then a 3d mesh. Also create a group for both plate surfaces to apply the symmetry condition.

1.3 Code_Saturne

Code_saturne can be coupled with:

  • itself; for conjugate heat transfer, in order to couple different models (RANS/LES), or to model fluid-structure interaction with large displacement or the rotating machines

  • Code_Aster; in order to model the fluid-structure interaction

  • SYRTHES; in order to model the conjugate heat transfer

https://www.code-saturne.org/cms/features/modules/coupling

1.4 SYRTHES

SYRTHES is dedicated to transient thermal simulations in complex solid geometries.

1.5 Batch

For command line batch calculations the mesh file and the setup.xml file is needed.

1.6 Consistent units

Definition of a consistent system of units

System

m kg

mm t

Length l

1 m

1000 mm

Mass m

1 kg

1e-3 t

Time t

1 s

1 s

Force F

1 N

1 N

Stress σ

1e8 Pa

100 MPa

Torque τ (moment M)

1 N m

1000 N mm

Energy E

1 J

1 J

Density ρ

1000 kg/m³

1e-9 t/mm³

Young’s modulus E

1e11 Pa

1e5 MPa

Velocity v

1 m/s

1000 mm/s

Acceleration a

1 m/s²

1000 mm/s²

Thermal conductivity λ

1 W/(m K)

1e-3 W/(mm K)

Specific heat capacity isobaric cp

1 J/(kg K)

1000 J/(t K)

Volumetric heat capacity ρ cp

1 J/(m³ K)

1e-9 J/(mm³ K)

Standard gravity g

9.80665 m/s²

9806.65 mm/s²

Note: Torque is not equal to Energy. E = τθ, where E is the energy, τ is magnitude of the torque, and θ is the angle moved (in radians).

2 CFDSTUDY

Display CFDSTUDY toolbar: View - Toolbars - CFDSTUDY

To create a new study: CFDSTUDY - Choose an existing CFD study or Create

  • Create study - define the working directory, click Choose to except current working directory

  • Study name - define the name of the study

  • Cases - define a name for the case, e.g. case1. One study can have multiple cases.

  • optionally, select Coupling with Syrthes

  • OK

Because CFDSTUDY do no communicate with the mesh module, the mesh has to be exported and then inside CFDSTUDY imported. When exporting the <study-dir>/MESH is a good place to put the mesh.

In the Object Browser right click on: CFDSTUDY - study-folder - case-folder, and click on Launch GUI. Click on the icon Save CFD Data File in the tool bar to create and later save the setup.xml file.

Note: A bug makes it necessary to rearrange the windows. De-attaching the side-bar and no re-attaching of the setup.xml window. The Browser can be re-attached.

3 Geometry

For multipart geometry a better way to fuse / merge it to use the function: Operation - Partition

  • Objects - select all part

  • Apply and Close

this will then have intersection / contact surfaces to select later for meshing or boundary conditions.

Define also groups for inlet, outlet, walls, symmetry, …

For meshing it also can help to have edge groups. To generate edge groups Operation - Blocks - Propagate

  • Objects - the geometry

  • Apply and Close

4 Mesh

For hexahedron able meshes Mesh - Create Mesh

  • 3D - Algorithm: Hexahedron (l,j,k)

  • 2D - Algorithm: Quadrangle: Mapping

  • 1D

    • Algorithm: Wire Discretisation

    • Hypothesis: Local Length

Mesh - Compute

Refine with edge groups

For “2D” studys, the thickness Mesh - Create Sub-mesh

  • Geometry - thickness edge group

  • 1D

    • Algorithm: Wire Discretisation

    • Hypothesis: Number of Segments

      • Number of Segments: 1

Gradually refined mesh Mesh - Create Sub-mesh Geometry - edge group

  • 1D

    • Algorithm: Wire Discretisation

    • Hypothesis: Arithmetic Progression (check the direction arrows in the geomerty window, if not all in same direction use the Helper - Propagation chains)

Define also groups from the geometry, for inlet, outlet, walls, symmetry, … Mesh - Create Groups from Geometry

Note export mesh for CFDSTUDY, e.g. to ./<study-dir>/MESH/mesh.med (study dir and MESH folder are created during CFDSTUDY study creation: CFDSTUDY - Choose an existing CFD study or Create)

See also next section.

5 Model physics

In the Object Browser right click on: CFDSTUDY - study-folder - case-folder, and click on Launch GUI. Click on the icon Save CFD Data File in the tool bar to create and later save the setup.xml file.

Add mesh to the study: CFDSTUDY - Calculation environment - Meshes selection

  • Meshes - Mesh import - Add a mesh. (plus sign) - select the mesh file.

Switch from Preprocessing Mode to Calculation Mode (last icon inside the CFDSTUDY tollbar)

Thermophysical models

  • Calculation features

    • Steady / Unsteady flow algorithm

  • Turbulence models

    • Turbulence model

      • No model (i.e. laminar flow)

      • Mixing length

      • k-epsilon

      • k-epsilon Linear Production

      • Rij-epsilon LRR

      • Rij-epsilon SSG

      • Rij-epsilon EBRSM

      • v2f BL-v2/k

      • k-omega SST

      • Spalart-Allmaras

      • LES (Smagorinsky)

      • LES (classical dynamic model)

      • LES (WALE)

  • Thermal model (Code_Saturne ISCALT, ISCSTH)

    • one of

      • No thermal scalar

      • Temperature (Celsius)

      • Temperature (Kelvin)

      • Enthalpy (J/kg)

  • Radiative transfers (if thermal model is active)

  • Conjugate heat transfer (if thermal model is active)

6 Fluid

Physical properties - Fluid properties

  • Density

    • constant

    • Reference value ρ in kg/m³ (Code_Saturne RO0), e.g. 1.17862

  • Viscosity

    • constant

    • Reference value μ in Pa.s (Code_Saturne VISCL0), e.g. 1.83e-05

  • Specific heat

    • constant

    • Reference value Cp J/kg/K (Code_Saturne CP0), e.g. 1017.24

  • Thermal conductivity

    • constant

    • Reference value λ in W/m/K, e.g. 0.02495

7 Initial and Boundary Conditions

Volume conditions - Initialization

  • Initialization

    • Velocity - click on the (red) button and define the initial velocity of the model

      • User expression - e.g. velocity[0] = 0.; velocity[1] = 0.; velocity[2] = 0.;

      • OK.

    • Thermal - click on the (red) button and define the initial temperature of the model

      • User expression - e.g. “temperature = 20.;” (room temperature if Celcius is active)

      • OK.

Boundary Conditions

  • Definition of boundary regions

    • one of

      • Definition of boundary regions - either choose Add from Salome but first select the group in the Object Browser (mesh groups) or choose Add and name it with Selection criteria exactly the same as for the mesh group. Change the Label and Nature (double click) accordingly.

      • Add from Preprocessor listing - Import groups and references from Preprocessor listing - select the file, e.g. at ./<study-dir>/<case-dir>/RESU/quality-<datetime>/preprocessor.log

        • to create this file

          • Change to Preprocessor Mode (second last icon inside the CFDSTUDY toolbar)

          • Calculation management - Prepare batch calculation

            • Calculation script parameters - Preprocessing type: Mesh quality criteria

            • Calculation start - Start calculation

    • to apply a boundary condition to multiple mesh groups use the logical word “and” inside the Selection criteria (can also be a python expression to define limits for example), e.g. inlet and outlet.

  • Boundary conditions - Boundary conditions

    • Inlet

      • ☐ Convective Inlet

      • ☐ Mapped Inlet

      • Velocity - specify the velocity. If using user law (formula) do not forget the semicolon.

        • norm in m/s - e.g. 1.0

        • Direction

          • normal direction to the inlet

          • specific coordinates - e.g. in x direction:

            • X: 1

            • Y: 0

            • Z: 0

          • user profile

      • Turbulence

        • Calculation by hydraulic diameter - Hydraulic diameter in m - e.g. 1.0

        • Calculation by turbulent intensity

          • Intensity in % - e.g. 2.0

          • Hydraulic diameter in m - e.g. 1.0

        • Calculation by formula

      • Thermal - temperature

        • Type: Prescribed value

          • Value - e.g. 300

        • Prescribed value (user law)

    • Outlet

      • Thermal of backflow - temperature

        • Prescribed value

        • Prescribed value (user law)

        • Precribed (outgoing) flux

          • Flux - e.g. 0.0

    • Wall

      • Smooth or rough wall [X] Smooth wall / [ ] Rough wall

      • ☐ Sliding wall

      • Thermal

        • Prescribed value

        • Prescribed value (user law)

        • Prescribed (outgoing) flux

          • Flux - e.g. 0.0

        • Prescribed (outgoing) flux (user law)

        • Exchange coefficient

        • Exchange coefficient (user law)

8 Analysis

Numerical parameters

  • Global parameters - Velocity-Pressure algorithm: SIMPLE / SIMPLEC (default) / PISO

  • Equation parameters

    • Solver - Solver Precision - may be decrease this value some order of magnitudes.

    • Clipping - Name / Minimal value / Maximal value

      • temperature / -273.15 / 1e+12 - this very open field might be narrowed by values we know will never be reached.

  • Pseudo-Time step - Time step option

    • Reference time step in s - e.g. 0.1

    • Number of iterations (restart included) - define the number of time steps, e.g. 10

9 Output

Calculation control

  • Output control

    • Writer

      • select the results row

        • Name: results

        • Id: -1

        • Format

          • EnSight - results.case

          • MED - results.med

          • CGNS

          • Catalyst

          • Histogram

          • Melissa

          • CCM-IO

      • Frequency

        • No periodic output - only the last step is in the file and no monitoring point information is available.

        • Output every ’n’ time steps

        • Output every ’x’ seconds

        • Output using a formula

    • Monitoring points

      • Monitoring points output - Format - choose .csv (easier for ParaViS)

      • Monitoring points coordinates - Add a monitoring point. (plus sign)

  • Volume solution control - make sure the Monitoring flags are set if using monitoring.

  • Profiles - Definition of 1D profiles - Add - select the profile

    • choose all Velocity components for example

    • Line Definition (click on the button): for example for x, y and z and the values 1, s and 0 means a line at x=1, y, z=0.

10 Calculation

To run a calculation: Calculation management - Prepare batch calculation - Calculation start - Start calculation

Results in ./<study-dir>/<case-dir>/RESU/<date-time>/postprocessing

11 ParaViS

  • EnSight .case open ./<study-dir>/<case-dir>/RESU/<date-time>/postprocessing/RESULTS.case

    • Filters: Extract Block - Block Indices - Fluid domain

    • Filters: Cell Data to Point Data (to average the result)

  • MED .med open ./<study-dir>/<case-dir>/RESU/<date-time>/postprocessing/RESULTS.med

    • select in Properties Fluid domain - [X] ComSup0

    • Pressure is directly available

    • Temperature: Filters - Alphabetical - Extract Component - Properties - Input Array: TempC

    • otherwise: Filters: Cell Data to Point Data (to average the result)

    Filters - Alphabetical - Glyph

12 Errors

  • Error in calculation stage. solver script exited with status 1. Error running the calculation. Check Code_Saturne log (listing) and error* files for details.

    • see ./<study-dir>/<case-dir>/RESU/<datetime>/listing

  • $HOME/salome-cfd/Salome_CFD-SCFD_V8_5_0-Code_Saturne-5_2-univ_d54f597c/modules/CFDSTUDY_v52/libexec/code_saturne/cs_solver: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory solver script exited with status 127.

    • yay -S numactl