Skip to content

Restructuring of the TRM process: Split constitutive setting

This MR is part of a bigger development to restructure the TRM process to allow for more flexible material models and to avoid code duplication. It's a follow-up of !4153 (merged). This MR, again, is very large. However, most of the changes are moved code and added boilerplate code. No behaviour changes are intended.

Overview

ProcessLib/ThermoRichardsMechanics/Constitutive

  • Contains the individual parts of the constitutive setting of the TRM process. I.e., there is no new code in this directory, only the old code plus lots of boilerplate code.
  • Constitutive models and constitutive data are separated, i.e., located in different structs.
  • All constitutive data have their custom data type, even if it contains only a single double value.
  • The constitutive models use out parameters for their results, not function return values. They can compute multiple results (e.g., SolidMechanicsModel). The plan is that in the future a graph algorithm will automatically determine the evaluation order of the models and how to pass data. I believe that this graph algorithm will be a bit simpler when using out parameters and not return values.
  • The idea is that in the future some of the constitutive models and data can be shared among different processes.
  • There are (hopefully) no hidden dependencies between individual constitutive models. All data is passed via arguments to the eval() methods. That makes it easier to replace or regroup some of the constitutive models, because all model dependencies are explicitly declared.

ProcessLib/ThermoRichardsMechanics/ConstitutiveSetting.h

  • Has reduced in size a lot. It's probably best to not look at the diff, but to look at the new state of this file.
  • The data computed by the constitutive setting is grouped by storage duration/purpose/statefulness. The groups are: StatefulData, OutputData, ConstitutiveData used during assembly, and ConstitutiveTempData for intermediate values.

ProcessLib/ThermoRichardsMechanics/ConstitutiveSetting.cpp

  • Almost all logic has been moved to the files in the Constitutive directory.
  • The eval() method now has a very simple structure, consisting essentially of a sequence of model calls, e.g.:
models.S_L_model.eval(x_t, media_data, p_cap_data, S_L_data, dS_L_data);

ProcessLib/ThermoRichardsMechanics/ThermoRichardsMechanicsFEM*.h

  • Most changes in these two files account for changes in the constitutive setting: Changed storage locations for initialization, I/O and assembly.

Caveats

By splitting the constitutive models I restricted the amount of data available to MPL material models. E.g., the saturation now depends at most on the capillary pressure:

template <int DisplacementDim>
struct SaturationModel
{
    void eval(SpaceTimeData const& x_t, MediaData const& media_data,
              CapillaryPressureData<DisplacementDim> const& p_cap_data,
              SaturationData& S_L_data, SaturationDataDeriv& dS_L_data);
};

Before, maybe more data was passed to the underlying MPL model, via a VariableArray used throughout the entire constitutive setting.

Summary: This MR might break some existing use cases, although all ctests succeed.

Edited by Christoph Lehmann

Merge request reports