Skip to content

OpenFOAM setup (solid)

Gerasimos Chourdakis edited this page Feb 9, 2020 · 7 revisions

OpenFOAM has solvers that can also be used for solids. In this tutorial, we use the basic solver laplacianFoam. Most of the configuration files are similar to the Fluid participant.

The case directory for the solid is very similar to the one for the fluid, with less files:

  • 0/: State of the domain at time=0. In other words: the initial and boundary conditions.
    • T: Temperature field
  • constant/: Model properties
    • transportProperties: Basic transport properties. Solvers that do not use the thermophysical models library use this file. The solver reads only the parameter DT, that is the thermal diffusivity. Since this kind of solver does not read the density or specific heat, we provide the conductivity as a constant in this file and only the adapter reads it.
  • system/: Solver properties
    • blockMeshDict: Mesh properties. The mesh is produced with the command blockMesh. In this case, we only have one block, without any grading.
    • controlDict: Time step length, end time, output settings etc
    • fvSchemes: Finite Volume Schemes - the numerical schemes
    • fvSolution: Finite Volume Solution - the numerical solvers' parameters
    • preciceDict: Our adapter's configuration file
  • Solid.foam: An empty file that serves as a reference to ParaView

Let's see what is different from the Fluid participant.

Boundary conditions

The 0/T file defines the following for the interface:

interface
{
    type            fixedValue;
    value           $internalField;
}

The type fixedValue is important, since we want to read temperature values in this patch. The value is not important, as it is overwritten. However, the file reader of ParaView requires a value to be set for the initial time. See the adapter's configuration page for more.

Model properties

The laplacianFoam is a basic solver, meaning that it does not use any thermophysical or turbulence model libraries. It only solves a laplacian equation, which in this case can model the heat conduction on the solid.

This equation has a parameter DT, which describes the thermal diffusivity. The adapter also needs the thermal conductivity, which it cannot compute from the available information. Therefore, we read it as an additional scalar from preciceDict:

CHT
{
   k   [ 1  1 -3 -1 0 0 0 ] 100;
};

The value for k needs to be in accordance with DT (DT [ 0 2 -1 0 0 0 0 ] 1, see constant/transportProperties): k = DT * rho * Cp, for the assumed values of density and heat capacity (choose your values).

The adapter's configuration file

The preciceDict file needs to be in the system/ directory. In this case, it contains the following:

FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      preciceDict;
}

preciceConfig "precice-config.xml";

participant Solid;

modules (CHT);

interfaces
{
  Interface1
  {
    mesh              Solid-Mesh;
    patches           (interface);
    
    readData
    (
      Temperature
    );
    
    writeData
    (
      Heat-Flux
    );
  };
};

CHT
{
   k   [ 1  1 -3 -1 0 0 0 ] 100;
};

Again, we want to perform a Dirichlet-Neumann coupling. We specify that the Solid participant should write heat fluxes and it should read temperatures. Therefore:

  • We set writeData: Heat-Flux and readData: Temperature for the Solid.
  • We set type fixedValue for the temperature at the interface for the Solid.
  • We set writeData: Temperature and readData: Heat-Flux for the Fluid.
  • We set type fixedGradient for the temperature at the interface for the Fluid.

Read more at the adapter's configuration page.