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 31 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 21 of file Medium.cpp.

24 : phases_(std::move(phases)), material_id_(material_id)
25{
26 if (properties)
27 {
28 overwriteExistingProperties(properties_, *properties, this);
29 }
31}
std::vector< std::unique_ptr< Phase > > const phases_
The vector that holds the phases.
Definition Medium.h:94
PropertyArray properties_
Definition Medium.h:101
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component * > scale_pointer)
Definition Property.h:322
void updatePropertiesForAllPhases(PropertyArray &properties, std::vector< std::unique_ptr< Phase > > const &phases)
Definition Property.h:338

References 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 83 of file Medium.h.

87 {
88 return property(p).template d2Value<T>(variable_array, variable1,
89 variable2);
90 }
T d2Value(PropertyType const p, VariableArray const &variable_array, Variable const variable1, Variable const variable2) const
Definition Medium.h:83
Property const & property(PropertyType const &p) const
Definition Medium.cpp:54

References d2Value(), and property().

Referenced by d2Value().

◆ description()

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

Short description of the medium.

Definition at line 80 of file Medium.cpp.

81{
82 return "medium " + std::to_string(material_id_);
83}

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 75 of file Medium.h.

78 {
79 return property(p).template dValue<T>(variable_array, variable);
80 }
T dValue(PropertyType const p, VariableArray const &variable_array, Variable const variable) const
Definition Medium.h:75

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 47 of file Medium.cpp.

48{
49 return std::any_of(begin(phases_), end(phases_),
50 [&phase_name](auto const& phase)
51 { return phase->name == phase_name; });
52}
Phase const & phase(std::size_t index) const
Definition Medium.cpp:33
std::string const name
Definition Phase.h:62

References MaterialPropertyLib::Phase::name, 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 75 of file Medium.cpp.

76{
77 return phases_.size();
78}

References phases_.

◆ operator[]()

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

Definition at line 65 of file Medium.cpp.

66{
67 return property(p);
68}

References property().

◆ phase() [1/2]

Phase const & MaterialPropertyLib::Medium::phase ( std::size_t index) const

A get-function for a particular phase. The ul argument specifies the index within the phases_ vector.

Definition at line 33 of file Medium.cpp.

34{
35 return *phases_[index];
36}

References phases_.

Referenced by ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::WellboreSimulatorFEM(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, GlobalDim >::assemble(), ProcessLib::StokesFlow::LocalAssemblerData< ShapeFunctionLiquidVelocity, ShapeFunctionPressure, GlobalDim >::assemble(), ProcessLib::WellboreCompensateNeumannBoundaryConditionLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleBlockMatrices(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleComponentTransportEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleHeatTransportEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleHydraulicEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleKCmCn(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianComponentTransportEquation(), ProcessLib::RichardsMechanics::RichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunctionPressure, DisplacementDim >::assembleWithJacobianEvalConstitutiveSetting(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::assembleWithJacobianHydraulicEquation(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::calculateIntPtDarcyVelocity(), ProcessLib::StokesFlow::anonymous_namespace{CreateStokesFlowProcess.cpp}::checkMPLProperties(), MaterialPropertyLib::fluidPhase(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getFlux(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getFlux(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getHeatEnergyCoefficient(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getHeatEnergyCoefficient(), ProcessLib::RichardsFlow::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtDarcyVelocity(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getIntPtDarcyVelocityLocal(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getIntPtMolarFlux(), hasPhase(), ChemistryLib::PhreeqcIOData::PhreeqcIO::initializeChemicalSystemConcrete(), phase(), ChemistryLib::PhreeqcIOData::PhreeqcIO::setChemicalSystemConcrete(), ChemistryLib::PhreeqcIOData::anonymous_namespace{PhreeqcIO.cpp}::setPorosityPostReaction(), and ChemistryLib::PhreeqcIOData::anonymous_namespace{PhreeqcIO.cpp}::updateReactantVolumeFraction().

◆ 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 38 of file Medium.cpp.

39{
41 phases_,
42 [&phase_name](std::unique_ptr<MaterialPropertyLib::Phase> const& phase)
43 { return phase->name == phase_name; },
44 [&]() { OGS_FATAL("Could not find phase named '{:s}.'", phase_name); });
45}
#define OGS_FATAL(...)
Definition Error.h:26
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:77

References BaseLib::findElementOrError(), MaterialPropertyLib::Phase::name, 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 54 of file Medium.cpp.

55{
56 Property const* const property = properties_[p].get();
57 if (property == nullptr)
58 {
59 OGS_FATAL("Trying to access undefined property '{:s}' of {:s}",
61 }
62 return *properties_[p];
63}
std::string description() const
Short description of the medium.
Definition Medium.cpp:80
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::TH2M::ConstitutiveRelations::BiotModel::eval(), ProcessLib::TH2M::ConstitutiveRelations::PhaseTransition::eval(), 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 63 of file Medium.h.

64 {
65 return property(p).template value<T>();
66 }
T value(PropertyType const p) const
Definition Medium.h:63

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 69 of file Medium.h.

70 {
71 return property(p).template value<T>(variable_array);
72 }

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 105 of file Medium.h.

Referenced by description().

◆ phases_

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

The vector that holds the phases.

Definition at line 94 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 101 of file Medium.h.

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


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