PreciceAdapter

There are two different precice adapters, one for surface coupling (PreciceAdapter) and one for volume coupling (PreciceAdapterVolumeCoupling) .

Surface coupling

The precice adapter is a simple wrapper to its nested solvers:

C++ code:

// surface coupling adapter
Control::PreciceAdapter<
  /*nested solver*/
>

The python settings for the surface coupling adapter are as follows:

"PreciceAdapter": {        # precice adapter for muscle
  "timeStepOutputInterval":   100,                        # interval in which to display current timestep and time in console
  "timestepWidth":            1,                          # coupling time step width, must match the value in the precice config
  "couplingEnabled":          variables.enable_coupling,  # if the precice coupling is enabled, if not, it simply calls the nested solver, for debugging
  "preciceConfigFilename":    "precice_config_muscle_dirichlet_tendon_neumann_implicit_coupling_multiple_tendons.xml",    # the preCICE configuration file
  "preciceParticipantName":   "MuscleSolver",             # name of the own precice participant, has to match the name given in the precice xml config file
  "scalingFactor":            1,                          # a factor to scale the exchanged data, prior to communication
  "outputOnlyConvergedTimeSteps": True,                   # if the output writers should be called only after a time window of precice is complete, this means the timestep has converged
  "preciceMeshes": [                                      # the precice meshes get created as the top or bottom surface of the main geometry mesh of the nested solver
    {
      "preciceMeshName":      "MuscleMeshBottom",         # precice name of the 2D coupling mesh
      "face":                 "2-",                       # face of the 3D mesh where the 2D mesh is located, "2-" = bottom, "2+" = top
    },
    {
      "preciceMeshName":      "MuscleMeshTopA",           # precice name of the 2D coupling mesh
      "face":                 "2+",                       # face of the 3D mesh where the 2D mesh is located, "2-" = bottom, "2+" = top
    },
    {
      "preciceMeshName":      "MuscleMeshTopB",           # precice name of the 2D coupling mesh
      "face":                 "2+",                       # face of the 3D mesh where the 2D mesh is located, "2-" = bottom, "2+" = top
    },
  ],
  "preciceData": [
    {
      "mode":                 "read-displacements-velocities",    # mode is one of "read-displacements-velocities", "read-traction", "write-displacements-velocities", "write-traction"
      "preciceMeshName":      "MuscleMeshBottom",                 # name of the precice coupling surface mesh, as given in the precice xml settings file
      "displacementsName":    "Displacement",                     # name of the displacements "data", i.e. field variable, as given in the precice xml settings file
      "velocitiesName":       "Velocity",                         # name of the velocity "data", i.e. field variable, as given in the precice xml settings file
    },
    {
      "mode":                 "read-displacements-velocities",    # mode is one of "read-displacements-velocities", "read-traction", "write-displacements-velocities", "write-traction"
      "preciceMeshName":      "MuscleMeshTopA",                   # name of the precice coupling surface mesh, as given in the precice xml settings file
      "displacementsName":    "Displacement",                     # name of the displacements "data", i.e. field variable, as given in the precice xml settings file
      "velocitiesName":       "Velocity",                         # name of the velocity "data", i.e. field variable, as given in the precice xml settings file
    },
    {
      "mode":                 "read-displacements-velocities",    # mode is one of "read-displacements-velocities", "read-traction", "write-displacements-velocities", "write-traction"
      "preciceMeshName":      "MuscleMeshTopB",                   # name of the precice coupling surface mesh, as given in the precice xml settings file
      "displacementsName":    "Displacement",                     # name of the displacements "data", i.e. field variable, as given in the precice xml settings file
      "velocitiesName":       "Velocity",                         # name of the velocity "data", i.e. field variable, as given in the precice xml settings file
    },
    {
      "mode":                 "write-traction",                   # mode is one of "read-displacements-velocities", "read-traction", "write-displacements-velocities", "write-traction"
      "preciceMeshName":      "MuscleMeshBottom",                 # name of the precice coupling surface mesh, as given in the precice xml settings
      "tractionName":         "Traction",                         # name of the traction "data", i.e. field variable, as given in the precice xml settings file
    },
    {
      "mode":                 "write-traction",                   # mode is one of "read-displacements-velocities", "read-traction", "write-displacements-velocities", "write-traction"
      "preciceMeshName":      "MuscleMeshTopA",                   # name of the precice coupling surface mesh, as given in the precice xml settings
      "tractionName":         "Traction",                         # name of the traction "data", i.e. field variable, as given in the precice xml settings file
    },
    {
      "mode":                 "write-traction",                   # mode is one of "read-displacements-velocities", "read-traction", "write-displacements-velocities", "write-traction"
      "preciceMeshName":      "MuscleMeshTopB",                   # name of the precice coupling surface mesh, as given in the precice xml settings
      "tractionName":         "Traction",                         # name of the traction "data", i.e. field variable, as given in the precice xml settings file
    },
  ],

Volume coupling

The precice adapter is a simple wrapper to its nested solvers:

C++ code:

// volume coupling adapter
Control::PreciceAdapterVolumeCoupling<
  /*nested solver*/
>

The python settings for the volume coupling adapter are as follows:

"PreciceAdapterVolumeCoupling": {
  "timeStepOutputInterval":   100,                        # interval in which to display current timestep and time in console
  "timestepWidth":            1,                          # coupling time step width, must match the value in the precice config
  "couplingEnabled":          True,                       # if the precice coupling is enabled, if not, it simply calls the nested solver, for debugging
  "endTimeIfCouplingDisabled": variables.end_time,        # if "couplingEnabled" is set to False, use this end time for the simulation
  "preciceConfigFilename":    "../precice_config.xml",    # the preCICE configuration file
  "preciceParticipantName":   "PartitionedFibers",        # name of the own precice participant, has to match the name given in the precice xml config file
  "scalingFactor":            1,                          # a factor to scale the exchanged data, prior to communication
  "outputOnlyConvergedTimeSteps": True,                   # if the output writers should be called only after a time window of precice is complete, this means the timestep has converged

  "preciceData": [
    {
      "mode":                 "read",                     # mode is one of "read" or "write"
      "preciceDataName":      "Geometry",                 # name of the vector or scalar to transfer, as given in the precice xml settings file
      "preciceMeshName":      "PartitionedFibersMesh",    # name of the precice coupling mesh, as given in the precice xml settings file
      "opendihuMeshName":     None,                       # extra specification of the opendihu mesh that is used for the initialization of the precice mapping. If None or "", the mesh of the field variable is used.
      "slotName":             None,                       # name of the existing slot of the opendihu data connector to which this variable is associated to (only relevant if not isGeometryField)
      "isGeometryField":      True,                       # if this is the geometry field of the mesh
    },
    {
      "mode":                 "write",                    # mode is one of "read" or "write"
      "preciceDataName":      "Gamma",                    # name of the vector or scalar to transfer, as given in the precice xml settings file
      "preciceMeshName":      "PartitionedFibersMesh",    # name of the precice coupling mesh, as given in the precice xml settings file
      "opendihuMeshName":     None,                       # extra specification of the opendihu mesh that is used for the initialization of the precice mapping. If None or "", the mesh of the field variable is used.
      "slotName":             "gamma",                    # name of the existing slot of the opendihu data connector to which this variable is associated to (only relevant if not isGeometryField)
      "isGeometryField":      False,                      # if this is the geometry field of the mesh
    },
  ],

  # options of the nested solver
}