From 3600b119673ebfed0d2016e38d9145d42d03218c Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Mon, 30 Aug 2021 18:30:35 +0200
Subject: [PATCH] [PL/TH2M] Separate non-const solid phase vol.frac.

The propertie belongs into the material models.
Computations in near future will require only constant
solid phase volume fraction, so the switch is added
to separate constant and non-constant parts.
---
 ProcessLib/TH2M/TH2MFEM-impl.h | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/ProcessLib/TH2M/TH2MFEM-impl.h b/ProcessLib/TH2M/TH2MFEM-impl.h
index 2a67a1be159..d92709e1367 100644
--- a/ProcessLib/TH2M/TH2MFEM-impl.h
+++ b/ProcessLib/TH2M/TH2MFEM-impl.h
@@ -137,9 +137,6 @@ void TH2MLocalAssembler<ShapeFunctionDisplacement, ShapeFunctionPressure,
         auto const& Nu = ip_data.N_u;
         auto const& gradNu = ip_data.dNdx_u;
 
-        auto const& m = Invariants::identity2;
-        auto const mT = m.transpose();
-
         auto const x_coord =
             NumLib::interpolateXCoordinate<ShapeFunctionDisplacement,
                                            ShapeMatricesTypeDisplacement>(
@@ -238,17 +235,30 @@ void TH2MLocalAssembler<ShapeFunctionDisplacement, ShapeFunctionPressure,
         auto const phi_0 = medium.property(MPL::PropertyType::porosity)
                                .template value<double>(vars, pos, t, dt);
 
-        // solid phase volume fraction
-        double const div_u = mT * eps;
         auto const phi_S_0 = 1. - phi_0;
+
+#define NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
+
+#ifdef NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
+        auto const& m = Invariants::identity2;
+        double const div_u = m.transpose() * eps;
+
         const double phi_S = phi_S_0 * (1. + ip_data.thermal_volume_strain -
                                         ip_data.alpha_B * div_u);
+#else   // NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
+        const double phi_S = phi_S_0;
+#endif  // NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
+
         // porosity
         ip_data.phi = 1. - phi_S;
 
         // solid phase density
+#ifdef NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
         auto const rhoSR = rho_ref_SR * (1. - ip_data.thermal_volume_strain +
                                          (ip_data.alpha_B - 1.) * div_u);
+#else   // NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
+        auto const rhoSR = rho_ref_SR;
+#endif  // NON_CONSTANT_SOLID_PHASE_VOLUME_FRACTION
 
         ip_data.updateConstitutiveRelation(vars, t, pos, dt, T - T_dot * dt);
 
-- 
GitLab