Skip to content
Snippets Groups Projects
Unverified Commit f9530c21 authored by Tom Fischer's avatar Tom Fischer Committed by GitHub
Browse files

Merge pull request #2727 from TomFischer/HT-AddChecksForMPL

[HT] Test if all the needed material properties read from project file.
parents de519445 ba080fad
No related branches found
No related tags found
No related merge requests found
......@@ -19,3 +19,4 @@ CMakeLists.txt.user*
*.pyc
Tests/**/*.md5
Tests/Data/Parabolic/HT/InvalidProjectFiles/*.prj
......@@ -43,3 +43,6 @@
[submodule "ThirdParty/container-maker"]
path = ThirdParty/container-maker
url = https://github.com/ufz/ogs-container-maker.git
[submodule "ThirdParty/ogs6py"]
path = ThirdParty/ogs6py
url = https://github.com/joergbuchwald/ogs6py.git
......@@ -116,7 +116,6 @@ private:
void parseChemicalSystem(boost::optional<BaseLib::ConfigTree> const& config,
const std::string& output_directory);
std::unique_ptr<MaterialPropertyLib::Medium> _medium;
std::vector<std::unique_ptr<MeshLib::Mesh>> _mesh_vec;
std::vector<std::unique_ptr<ProcessLib::Process>> _processes;
std::vector<ProcessLib::ProcessVariable> _process_variables;
......
......@@ -47,6 +47,11 @@ Property const& Medium::property(PropertyType const& p) const
return *_properties[p];
}
bool Medium::hasProperty(PropertyType const& p) const
{
return _properties[p] != nullptr;
}
std::size_t Medium::numberOfPhases() const
{
return _phases.size();
......
......@@ -41,6 +41,7 @@ public:
/// A get-function for a property. The argument refers to the name of the
/// property.
Property const& property(PropertyType const& p) const;
bool hasProperty(PropertyType const& p) const;
/// A simple get-function for retrieving the number of phases the medium
/// consists of.
......
......@@ -51,6 +51,11 @@ Property const& Phase::property(PropertyType const& p) const
return *_properties[p];
}
bool Phase::hasProperty(PropertyType const& p) const
{
return _properties[p] != nullptr;
}
std::size_t Phase::numberOfComponents() const
{
return _components.size();
......
......@@ -45,6 +45,7 @@ public:
/// A get-function for a property. The argument refers to the name of the
/// property.
Property const& property(PropertyType const& p) const;
bool hasProperty(PropertyType const& p) const;
/// A get-function for retrieving the number of components in this phase.
std::size_t numberOfComponents() const;
......
......@@ -110,7 +110,6 @@ public:
fe.computeShapeFunctions(pnt_local_coords.getCoords(), shape_matrices,
GlobalDim, false);
// fetch permeability, viscosity, density
ParameterLib::SpatialPosition pos;
pos.setElementID(this->_element.getID());
......@@ -131,6 +130,7 @@ public:
*_process_data.media_map->getMedium(_element.getID());
auto const& liquid_phase = medium.phase("AqueousLiquid");
// fetch permeability, viscosity, density
auto const K = MaterialPropertyLib::formEigenTensor<GlobalDim>(
medium.property(MaterialPropertyLib::PropertyType::permeability)
.value(vars, pos, t));
......
......@@ -53,6 +53,8 @@ void HTProcess::initializeConcreteProcess(
MeshLib::Mesh const& mesh,
unsigned const integration_order)
{
checkMPLProperties(mesh, _process_data);
// For the staggered scheme, both processes are assumed to use the same
// element order. Therefore the order of shape function can be fetched from
// any set of the sets of process variables of the coupled processes. Here,
......@@ -285,5 +287,73 @@ void HTProcess::postTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
_surfaceflux->save(t);
}
void checkMPLProperties(MeshLib::Mesh const& mesh,
HTProcessData const& process_data)
{
DBUG("Check the media properties of HT process ...");
for (auto const& element : mesh.getElements())
{
auto const element_id = element->getID();
// check if a definition of the porous media exists
auto const& medium = *process_data.media_map->getMedium(element_id);
// checking general medium properties
if (!medium.hasProperty(MaterialPropertyLib::PropertyType::porosity))
{
OGS_FATAL("The porosity for the porous media isn't specified.");
}
if (!medium.hasProperty(
MaterialPropertyLib::PropertyType::permeability))
{
OGS_FATAL("The permeability for the porous media isn't specified.");
}
// check if liquid phase definition and the corresponding properties
// exists
auto const& liquid_phase = medium.phase("AqueousLiquid");
if (!liquid_phase.hasProperty(
MaterialPropertyLib::PropertyType::viscosity))
{
OGS_FATAL(
"The viscosity for the AqueousLiquid phase isn't specified.");
}
if (!liquid_phase.hasProperty(
MaterialPropertyLib::PropertyType::density))
{
OGS_FATAL(
"The density for the AqueousLiquid phase isn't specified.");
}
if (!liquid_phase.hasProperty(
MaterialPropertyLib::PropertyType::specific_heat_capacity))
{
OGS_FATAL(
"The specific heat capacity for the AqueousLiquid phase "
"isn't specified.");
}
// check if solid phase definition and the corresponding properties
// exists
auto const& solid_phase = medium.phase("Solid");
if (!solid_phase.hasProperty(
MaterialPropertyLib::PropertyType::specific_heat_capacity))
{
OGS_FATAL(
"The specific heat capacity for the Solid phase isn't "
"specified.");
}
if (!solid_phase.hasProperty(
MaterialPropertyLib::PropertyType::density))
{
OGS_FATAL("The density for the Solid phase isn't specified.");
}
if (!solid_phase.hasProperty(
MaterialPropertyLib::PropertyType::storage))
{
OGS_FATAL("The storage for the Solid phase isn't specified.");
}
}
DBUG("Media properties verified.");
}
} // namespace HT
} // namespace ProcessLib
......@@ -13,6 +13,8 @@
#include <array>
#include "HTProcessData.h"
#include "MaterialLib/MPL/Medium.h"
#include "MaterialLib/MPL/Utils/FormEigenTensor.h"
#include "ProcessLib/Process.h"
namespace NumLib
......@@ -86,6 +88,7 @@ public:
int const process_id) override;
private:
void initializeConcreteProcess(
NumLib::LocalToGlobalIndexMap const& dof_table,
MeshLib::Mesh const& mesh,
......@@ -132,5 +135,8 @@ private:
const int _hydraulic_process_id;
};
void checkMPLProperties(MeshLib::Mesh const& mesh,
HTProcessData const& process_data);
} // namespace HT
} // namespace ProcessLib
......@@ -448,3 +448,24 @@ AddTest(
ThermalConvection_pcs_0_ts_1_t_0.000000_expected.vtu ThermalConvection_pcs_0_ts_1_t_0.000000.vtu darcy_velocity darcy_velocity 1e-8 1e-13
VIS ThermalConvection_pcs_0_ts_1_t_0.000000.vtu
)
if(NOT OGS_USE_MPI AND BUILD_TESTING AND Python_FOUND)
add_custom_target(generate_invalid_project_files_ht
${Python_EXECUTABLE}
${PROJECT_SOURCE_DIR}/ThirdParty/ogs6py/generateInvalidMediaForHT.py
generateInvalidMediaForHT.py
WORKING_DIRECTORY ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/)
file(GLOB HT_INVALID_PRJ_FILES ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/*.prj)
foreach(ht_invalid_prj_file ${HT_INVALID_PRJ_FILES})
string(REPLACE ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/HT "invalid" ht_invalid_prj_file_short ${ht_invalid_prj_file})
AddTest(
NAME HT_${ht_invalid_prj_file_short}
PATH Parabolic/HT/InvalidProjectFiles
EXECUTABLE ogs
EXECUTABLE_ARGS ${ht_invalid_prj_file}
RUNTIME 1
DEPENDS generate_invalid_project_files_ht
)
set_tests_properties(ogs-HT_${ht_invalid_prj_file_short} PROPERTIES WILL_FAIL TRUE)
endforeach()
endif()
Source diff could not be displayed: it is stored in LFS. Options to address this: view the blob.
File added
Subproject commit 8e8190e7dc9c616fc4d08591ab8ac9df3d477f1d
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment