OGS
MaterialPropertyLib::Medium Class Referencefinal

Detailed Description

This class is for material objects on the Medium scale.

A Medium consists of an arbitrarily long vector of phases and an array of properties.

Definition at line 23 of file Medium.h.

#include <Medium.h>

Public Member Functions

 Medium (int const material_id, std::vector< std::unique_ptr< Phase > > &&phases, std::unique_ptr< PropertyArray > &&properties)
Phase const & phase (std::size_t index) const
Phase const & phase (std::string const &phase_name) const
 A get-function for a particular phase by phase name.
bool hasPhase (std::string const &phase_name) const
 A query for a named phase.
Property const & property (PropertyType const &p) const
Property const & operator[] (PropertyType const &p) const
bool hasProperty (PropertyType const &p) const
std::size_t numberOfPhases () const
std::string description () const
 Short description of the medium.
template<typename T>
value (PropertyType const p) const
template<typename T>
value (PropertyType const p, VariableArray const &variable_array) const
template<typename T>
dValue (PropertyType const p, VariableArray const &variable_array, Variable const variable) const
template<typename T>
d2Value (PropertyType const p, VariableArray const &variable_array, Variable const variable1, Variable const variable2) const

Private Attributes

std::vector< std::unique_ptr< Phase > > const phases_
 The vector that holds the phases.
PropertyArray properties_
int const material_id_

Constructor & Destructor Documentation

◆ Medium()

MaterialPropertyLib::Medium::Medium ( int const material_id,
std::vector< std::unique_ptr< Phase > > && phases,
std::unique_ptr< PropertyArray > && properties )

Definition at line 12 of file Medium.cpp.

15 : phases_(std::move(phases)), material_id_(material_id)
16{
17 if (properties)
18 {
19 overwriteExistingProperties(properties_, *properties, this);
20 }
22}
std::vector< std::unique_ptr< Phase > > const phases_
The vector that holds the phases.
Definition Medium.h:86
PropertyArray properties_
Definition Medium.h:93
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component * > scale_pointer)
void updatePropertiesForAllPhases(PropertyArray &properties, std::vector< std::unique_ptr< Phase > > const &phases)

References material_id_, MaterialPropertyLib::overwriteExistingProperties(), phases_, properties_, and MaterialPropertyLib::updatePropertiesForAllPhases().

Member Function Documentation

◆ d2Value()

template<typename T>
T MaterialPropertyLib::Medium::d2Value ( PropertyType const p,
VariableArray const & variable_array,
Variable const variable1,
Variable const variable2 ) const
inline

Definition at line 75 of file Medium.h.

79 {
80 return property(p).template d2Value<T>(variable_array, variable1,
81 variable2);
82 }
T d2Value(PropertyType const p, VariableArray const &variable_array, Variable const variable1, Variable const variable2) const
Definition Medium.h:75
Property const & property(PropertyType const &p) const
Definition Medium.cpp:45

References d2Value(), and property().

Referenced by d2Value().

◆ description()

std::string MaterialPropertyLib::Medium::description ( ) const

Short description of the medium.

Definition at line 71 of file Medium.cpp.

72{
73 return "medium " + std::to_string(material_id_);
74}

References material_id_.

Referenced by property().

◆ dValue()

template<typename T>
T MaterialPropertyLib::Medium::dValue ( PropertyType const p,
VariableArray const & variable_array,
Variable const variable ) const
inline

Definition at line 67 of file Medium.h.

70 {
71 return property(p).template dValue<T>(variable_array, variable);
72 }
T dValue(PropertyType const p, VariableArray const &variable_array, Variable const variable) const
Definition Medium.h:67

References dValue(), and property().

Referenced by dValue().

◆ hasPhase()

bool MaterialPropertyLib::Medium::hasPhase ( std::string const & phase_name) const

A query for a named phase.

Definition at line 38 of file Medium.cpp.

39{
40 return std::any_of(begin(phases_), end(phases_),
41 [&phase_name](auto const& phase)
42 { return phase->name == phase_name; });
43}
Phase const & phase(std::size_t index) const
Definition Medium.cpp:24

References phase(), and phases_.

Referenced by MaterialPropertyLib::fluidPhase().

◆ hasProperty()

◆ numberOfPhases()

std::size_t MaterialPropertyLib::Medium::numberOfPhases ( ) const

A simple get-function for retrieving the number of phases the medium consists of.

Definition at line 66 of file Medium.cpp.

67{
68 return phases_.size();
69}

References phases_.

◆ operator[]()

Property const & MaterialPropertyLib::Medium::operator[] ( PropertyType const & p) const

Definition at line 56 of file Medium.cpp.

57{
58 return property(p);
59}

References property().

◆ phase() [1/2]

◆ phase() [2/2]

Phase const & MaterialPropertyLib::Medium::phase ( std::string const & phase_name) const

A get-function for a particular phase by phase name.

Definition at line 29 of file Medium.cpp.

30{
32 phases_,
33 [&phase_name](std::unique_ptr<MaterialPropertyLib::Phase> const& phase)
34 { return phase->name == phase_name; },
35 [&]() { OGS_FATAL("Could not find phase named '{:s}.'", phase_name); });
36}
#define OGS_FATAL(...)
Definition Error.h:19
ranges::range_reference_t< Range > findElementOrError(Range &range, std::predicate< ranges::range_reference_t< Range > > auto &&predicate, std::invocable auto error_callback)
Definition Algorithm.h:74

References BaseLib::findElementOrError(), OGS_FATAL, phase(), and phases_.

◆ property()

Property const & MaterialPropertyLib::Medium::property ( PropertyType const & p) const

A get-function for a property. The argument refers to the name of the property.

Definition at line 45 of file Medium.cpp.

46{
47 Property const* const property = properties_[p].get();
48 if (property == nullptr)
49 {
50 OGS_FATAL("Trying to access undefined property '{:s}' of {:s}",
52 }
53 return *properties_[p];
54}
std::string description() const
Short description of the medium.
Definition Medium.cpp:71
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string

References description(), OGS_FATAL, properties_, property(), and MaterialPropertyLib::property_enum_to_string.

Referenced by ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobianEvalConstitutiveSetting(), ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, DisplacementDim, ConstitutiveTraits >::convertInitialStressType(), d2Value(), dValue(), ProcessLib::ThermoRichardsMechanics::BiotModel::eval(), ProcessLib::ThermoRichardsMechanics::PorosityModel< DisplacementDim >::eval(), ProcessLib::ThermoRichardsMechanics::TRMHeatStorageAndFluxModel< DisplacementDim >::eval(), operator[](), property(), ProcessLib::RichardsMechanics::updateSwellingStressAndVolumetricStrain(), value(), and value().

◆ value() [1/2]

template<typename T>
T MaterialPropertyLib::Medium::value ( PropertyType const p) const
inline

Definition at line 55 of file Medium.h.

56 {
57 return property(p).template value<T>();
58 }
T value(PropertyType const p) const
Definition Medium.h:55

References property(), and value().

Referenced by value(), and value().

◆ value() [2/2]

template<typename T>
T MaterialPropertyLib::Medium::value ( PropertyType const p,
VariableArray const & variable_array ) const
inline

Definition at line 61 of file Medium.h.

62 {
63 return property(p).template value<T>(variable_array);
64 }

References property(), and value().

Member Data Documentation

◆ material_id_

int const MaterialPropertyLib::Medium::material_id_
private

The first material id for which the medium was created. Used in the description.

Definition at line 97 of file Medium.h.

Referenced by Medium(), and description().

◆ phases_

std::vector<std::unique_ptr<Phase> > const MaterialPropertyLib::Medium::phases_
private

The vector that holds the phases.

Definition at line 86 of file Medium.h.

Referenced by Medium(), hasPhase(), numberOfPhases(), phase(), and phase().

◆ properties_

PropertyArray MaterialPropertyLib::Medium::properties_
private

The array that holds the medium properties.

Currently, these defaults is the volume fraction average.

Most properties are fine with the volume fraction average, but special-defaults are allowed as well...

Definition at line 93 of file Medium.h.

Referenced by Medium(), hasProperty(), and property().


The documentation for this class was generated from the following files: