-
-
Notifications
You must be signed in to change notification settings - Fork 82
Configuration
In order to run a coupled simulation, you need to:
- prepare a preCICE configuration file (described in the preCICE configuration),
- prepare an adapter's configuration file,
- set the coupling boundaries in the OpenFOAM case,
- load the adapter, and
- start all the solvers normally, from the same directory, e.g. in two different terminals.
If you prefer, you may find an already prepared case in the tutorials/ directory. See also the description of this case in our Tutorial for CHT: Flow over a heated plate.
You may skip the section "Advanced configuration" in the beginning, as it only concerns special cases.
The adapter is configured via the file precice-adapter-config.yml
, which
needs to be present in the case directory. This file is a YAML file with the
following form:
participant: Fluid
precice-config-file: /path/to/precice-config.xml
interfaces:
- mesh: Fluid-Mesh
locations: faceCenters
patches: [interface]
write-data: Temperature
read-data: Heat-Flux
CHTenabled: true
FSIenabled: false
The participant
needs to be the same as the one specified in the precice-config-file
,
which is the main preCICE configuration file. If the path is omitted,
precice-config.xml must be in the parent directory of the cases, where preCICE
is started from.
In the interfaces
, a list with the coupled interfaces is provided.
The mesh
needs to be the same as the one specified in the precice-config-file
.
The patches
specifies a list of the names of the OpenFOAM boundary patches that are
participating in the coupled simulation. These need to be defined in the files
included in the 0/
directory.
The locations
field is optional and its default value is faceCenters
(with faceCentres
also accepted), signifying that the interface mesh is defined on the cell face centers. The alternative option is faceNodes
, which defines the mesh on the face nodes and is needed e.g. for reading displacements in an FSI scenario.
The values for write-data
and read-data
for conjugate heat transfer
can be Temperature
, Heat-Flux
, Sink-Temperature
,
or Heat-Transfer-Coefficient
. Values like Sink-Temperature-Domain1
are also allowed.
For a Dirichlet-Neumann coupling, the write-data
and read-data
can be
either (Temperature
, Heat-Flux
) or (Heat-Flux
, Temperature
).
For a Robin-Robin coupling, they can be either (Heat-Transfer-Coefficient
, Sink-Temperature
)
or (Sink-Temperature
, Heat-Transfer-Coefficient
).
For fluid-structure interaction, write-data
can only be Force
(with any postfix), while read-data
can be Displacement
, as well as DisplacementDelta
(with any postfix).
The CHTenabled
enables the conjugate heat transfer module (defaults to false
). The FSIenabled
enables the fluid-structure interaction module (defaults to false
). One needs to activate at least one of them, even though using both at the same time has not been tested.
A few changes are required in the configuration of an OpenFOAM case, in order to specify the interfaces and load the adapter. For some solvers, additional parameters may be needed (see "advanced configuration").
The type of the read-data
needs to be in accordance with the respective boundary
conditions set for each field in the 0/
directory of the case.
Read the OpenFOAM User Guide for more on boundary conditions.
- For
read-data: Temperature
, usetype fixedValue
for theinterface
in0/T
. OpenFOAM requires that you also give a (redundant)value
, but the adapter will overwrite it. ParaView uses this value for the initial time. As a placeholder, you can e.g. use the value from the internalField.
interface
{
type fixedValue;
value $internalField;
}
- For
read-data: Heat-Flux
, usetype fixedGradient
for theinterface
in0/T
. OpenFOAM requires that you also give a (redundant)gradient
, but the adapter will overwrite it.
interface
{
type fixedGradient;
gradient 0;
}
- For
read-data: Sink-Temperature
orHeat-Transfer-Coefficient
, usetype mixed
for theinterface
in0/T
. OpenFOAM requires that you also give (redundant) values forrefValue
,refGradient
, andvalueFraction
, but the adapter will overwrite them.
interface
{
type mixed;
refValue uniform 293;
valueFraction uniform 0.5;
refGradient uniform 0;
}
- For
read-data: Displacement
orDisplacementDelta
, you need the following:-
type movingWallVelocity
for the interface (e.g.flap
) in0/U
, -
type fixedValue
for the interface (e.g.flap
) in the0/pointDisplacement
, and -
solver displacementLaplacian
in theconstant/dynamicMeshDict
.
-
// File 0/U
interface
{
type movingWallVelocity;
value uniform (0 0 0);
}
// File 0/pointDisplacement
interface
{
type fixedValue;
value $internalField;
}
// File constant/dynamicMeshDict
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ("libfvMotionSolvers.so");
solver displacementLaplacian;
To load this adapter, you must include the following in
the system/controlDict
configuration file of the case:
functions
{
preCICE_Adapter
{
type preciceAdapterFunctionObject;
libs ("libpreciceAdapterFunctionObject.so");
}
}
This directs the solver to use the preciceAdapterFunctionObject
function object,
which is part of the libpreciceAdapterFunctionObject.so
shared library.
The name preCICE_Adapter
can be arbitrary.
These additional parameters may only concern some users is special cases. Keep reading if you want to use an incompressible or basic solver for conjugate heat transfer, if you are using a solver with different variable names (e.g. a multiphase solver) or if you are trying to debug a simulation.
Some solvers may not read all the material properties that are required for a coupled simulation. These parameters need to be added in the OpenFOAM configuration files, but the solver does not need to read them.
For conjugate heat transfer, the adapter assumes that a solver belongs to one of the following categories: compressible, incompressible, or basic. Most of the solvers belong in the compressible category and do not need any additional information. The other two need one or two extra parameters, in order to compute the heat flux.
For incompressible solvers (like the buoyantBoussinesqPimpleFoam), you need to add the density and the specific heat in the constant/transportProperties
file. For example:
rho rho [ 1 -3 0 0 0 0 0 ] 50;
Cp Cp [ 0 2 -2 -1 0 0 0 ] 5;
For basic solvers (like the laplacianFoam), you need to add a constant conductivity in the constant/transportProperties
:
DT DT [ 0 2 -1 0 0 0 0 ] 1;
k k [ 1 1 -3 -1 0 0 0 ] 100;
Do not delete the, already provided in the pure solver, DT
, as laplacianFoam
expects it.
The value of k
is connected to the one of DT
and depends on the density (rho [ 1 -3 0 0 0 0 0 ]
) and heat capacity (Cp [ 0 2 -2 -1 0 0 0 ]
). It needs to hold DT = k / rho / Cp
.
Currently, the adapter's FSI functionality only supports incompressible solvers. In this context, it tries to read uniform values for the kinematic viscosity and density from the constant/transportProperties
dictionary:
nu nu [ 0 2 -1 0 0 0 0 ] 1e-03;
rho rho [1 -3 0 0 0 0 0] 1e-0;
Some optional parameters can allow the adapter to work with more solvers, whose type is not determined automatically, their fields have different names or they do not work well with some features of the adapter.
The adapter tries to automatically determine the solver type,
based on the dictionaries that the solver uses.
However, you may manually specify the solver type to be basic
,
incompressible
or compressible
for a CHT simulation:
solverType: compressible
This will force the adapter use the boundary condition implementations for the respective type. Not such option is currently available for FSI simulations.
The names of the parameters and fields that the adapter looks for can be changed, in order to support a wider variety of solvers. You may specify the following parameters in the adapter's configuration file (the values correspond to the default values):
# Temperature field
nameT: T
# transportProperties dictionary
nameTransportProperties: transportProperties
# thermal conductivity
nameKappa: k
# density
nameRho: rho
# heat capacity for constant pressure
nameCp: Cp
# Prandtl number
namePr: Pr
# turbulent thermal diffusivity
nameAlphat: alphat
The adapter also recognises a few more parameters, which are mainly used in debugging or development.
These are optional and expect a yes
or a no
value. Some or all of these options may be removed in the future.
-
preventEarlyExit: No
prevents the adapter from setting the solver'sendTime
to infinity. -
evaluateBoundaries: No
prevents the adapter from computing the values on the faces (from the values on the cell centers) after reading a checkpoint. -
subcycling: No
disallows the subcycling and an error is reported in that case. -
disableCheckpointing: Yes
prevents the adapter from adding any fields into the list of checkpointed fields.
The user can toggle debug messages at build time.
More information on precice.org. Subscribe to the preCICE mailing list.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Please use "precice.org" for the attribution.