-
-
Notifications
You must be signed in to change notification settings - Fork 101
Configuration
This page explains the configuration that is specific to the OpenFOAM adapter. Please refer to the preCICE wiki for configuring preCICE.
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. (TODO: add link to wiki)
You may skip the section "Advanced configuration" in the beginning, as it concerns only 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
patches: [interface]
write-data: Temperature
read-data: Heat-FluxThe 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 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.
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. For conjugate heat transfer, use the following:
- For
read-data: Temperature, usetype: fixedValuefor theinterfacein0/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: fixedGradientfor theinterfacein0/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-TemperatureorHeat-Transfer-Coefficient, usetype: mixedfor theinterfacein0/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;
}Read the OpenFOAM User Guide for more on boundary conditions.
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.
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: compressibleThis will force the adapter use the boundary condition implementations for the respective type.
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: alphatThe 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: Noprevents the adapter from setting the solver'sendTimeto infinity. -
evaluateBoundaries: Noprevents the adapter from computing the values on the faces (from the values on the cell centers) after reading a checkpoint. -
subcycling: Nodisallows the subcycling and an error is reported in that case. -
disableCheckpointing: Yesprevents 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.
