From 761e6680194eb531cfea2e0341b0e4ce207ebe98 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Thu, 15 Aug 2019 14:15:52 +0200
Subject: [PATCH] [PL/HT] Pass pos and time to property calculations.

---
 ProcessLib/HT/HTFEM.h               | 34 ++++++++++++++---------------
 ProcessLib/HT/MonolithicHTFEM.h     | 26 +++++++++++-----------
 ProcessLib/HT/StaggeredHTFEM-impl.h | 34 ++++++++++++++---------------
 3 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/ProcessLib/HT/HTFEM.h b/ProcessLib/HT/HTFEM.h
index 0e3c1084fd6..3b3e73a6aab 100644
--- a/ProcessLib/HT/HTFEM.h
+++ b/ProcessLib/HT/HTFEM.h
@@ -94,7 +94,7 @@ public:
     /// Computes the flux in the point \c pnt_local_coords that is given in
     /// local coordinates using the values from \c local_x.
     Eigen::Vector3d getFlux(MathLib::Point3d const& pnt_local_coords,
-                            double const /*t*/,
+                            double const t,
                             std::vector<double> const& local_x) const override
     {
         // eval dNdx and invJ at given point
@@ -134,11 +134,11 @@ public:
         auto const K = MaterialPropertyLib::formEigenTensor<GlobalDim>(
             solid_phase
                 .property(MaterialPropertyLib::PropertyType::permeability)
-                .value(vars));
+                .value(vars, pos, t));
 
         auto const mu =
             liquid_phase.property(MaterialPropertyLib::PropertyType::viscosity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
         GlobalDimMatrixType const K_over_mu = K / mu;
 
         auto const p_nodal_values = Eigen::Map<const NodalVectorType>(
@@ -151,7 +151,7 @@ public:
             auto const rho_w =
                 liquid_phase
                     .property(MaterialPropertyLib::PropertyType::density)
-                    .template value<double>(vars);
+                    .template value<double>(vars, pos, t);
             auto const b = this->_process_data.specific_body_force;
             q += K_over_mu * rho_w * b;
         }
@@ -173,10 +173,9 @@ protected:
         _ip_data;
 
     double getHeatEnergyCoefficient(
-        MaterialPropertyLib::VariableArray const& vars,
-        const double porosity,
-        const double fluid_density,
-        const double specific_heat_capacity_fluid)
+        MaterialPropertyLib::VariableArray const& vars, const double porosity,
+        const double fluid_density, const double specific_heat_capacity_fluid,
+        ParameterLib::SpatialPosition const& pos, double const t)
     {
         auto const& medium =
             *_process_data.media_map->getMedium(this->_element.getID());
@@ -186,11 +185,11 @@ protected:
             solid_phase
                 .property(
                     MaterialPropertyLib::PropertyType::specific_heat_capacity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         auto const solid_density =
             solid_phase.property(MaterialPropertyLib::PropertyType::density)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         return solid_density * specific_heat_capacity_solid * (1 - porosity) +
                fluid_density * specific_heat_capacity_fluid * porosity;
@@ -199,7 +198,8 @@ protected:
     GlobalDimMatrixType getThermalConductivityDispersivity(
         MaterialPropertyLib::VariableArray const& vars, const double porosity,
         const double fluid_density, const double specific_heat_capacity_fluid,
-        const GlobalDimVectorType& velocity, const GlobalDimMatrixType& I)
+        const GlobalDimVectorType& velocity, const GlobalDimMatrixType& I,
+        ParameterLib::SpatialPosition const& pos, double const t)
     {
         auto const& medium =
             *_process_data.media_map->getMedium(_element.getID());
@@ -210,13 +210,13 @@ protected:
             solid_phase
                 .property(
                     MaterialPropertyLib::PropertyType::thermal_conductivity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         auto const thermal_conductivity_fluid =
             liquid_phase
                 .property(
                     MaterialPropertyLib::PropertyType::thermal_conductivity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         double const thermal_conductivity =
             thermal_conductivity_solid * (1 - porosity) +
@@ -250,7 +250,7 @@ protected:
     }
 
     std::vector<double> const& getIntPtDarcyVelocityLocal(
-        const double /*t*/, std::vector<double> const& local_p,
+        const double t, std::vector<double> const& local_p,
         std::vector<double> const& local_T, std::vector<double>& cache) const
     {
         auto const n_integration_points =
@@ -295,12 +295,12 @@ protected:
             auto const K = MaterialPropertyLib::formEigenTensor<GlobalDim>(
                 solid_phase
                     .property(MaterialPropertyLib::PropertyType::permeability)
-                    .value(vars));
+                    .value(vars, pos, t));
 
             auto const mu =
                 liquid_phase
                     .property(MaterialPropertyLib::PropertyType::viscosity)
-                    .template value<double>(vars);
+                    .template value<double>(vars, pos, t);
             GlobalDimMatrixType const K_over_mu = K / mu;
 
             cache_mat.col(ip).noalias() = -K_over_mu * dNdx * p_nodal_values;
@@ -310,7 +310,7 @@ protected:
                 auto const rho_w =
                     liquid_phase
                         .property(MaterialPropertyLib::PropertyType::density)
-                        .template value<double>(vars);
+                        .template value<double>(vars, pos, t);
                 auto const b = _process_data.specific_body_force;
                 // here it is assumed that the vector b is directed 'downwards'
                 cache_mat.col(ip).noalias() += K_over_mu * rho_w * b;
diff --git a/ProcessLib/HT/MonolithicHTFEM.h b/ProcessLib/HT/MonolithicHTFEM.h
index 6b992aad18a..73dfbc0f4a2 100644
--- a/ProcessLib/HT/MonolithicHTFEM.h
+++ b/ProcessLib/HT/MonolithicHTFEM.h
@@ -66,7 +66,7 @@ public:
     {
     }
 
-    void assemble(double const /*t*/, std::vector<double> const& local_x,
+    void assemble(double const t, std::vector<double> const& local_x,
                   std::vector<double>& local_M_data,
                   std::vector<double>& local_K_data,
                   std::vector<double>& local_b_data) override
@@ -123,7 +123,7 @@ public:
             // constant storage model
             auto const specific_storage =
                 solid_phase.property(MaterialPropertyLib::PropertyType::storage)
-                    .template value<double>(vars);
+                    .template value<double>(vars, pos, t);
 
             auto const& ip_data = this->_ip_data[ip];
             auto const& N = ip_data.N;
@@ -138,14 +138,14 @@ public:
             auto const porosity =
                 solid_phase
                     .property(MaterialPropertyLib::PropertyType::porosity)
-                    .template value<double>(vars);
+                    .template value<double>(vars, pos, t);
 
             auto const intrinsic_permeability =
                 MaterialPropertyLib::formEigenTensor<GlobalDim>(
                     solid_phase
                         .property(
                             MaterialPropertyLib::PropertyType::permeability)
-                        .value(vars));
+                        .value(vars, pos, t));
 
             vars[static_cast<int>(MaterialPropertyLib::Variable::temperature)] =
                 T_int_pt;
@@ -155,19 +155,19 @@ public:
             auto const specific_heat_capacity_fluid =
                 liquid_phase
                     .property(MaterialPropertyLib::specific_heat_capacity)
-                    .template value<double>(vars);
+                    .template value<double>(vars, pos, t);
 
             // Use the fluid density model to compute the density
             auto const fluid_density =
                 liquid_phase
                     .property(MaterialPropertyLib::PropertyType::density)
-                    .template value<double>(vars);
+                    .template value<double>(vars, pos, t);
 
             // Use the viscosity model to compute the viscosity
             auto const viscosity =
                 liquid_phase
                     .property(MaterialPropertyLib::PropertyType::viscosity)
-                    .template value<double>(vars);
+                    .template value<double>(vars, pos, t);
             GlobalDimMatrixType K_over_mu = intrinsic_permeability / viscosity;
 
             GlobalDimVectorType const velocity =
@@ -180,18 +180,18 @@ public:
             GlobalDimMatrixType const thermal_conductivity_dispersivity =
                 this->getThermalConductivityDispersivity(
                     vars, porosity, fluid_density, specific_heat_capacity_fluid,
-                    velocity, I);
+                    velocity, I, pos, t);
             KTT.noalias() +=
                 (dNdx.transpose() * thermal_conductivity_dispersivity * dNdx +
                  N.transpose() * velocity.transpose() * dNdx * fluid_density *
                      specific_heat_capacity_fluid) *
                 w;
             Kpp.noalias() += w * dNdx.transpose() * K_over_mu * dNdx;
-            MTT.noalias() +=
-                w *
-                this->getHeatEnergyCoefficient(vars, porosity, fluid_density,
-                                               specific_heat_capacity_fluid) *
-                N.transpose() * N;
+            MTT.noalias() += w *
+                             this->getHeatEnergyCoefficient(
+                                 vars, porosity, fluid_density,
+                                 specific_heat_capacity_fluid, pos, t) *
+                             N.transpose() * N;
             Mpp.noalias() += w * N.transpose() * specific_storage * N;
             if (process_data.has_gravity)
             {
diff --git a/ProcessLib/HT/StaggeredHTFEM-impl.h b/ProcessLib/HT/StaggeredHTFEM-impl.h
index bb937037c7a..08ef5e22382 100644
--- a/ProcessLib/HT/StaggeredHTFEM-impl.h
+++ b/ProcessLib/HT/StaggeredHTFEM-impl.h
@@ -105,10 +105,10 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
 
         auto const porosity =
             solid_phase.property(MaterialPropertyLib::PropertyType::porosity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
         auto const fluid_density =
             liquid_phase.property(MaterialPropertyLib::PropertyType::density)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         const double dfluid_density_dp =
             liquid_phase.property(MaterialPropertyLib::PropertyType::density)
@@ -118,19 +118,19 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
         // Use the viscosity model to compute the viscosity
         auto const viscosity =
             liquid_phase.property(MaterialPropertyLib::PropertyType::viscosity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         // \todo the argument to getValue() has to be changed for non
         // constant storage model
         auto const specific_storage =
             solid_phase.property(MaterialPropertyLib::PropertyType::storage)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         auto const intrinsic_permeability =
             MaterialPropertyLib::formEigenTensor<GlobalDim>(
                 solid_phase
                     .property(MaterialPropertyLib::PropertyType::permeability)
-                    .value(vars));
+                    .value(vars, pos, t));
         GlobalDimMatrixType const K_over_mu =
             intrinsic_permeability / viscosity;
 
@@ -178,7 +178,7 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
 template <typename ShapeFunction, typename IntegrationMethod,
           unsigned GlobalDim>
 void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
-    assembleHeatTransportEquation(double const /*t*/,
+    assembleHeatTransportEquation(double const t,
                                   std::vector<double>& local_M_data,
                                   std::vector<double>& local_K_data,
                                   std::vector<double>& /*local_b_data*/,
@@ -241,33 +241,33 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
 
         auto const porosity =
             solid_phase.property(MaterialPropertyLib::PropertyType::porosity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         // Use the fluid density model to compute the density
         auto const fluid_density =
             liquid_phase.property(MaterialPropertyLib::PropertyType::density)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
         auto const specific_heat_capacity_fluid =
             liquid_phase.property(MaterialPropertyLib::specific_heat_capacity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         // Assemble mass matrix
-        local_M.noalias() +=
-            w *
-            this->getHeatEnergyCoefficient(vars, porosity, fluid_density,
-                                           specific_heat_capacity_fluid) *
-            N.transpose() * N;
+        local_M.noalias() += w *
+                             this->getHeatEnergyCoefficient(
+                                 vars, porosity, fluid_density,
+                                 specific_heat_capacity_fluid, pos, t) *
+                             N.transpose() * N;
 
         // Assemble Laplace matrix
         auto const viscosity =
             liquid_phase.property(MaterialPropertyLib::PropertyType::viscosity)
-                .template value<double>(vars);
+                .template value<double>(vars, pos, t);
 
         auto const intrinsic_permeability =
             MaterialPropertyLib::formEigenTensor<GlobalDim>(
                 solid_phase
                     .property(MaterialPropertyLib::PropertyType::permeability)
-                    .value(vars));
+                    .value(vars, pos, t));
 
         GlobalDimMatrixType const K_over_mu =
             intrinsic_permeability / viscosity;
@@ -280,7 +280,7 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
         GlobalDimMatrixType const thermal_conductivity_dispersivity =
             this->getThermalConductivityDispersivity(
                 vars, porosity, fluid_density, specific_heat_capacity_fluid,
-                velocity, I);
+                velocity, I, pos, t);
 
         local_K.noalias() +=
             w * (dNdx.transpose() * thermal_conductivity_dispersivity * dNdx +
-- 
GitLab