From 142743eabbe78508e9fccd445e06b1ddf83d05e8 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue, 12 Nov 2019 14:06:36 +0100 Subject: [PATCH] [HT] Check if porous media, liquid, and solid phase exists. --- ProcessLib/HT/HTFEM.h | 2 +- ProcessLib/HT/HTProcess.cpp | 14 +++++++++ ProcessLib/HT/HTProcess.h | 62 +++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/ProcessLib/HT/HTFEM.h b/ProcessLib/HT/HTFEM.h index a748da5cdb6..4fd444ff136 100644 --- a/ProcessLib/HT/HTFEM.h +++ b/ProcessLib/HT/HTFEM.h @@ -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)); diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp index 946e94d9e21..dbb53bb1aaa 100644 --- a/ProcessLib/HT/HTProcess.cpp +++ b/ProcessLib/HT/HTProcess.cpp @@ -53,6 +53,20 @@ void HTProcess::initializeConcreteProcess( MeshLib::Mesh const& mesh, unsigned const integration_order) { + unsigned const global_dim = mesh.getDimension(); + if (global_dim == 1) + { + checkProperties<1>(mesh); + } + if (global_dim == 2) + { + checkProperties<2>(mesh); + } + if (global_dim == 3) + { + checkProperties<3>(mesh); + } + // 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, diff --git a/ProcessLib/HT/HTProcess.h b/ProcessLib/HT/HTProcess.h index 89ca365d5fb..44ab526a0bf 100644 --- a/ProcessLib/HT/HTProcess.h +++ b/ProcessLib/HT/HTProcess.h @@ -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,66 @@ public: int const process_id) override; private: + template <unsigned GlobalDim> + void checkProperties(MeshLib::Mesh const& mesh) const + { + // only needed as dummy for checking of existence of properties + MaterialPropertyLib::VariableArray vars; + double const t = 0.0; + + DBUG("Check the media properties ..."); + for (auto const& element : mesh.getElements()) + { + auto const element_id = element->getID(); + ParameterLib::SpatialPosition pos; + pos.setElementID(element_id); + + // check if a definition of the porous media exists + auto const& medium = + *_process_data.media_map->getMedium(element_id); + + // checking general medium properties + auto const porosity = + medium.property(MaterialPropertyLib::PropertyType::porosity) + .template value<double>(vars, pos, t); + auto const K = MaterialPropertyLib::formEigenTensor<GlobalDim>( + medium.property(MaterialPropertyLib::PropertyType::permeability) + .value(vars, pos, t)); + + // check if liquid phase definition and the corresponding properties + // exists + auto const& liquid_phase = medium.phase("AqueousLiquid"); + auto const mu = + liquid_phase + .property(MaterialPropertyLib::PropertyType::viscosity) + .template value<double>(vars, pos, t); + auto const liquid_density = + liquid_phase + .property(MaterialPropertyLib::PropertyType::density) + .template value<double>(vars, pos, t); + auto const specific_heat_capacity_fluid = + liquid_phase + .property(MaterialPropertyLib::specific_heat_capacity) + .template value<double>(vars, pos, t); + + // check if solid phase definition and the corresponding properties + // exists + auto const& solid_phase = medium.phase("Solid"); + auto const specific_heat_capacity_solid = + solid_phase + .property(MaterialPropertyLib::PropertyType:: + specific_heat_capacity) + .template value<double>(vars, pos, t); + auto const solid_density = + solid_phase.property(MaterialPropertyLib::PropertyType::density) + .template value<double>(vars, pos, t); + auto const specific_storage = + solid_phase.property(MaterialPropertyLib::PropertyType::storage) + .template value<double>(vars, pos, t); + } + DBUG("Media properties verified."); + } + void initializeConcreteProcess( NumLib::LocalToGlobalIndexMap const& dof_table, MeshLib::Mesh const& mesh, -- GitLab