OGS
CheckThermoOsmosisProperties.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2
// SPDX-License-Identifier: BSD-3-Clause
3
4
#pragma once
5
6
#include <map>
7
#include <memory>
8
9
#include "
BaseLib/Error.h
"
10
#include "
MaterialLib/MPL/Medium.h
"
11
#include "
MaterialLib/MPL/Phase.h
"
12
#include "
MaterialLib/MPL/PropertyType.h
"
13
14
namespace
ProcessLib
15
{
24
inline
void
checkThermoOsmosisProperties
(
25
MaterialPropertyLib::Medium
const
& medium)
26
{
27
auto
const
solid_phase =
28
getOptionalPhase(medium,
MaterialPropertyLib::PhaseName::Solid
);
29
if
(solid_phase)
30
{
31
// thermal_osmosis_coefficient used to live on the solid phase;
32
// thermal_osmosis_permeability never did, but a project file
33
// hand-migrated from the former can put it there just as easily.
34
for
(
auto
const
property_type :
35
{
MaterialPropertyLib::PropertyType::thermal_osmosis_coefficient
,
36
MaterialPropertyLib::PropertyType::thermal_osmosis_permeability
})
37
{
38
if
(solid_phase->hasProperty(property_type))
39
{
40
OGS_FATAL
(
41
"{:s} is defined on the solid phase of {:s}, but is read "
42
"from the medium. Move the property from the solid phase "
43
"to the medium, or use "
44
"scripts/dev/move_thermal_osmosis.py to migrate the "
45
"project file."
,
46
MaterialPropertyLib::property_enum_to_string
[property_type],
47
medium.
description
());
48
}
49
}
50
}
51
52
if
(medium.
hasProperty
(
53
MaterialPropertyLib::PropertyType::thermal_osmosis_permeability
) &&
54
medium.
hasProperty
(
55
MaterialPropertyLib::PropertyType::thermal_osmosis_coefficient
))
56
{
57
OGS_FATAL
(
58
"Thermo-osmosis permeability and coefficient cannot be defined at "
59
"the same time in {:s}."
,
60
medium.
description
());
61
}
62
}
63
66
inline
void
checkThermoOsmosisProperties
(
67
std::map<
int
, std::shared_ptr<MaterialPropertyLib::Medium>>
const
& media)
68
{
69
for
(
auto
const
& m : media)
70
{
71
checkThermoOsmosisProperties
(*m.second);
72
}
73
}
74
}
// namespace ProcessLib
Error.h
OGS_FATAL
#define OGS_FATAL(...)
Definition
Error.h:10
Medium.h
Phase.h
PropertyType.h
MaterialPropertyLib::Medium
Definition
Medium.h:24
MaterialPropertyLib::Medium::hasProperty
bool hasProperty(PropertyType const &p) const
Definition
Medium.cpp:65
MaterialPropertyLib::Medium::description
std::string description() const
Short description of the medium.
Definition
Medium.cpp:75
MaterialPropertyLib::PhaseName::Solid
@ Solid
Definition
Phase.h:20
MaterialPropertyLib::property_enum_to_string
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string
Definition
PropertyType.h:120
MaterialPropertyLib::thermal_osmosis_coefficient
@ thermal_osmosis_coefficient
Definition
PropertyType.h:100
MaterialPropertyLib::thermal_osmosis_permeability
@ thermal_osmosis_permeability
Definition
PropertyType.h:106
ProcessLib
Definition
ProjectData.h:36
ProcessLib::checkThermoOsmosisProperties
void checkThermoOsmosisProperties(MaterialPropertyLib::Medium const &medium)
Definition
CheckThermoOsmosisProperties.h:24
ProcessLib
Common
ThermoOsmosis
CheckThermoOsmosisProperties.h
Generated by
1.14.0