MarmotGradientMechanicsCore
-
struct increment
-
Struct to hold the increment information.
-
template<int nNonlocalVariables>
class MarmotMaterialGeneralGradientEnhancedHypoElastic -
Base class for general gradient-enhanced hypoelastic material models.
This class defines the interface for general gradient-enhanced hypoelastic material models, including methods for computing stress, plane stress response, and managing state variables. The template parameter
nNonlocalVariablesspecifies the number of nonlocal variables used in the material model.In addition to the standard balance of linear momentum each nonlocal variable introduces an additional balance equation, which is solved simultaneously with the balance of linear momentum. This balance equation is defined as:
\[ \knl_i - \nabla ( c( \knl_i )\, \nabla \knl_i ) = s_i (\boldsymbol \varepsilon,\, \knl_i ) \]where \( \knl_i \) is the nonlocal variable, \( c( \knl_i ) \) is the nonlocal interaction parameter, and \( s_i \) is the local driving variable for the nonlocal variable \( \knl_i \). The interaction parameter \( c( \knl_i ) \) defines the influence of the nonlocal variable on its own gradient and can be used to model phenomena such as damage-dependent interactions. Also phase-field models can be implemented in this framework by defining the nonlocal variable as the phase-field variable and the local driving variable as a function of the strain tensor.Public Functions
-
inline MarmotMaterialGeneralGradientEnhancedHypoElastic(const double *matProperties_, int nMaterialProperties_, int materialNumber_)
Constructor for the general gradient-enhanced hypoelastic material model.
- Parameters:
matProperties_ – Pointer to the array of material properties.
nMaterialProperties_ – Number of material properties.
materialNumber_ – Material number (identifier for the material).
-
virtual void computeStress(response &res, tangents &tan, const increment &inc) const = 0
Compute the stress response of the material model including the algorithmic tangents.
This method must be implemented in derived classes to compute the stress response based on the specific material model.
- Parameters:
res – [inout] Reference to the response struct to be filled with the computed stress and other response variables.
tan – [inout] Reference to the tangents struct to be filled with the computed algorithmic tangent matrices.
inc – [in] Reference to the increment struct containing the strain increment, nonlocal variable increments, and time information.
-
inline virtual void computeStressExplicit(response &res, const increment &inc) const
Compute the stress response of the material model.
This method can be used when only the stress response is needed without the tangents, e.g., for explicit dynamics. The default implementation calls the
computeStressmethod and ignores the tangents, which can be computationally expensive to compute.- Parameters:
res – [inout] Reference to the response struct to be filled with the computed stress and other response variables.
inc – [in] Reference to the increment struct containing the strain increment, nonlocal variable increments, and time information.
-
inline virtual void computePlaneStress(response &res, tangents &tan, const increment &inc) const
Compute the plane stress response of the material model.
This method provides a default implementation for computing the plane stress response using an iterative approach. It assumes an initial guess of isochoric deformation and iteratively corrects the out-of-plane strain until convergence is achieved. Derived classes can override this method if a different approach for plane stress computation is desired.
- Parameters:
res – [inout] Reference to the response struct to be filled with the computed plane stress and other response variables.
tan – [inout] Reference to the tangents struct to be filled with the computed algorithmic tangent matrices for plane stress.
inc – [in] Reference to the increment struct containing the strain increment, nonlocal variable increments, and time information.
-
inline virtual void computePlaneStressExplicit(response &res, const increment &inc) const
Compute the plane stress response of the material model without computing tangents.
This method can be used when only the plane stress response is needed without the tangents, e.g., for explicit dynamics. The default implementation calls the
computePlaneStressmethod ignoring the tangents. This method maybe overridden in derived classes if a different approach for plane stress computation is desired.- Parameters:
res – [inout] Reference to the response struct to be filled with the computed plane stress and other response variables.
inc – [in] Reference to the increment struct containing the strain increment, nonlocal variable increments, and time information.
-
inline StateView getStateView(const std::string &stateName, double *stateVars) const
Get a view to the state variables.
- Parameters:
stateName – Name of the state variable
stateVars – Pointer to the state variable array
- Returns:
StatView to access the state variable
-
inline int getNumberOfRequiredStateVars() const
Get the total number of required state variables.
- Returns:
Total number of required state variables
-
inline virtual void initializeYourself(double *stateVars, int nStateVars)
Initialize the state variables at a material point.
Note
The default implementation initializes all state variables to zero.
- Parameters:
stateVars – Pointer to the state variable array
nStateVars – Number of state variables
-
virtual double getDensity(const double *stateVars) const = 0
Get the density of the material.
This method must be implemented in derived classes to return the density of the material, which is required for dynamic analyses.
- Parameters:
stateVars – Pointer to the array of state variables
- Returns:
Density of the material
-
inline virtual double getMaximumWaveSpeed(const response ¤tResponse) const
Get the maximum wave speed for the current response state.
The default implementation computes the 3D algorithmic tangent and returns
sqrt(max(C_ii) / rho)withC_iifrom the Voigt tangent diagonal entries.- Parameters:
currentResponse – Current response state
- Returns:
Maximum wave speed
-
virtual std::vector<double> getNonlocalViscosity(const double *stateVars) const = 0
Get the nonlocal viscosity of the material.
This method must be implemented in derived classes to return the nonlocal viscosity values, which are required for dynamic analyses involving nonlocal variables. The returned vector should have a length equal to
nNonlocalVariables.- Parameters:
stateVars – Pointer to the array of state variables
- Returns:
Vector containing the nonlocal viscosity values for each nonlocal variable
Public Members
-
const int materialNumber
Material number (identifier for the material).
-
MarmotStateLayoutDynamic stateLayout
Layout of the state variables for the material model.
Note
Must be defined in derived classes to specify the structure and organization of the state variables used in the material model.
-
inline MarmotMaterialGeneralGradientEnhancedHypoElastic(const double *matProperties_, int nMaterialProperties_, int materialNumber_)
-
template<int nNonlocalVariables>
class MarmotMaterialGeneralGradientEnhancedHypoElasticFactory -
Factory class for creating MarmotMaterialGeneralGradientEnhancedHypoElastic instances. This class uses the Factory Design Pattern to manage the creation of different MarmotMaterialGeneralGradientEnhancedHypoElastic materials based on unique material names.
Public Types
-
using materialFactoryFunction = std::function<MarmotMaterialGeneralGradientEnhancedHypoElastic<nNonlocalVariables>*(const double *materialProperties, int nMaterialProperties, int materialNumber)>
Type alias for the material factory function, which creates instances of MarmotMaterialGeneralGradientEnhancedHypoElastic.
-
using MaterialFactoryMap = std::unordered_map<std::string, materialFactoryFunction>
Type alias for the map of material factory functions by material name.
Public Functions
-
MarmotMaterialGeneralGradientEnhancedHypoElasticFactory() = delete
Public Static Functions
-
static MarmotMaterialGeneralGradientEnhancedHypoElastic<nNonlocalVariables> *createMaterial(const std::string &materialName, const double *materialProperties, int nMaterialProperties, int materialNumber)
Create a material instance based on its unique name and properties.
- Parameters:
materialName – [in] Unique name of the material to create.
materialProperties – [in] Array of material properties.
nMaterialProperties – [in] Number of properties in the array.
materialNumber – [in] Unique identifier for the material instance.
- Returns:
Pointer to the created MarmotMaterial instance, or nullptr if creation failed.
-
template<class T>
static inline bool registerMaterial(const std::string &materialName) Register a material with its code and factory function.
- Parameters:
materialName – [in] Name of the material.
- Returns:
True if registration was successful, false if the code already exists.
-
static MaterialFactoryMap &materialFactoryFunctionByName()
Get the map of material factory functions by material name.
-
using materialFactoryFunction = std::function<MarmotMaterialGeneralGradientEnhancedHypoElastic<nNonlocalVariables>*(const double *materialProperties, int nMaterialProperties, int materialNumber)>
-
struct response
-
Struct to hold the material response information.
-
struct tangents
-
Struct to hold the algorithmic tangent matrices for the material model.
Public Members
-
Marmot::Matrix6d dStressddStrain = Marmot::Matrix6d::Zero()
Algorithmic tangent matrix relating the increment of stress to the increment of strain.
-
Eigen::Matrix<double, 6, nNonlocalVariables> dStressddK = Eigen::Matrix<double, 6, nNonlocalVariables>::Zero()
Algorithmic tangent matrix relating the increment of stress to the increment of nonlocal variables.
-
Eigen::Matrix<double, nNonlocalVariables, 6> dKLocalddStrain = Eigen::Matrix<double, nNonlocalVariables, 6>::Zero()
Algorithmic tangent matrix relating the increment of local driving variables to the increment of strain.
-
Eigen::Matrix<double, nNonlocalVariables, nNonlocalVariables> dKLocalddK = Eigen::Matrix<double, nNonlocalVariables, nNonlocalVariables>::Zero()
Algorithmic tangent matrix relating the increment of local driving variables to the increment of nonlocal variables.
-
Marmot::Matrix6d dStressddStrain = Marmot::Matrix6d::Zero()
-
namespace Marmot
-
namespace GradientDamage
-
namespace DecreasingInteractions
Functions
-
template<typename T>
T poh(T omega, double eta, double R) Damage dependent nonlocal interaction function acc. Poh & Sun (2017)
The function is defined as:
\[ g(\omega) = \frac{(1 - R) \exp(-\eta \, \omega) + R - \exp(-\eta) }{ 1 - \exp(-\eta)} \]where \( \omega \) is the damage variable, \( \eta \) controls the rate of decrease of interactions with damage, and \( R \) controls the residual interactions at full damage. The function is designed to decrease as damage increases, with a residual interaction value of \( R \) at full damage ( \( \omega = 1 \)).- Parameters:
omega – damage variable
eta – parameter controlling the rate of decrease of interactions with damage
R – parameter controlling the residual interactions at full damage
- Template Parameters:
T – type of the interaction function value (e.g., double, dual, etc.)
- Returns:
interaction function value
-
template<typename T>
-
namespace FirstOrderDerived
Functions
-
std::tuple<double, double> poh(double omega, double eta, double R)
First-order derivative of the Poh & Sun (2017) interaction function with respect to damage.
The first-order derivative variant of the interaction function
poh.- Parameters:
omega – damage variable
eta – parameter controlling the rate of decrease of interactions with damage
R – parameter controlling the residual interactions at full damage
- Returns:
a tuple containing the interaction function value and its first derivative with respect to damage
-
std::tuple<double, double> poh(double omega, double eta, double R)
-
namespace SecondOrderDerived
Functions
-
std::tuple<double, double, double> poh(double omega, double eta, double R)
Second-order derivative of the Poh & Sun (2017) interaction function with respect to damage.
The second-order derivative variant of the interaction function
poh.- Parameters:
omega – damage variable
eta – parameter controlling the rate of decrease of interactions with damage
R – parameter controlling the residual interactions at full damage
- Returns:
a tuple containing the interaction function value, its first derivative, and its second derivative with respect to damage
-
std::tuple<double, double, double> poh(double omega, double eta, double R)
-
namespace PhaseField
-
namespace EnergyDegradationFunctions
Functions
-
template<typename T>
T quadratic(const T pf) Quadratic degradation function.
This function is defined as
\[ g(\phi) = (1 - \phi)^2,\]where \(\phi\) is the phase field variable. It represents a quadratic degradation of the material stiffness as the phase field variable increases.- Parameters:
pf – Phase field variable.
- Template Parameters:
T – Numeric type (e.g., double, float).
- Returns:
Degradation function value.
-
template<typename T>
T cubic(const T pf) Cubic degradation function.
This function is defined as
\[ g(\phi) = 3(1 - \phi)^2 - 2(1 - \phi)^3,\]where \(\phi\) is the phase field variable. It represents a cubic degradation of the material stiffness as the phase field variable increases, providing a smoother transition compared to the quadratic function.- Parameters:
pf – Phase field variable.
- Template Parameters:
T – Numeric type (e.g., double, float).
- Returns:
Degradation function value.
-
template<typename T>
T quartic(const T pf) Quartic degradation function.
This function is defined as
\[ g(\phi) = 4(1 - \phi)^3 - 3(1 - \phi)^4,\]where \(\phi\) is the phase field variable. It represents a quartic degradation of the material stiffness as the phase field variable increases, providing an even smoother transition compared to the cubic function.- Parameters:
pf – Phase field variable.
- Template Parameters:
T – Numeric type (e.g., double, float).
- Returns:
Degradation function value.
-
template<typename T>
T generic(const T pf, const double p, const double a1, const double a2, const double a3) Generic degradation function acc. to Wu, JMPS (2017).
This function is defined as
\[ g(\phi) = \frac{(1 - \phi)^p}{(1 - \phi)^p + a_1 \phi (1 + a_2 \phi (1 + a_3 \phi))},\]where \(\phi\) is the phase field variable, and \(p\), \(a_1\), \(a_2\), and \(a_3\) are parameters that control the shape of the degradation function. This generic form allows for a wide range of degradation behaviors by adjusting the parameters accordingly.- Parameters:
pf – Phase field variable.
p – Exponent parameter controlling the shape of the degradation function.
a1 – Coefficient for the linear term in the denominator.
a2 – Coefficient for the quadratic term in the denominator.
a3 – Coefficient for the cubic term in the denominator.
- Template Parameters:
T – Numeric type (e.g., double, float).
- Returns:
Degradation function value.
-
template<typename T>
-
namespace SecondOrderDerived
Functions
-
std::tuple<double, double, double> quadratic(const double pf)
Quadratic degradation function and its first and second derivatives.
This function returns the value of the quadratic degradation function along with its first and second derivatives. The degradation function is defined as
\[ g(\phi) = (1 - \phi)^2,\]and its derivatives are given by\[ g'(\phi) = -2(1 - \phi), \quad g''(\phi) = 2. \]- Parameters:
pf – Phase field variable.
- Returns:
A tuple containing the degradation function value, its first derivative, and its second derivative with respect to the phase field variable.
-
std::tuple<double, double, double> cubic(const double pf)
Cubic degradation function and its first and second derivatives.
This function returns the value of the cubic degradation function along with its first and second derivatives. The degradation function is defined as
\[ g(\phi) = 3(1 - \phi)^2 - 2(1 - \phi)^3,\]and its derivatives are given by\[ g'(\phi) = -6(1 - \phi)\phi, \quad g''(\phi) = 12\phi - 6. \]- Parameters:
pf – Phase field variable.
- Returns:
A tuple containing the degradation function value, its first derivative, and its second derivative with respect to the phase field variable.
-
std::tuple<double, double, double> quartic(const double pf)
Quartic degradation function and its first and second derivatives.
This function returns the value of the quartic degradation function along with its first and second derivatives. The degradation function is defined as
\[ g(\phi) = 4(1 - \phi)^3 - 3(1 - \phi)^4,\]and its derivatives are given by\[ g'(\phi) = -12(1 - \phi)^2 + 12(1 - \phi)^3, \quad g''(\phi) = 24(1 - \phi) - 36(1 - \phi)^2. \]- Parameters:
pf – Phase field variable.
- Returns:
A tuple containing the degradation function value, its first derivative, and its second derivative with respect to the phase field variable.
-
std::tuple<double, double, double> generic(const double pf, const double p, const double a1, const double a2, const double a3)
Generic degradation function and its first and second derivatives.
This function returns the value of the generic degradation function along with its first and second derivatives. The degradation function is defined as
\[ g(\phi) = \frac{(1 - \phi)^p}{(1 - \phi)^p + a_1 \phi (1 + a_2 \phi (1 + a_3 \phi))},\]where \(\phi\) is the phase field variable, and \(p\), \(a_1\), \(a_2\), and \(a_3\) are parameters that control the shape of the degradation function. The first and second derivatives are computed using automatic differentiation with hyper-dual numbers.- Parameters:
pf – Phase field variable.
p – Exponent parameter controlling the shape of the degradation function.
a1 – Coefficient for the linear term in the denominator.
a2 – Coefficient for the quadratic term in the denominator.
a3 – Coefficient for the cubic term in the denominator.
- Returns:
A tuple containing the degradation function value, its first derivative, and its second derivative with respect to the phase field variable.
-
std::tuple<double, double, double> quadratic(const double pf)
-
namespace MarmotLibrary
- file MarmotDecreasingInteractions.h
- #include <cmath>#include <tuple>
Include dependency graph for MarmotDecreasingInteractions.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"1" [label="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotDecreasingInteractions.h" tooltip="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotDecreasingInteractions.h" fillcolor="#BFBFBF"]
"2" [label="cmath" tooltip="cmath"]
"3" [label="tuple" tooltip="tuple"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "3" [dir=forward tooltip="include"]
}](../../_images/graphviz-54d7bed947ba058e703ffcf00dcd9868c26d6f58.png)
- file MarmotMaterialGeneralGradientEnhancedHypoElastic.h
- #include “Marmot/MarmotExceptions.h”#include “Marmot/MarmotMath.h”#include “Marmot/MarmotStateHelpers.h”#include “Marmot/MarmotTypedefs.h”#include <algorithm>#include <cmath>#include <vector>
Include dependency graph for MarmotMaterialGeneralGradientEnhancedHypoElastic.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"1" [label="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotMaterialGeneralGradientEnhancedHypoElastic.h" tooltip="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotMaterialGeneralGradientEnhancedHypoElastic.h" fillcolor="#BFBFBF"]
"2" [label="Marmot/MarmotExceptions.h" tooltip="Marmot/MarmotExceptions.h"]
"3" [label="Marmot/MarmotMath.h" tooltip="Marmot/MarmotMath.h"]
"4" [label="Marmot/MarmotStateHelpers.h" tooltip="Marmot/MarmotStateHelpers.h"]
"5" [label="Marmot/MarmotTypedefs.h" tooltip="Marmot/MarmotTypedefs.h"]
"6" [label="algorithm" tooltip="algorithm"]
"7" [label="cmath" tooltip="cmath"]
"8" [label="vector" tooltip="vector"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "3" [dir=forward tooltip="include"]
"1" -> "4" [dir=forward tooltip="include"]
"1" -> "5" [dir=forward tooltip="include"]
"1" -> "6" [dir=forward tooltip="include"]
"1" -> "7" [dir=forward tooltip="include"]
"1" -> "8" [dir=forward tooltip="include"]
}](../../_images/graphviz-ded962c222867db8111c541b0b79621d9f70162d.png)
This graph shows which files directly or indirectly include MarmotMaterialGeneralGradientEnhancedHypoElastic.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"1" [label="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotMaterialGeneralGradientEnhancedHypoElastic.h" tooltip="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotMaterialGeneralGradientEnhancedHypoElastic.h" fillcolor="#BFBFBF"]
"2" [label="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotMaterialGeneralGradientEnhancedHypoElasticFactory.h" tooltip="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotMaterialGeneralGradientEnhancedHypoElasticFactory.h"]
"1" -> "2" [dir=back tooltip="include"]
}](../../_images/graphviz-9ecf6ecd7730250ec2930e30b43083389a7628e0.png)
- file MarmotMaterialGeneralGradientEnhancedHypoElasticFactory.h
-
#include <cassert>#include <functional>#include <string>#include <unordered_map>
Include dependency graph for MarmotMaterialGeneralGradientEnhancedHypoElasticFactory.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"2" [label="Marmot/MarmotMaterialGeneralGradientEnhancedHypoElastic.h" tooltip="Marmot/MarmotMaterialGeneralGradientEnhancedHypoElastic.h"]
"1" [label="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotMaterialGeneralGradientEnhancedHypoElasticFactory.h" tooltip="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotMaterialGeneralGradientEnhancedHypoElasticFactory.h" fillcolor="#BFBFBF"]
"3" [label="Marmot/MarmotExceptions.h" tooltip="Marmot/MarmotExceptions.h"]
"4" [label="Marmot/MarmotMath.h" tooltip="Marmot/MarmotMath.h"]
"5" [label="Marmot/MarmotStateHelpers.h" tooltip="Marmot/MarmotStateHelpers.h"]
"6" [label="Marmot/MarmotTypedefs.h" tooltip="Marmot/MarmotTypedefs.h"]
"7" [label="algorithm" tooltip="algorithm"]
"10" [label="cassert" tooltip="cassert"]
"8" [label="cmath" tooltip="cmath"]
"11" [label="functional" tooltip="functional"]
"12" [label="string" tooltip="string"]
"13" [label="unordered_map" tooltip="unordered_map"]
"9" [label="vector" tooltip="vector"]
"2" -> "3" [dir=forward tooltip="include"]
"2" -> "4" [dir=forward tooltip="include"]
"2" -> "5" [dir=forward tooltip="include"]
"2" -> "6" [dir=forward tooltip="include"]
"2" -> "7" [dir=forward tooltip="include"]
"2" -> "8" [dir=forward tooltip="include"]
"2" -> "9" [dir=forward tooltip="include"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "10" [dir=forward tooltip="include"]
"1" -> "11" [dir=forward tooltip="include"]
"1" -> "12" [dir=forward tooltip="include"]
"1" -> "13" [dir=forward tooltip="include"]
}](../../_images/graphviz-a9c9e67dce434e167b908d839ab759b4f2002594.png)
- file MarmotPhaseFieldEnergyDegradation.h
- #include <cmath>#include <tuple>
Include dependency graph for MarmotPhaseFieldEnergyDegradation.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"1" [label="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotPhaseFieldEnergyDegradation.h" tooltip="/home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot/MarmotPhaseFieldEnergyDegradation.h" fillcolor="#BFBFBF"]
"2" [label="cmath" tooltip="cmath"]
"3" [label="tuple" tooltip="tuple"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "3" [dir=forward tooltip="include"]
}](../../_images/graphviz-7ecee7c92531ee2e81fd265f03548f36117a6d15.png)
- dir /home/runner/work/Marmot/Marmot/modules/core
- dir /home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include
- dir /home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore/include/Marmot
- dir /home/runner/work/Marmot/Marmot/modules/core/MarmotGradientMechanicsCore
- dir /home/runner/work/Marmot/Marmot/modules