From e6d6079ae5f47d8cb3afa1fd07f7a51a1dbbf8a5 Mon Sep 17 00:00:00 2001
From: Boyan Meng <meng.boyan@ufz.de>
Date: Thu, 7 Nov 2019 17:27:13 +0100
Subject: [PATCH] Improve the soil assembler according to reviewers'
 suggestions

trailing whitespace

Squashed commit:

[9e54bd161] improve the soil assembler according to code reviewers' suggestions

[e1ee1880e] trailing whitespace
---
 .../HeatTransportBHELocalAssemblerSoil-impl.h | 29 +++++++++++--------
 .../HeatTransportBHELocalAssemblerSoil.h      |  4 +--
 .../IntegrationPointDataSoil.h                |  4 +--
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil-impl.h b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil-impl.h
index a410b9188f6..8565837fd23 100644
--- a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil-impl.h
+++ b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil-impl.h
@@ -17,6 +17,7 @@
 #include "MaterialLib/MPL/Utils/FormEigenTensor.h"
 #include "MathLib/LinAlg/Eigen/EigenMapTools.h"
 #include "NumLib/Fem/ShapeMatrixPolicy.h"
+#include "NumLib/Function/Interpolation.h"
 #include "ProcessLib/HeatTransportBHE/HeatTransportBHEProcessData.h"
 #include "ProcessLib/Utils/InitShapeMatrices.h"
 
@@ -44,10 +45,8 @@ HeatTransportBHELocalAssemblerSoil<ShapeFunction, IntegrationMethod>::
     _ip_data.reserve(n_integration_points);
     _secondary_data.N.resize(n_integration_points);
 
-    _shape_matrices = initShapeMatrices<ShapeFunction,
-                                        ShapeMatricesType,
-                                        IntegrationMethod,
-                                        3 /* GlobalDim */>(
+    _shape_matrices = initShapeMatrices<ShapeFunction, ShapeMatricesType,
+                                        IntegrationMethod, 3 /* GlobalDim */>(
         e, is_axially_symmetric, _integration_method);
 
     ParameterLib::SpatialPosition x_position;
@@ -62,10 +61,7 @@ HeatTransportBHELocalAssemblerSoil<ShapeFunction, IntegrationMethod>::
         auto const& sm = _shape_matrices[ip];
         double const w = _integration_method.getWeightedPoint(ip).getWeight() *
                          sm.integralMeasure * sm.detJ;
-        _ip_data.emplace_back(
-            sm.N, sm.dNdx,
-            _integration_method.getWeightedPoint(ip).getWeight() *
-                sm.integralMeasure * sm.detJ);
+        _ip_data.emplace_back(sm.N, sm.dNdx, w);
 
         _secondary_data.N[ip] = sm.N;
     }
@@ -109,6 +105,12 @@ void HeatTransportBHELocalAssemblerSoil<ShapeFunction, IntegrationMethod>::
         auto const& dNdx = ip_data.dNdx;
         auto const& w = ip_data.integration_weight;
 
+        double T_int_pt = 0.0;
+        NumLib::shapeFunctionInterpolate(local_x, N, T_int_pt);
+
+        vars[static_cast<int>(MaterialPropertyLib::Variable::temperature)] =
+            T_int_pt;
+
         // for now only using the solid and liquid phase parameters
         auto const density_s =
             solid_phase.property(MaterialPropertyLib::PropertyType::density)
@@ -138,13 +140,15 @@ void HeatTransportBHELocalAssemblerSoil<ShapeFunction, IntegrationMethod>::
             liquid_phase
                 .property(MaterialPropertyLib::PropertyType::phase_velocity)
                 .value(vars, pos, t);
-        auto velocity = Eigen::Map<Eigen::Matrix<double, 1, 3> const>(
+        auto const velocity = Eigen::Map<Eigen::Vector3d const>(
             std::get<MaterialPropertyLib::Vector>(velocity_arr).data(), 1, 3);
 
         // calculate the hydrodynamic thermodispersion tensor
         auto const thermal_conductivity =
             MaterialPropertyLib::formEigenTensor<3>(
-                medium.property(MaterialPropertyLib::PropertyType::thermal_conductivity)
+                medium
+                    .property(
+                        MaterialPropertyLib::PropertyType::thermal_conductivity)
                     .value(vars, pos, t));
 
         auto thermal_conductivity_dispersivity = thermal_conductivity;
@@ -169,14 +173,15 @@ void HeatTransportBHELocalAssemblerSoil<ShapeFunction, IntegrationMethod>::
                 (thermal_dispersivity_transversal * velocity_magnitude * I +
                  (thermal_dispersivity_longitudinal -
                   thermal_dispersivity_transversal) /
-                     velocity_magnitude * velocity.transpose() * velocity);
+                     velocity_magnitude * velocity * velocity.transpose());
             thermal_conductivity_dispersivity += thermal_dispersivity;
         }
 
         // assemble Conductance matrix
         local_K.noalias() +=
             (dNdx.transpose() * thermal_conductivity_dispersivity * dNdx +
-             N.transpose() * velocity * dNdx * density_f * heat_capacity_f) *
+             N.transpose() * velocity.transpose() * dNdx * density_f *
+                 heat_capacity_f) *
             w;
 
         // assemble Mass matrix
diff --git a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil.h b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil.h
index 479744eb741..09376bddd40 100644
--- a/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil.h
+++ b/ProcessLib/HeatTransportBHE/LocalAssemblers/HeatTransportBHELocalAssemblerSoil.h
@@ -73,8 +73,8 @@ private:
 
     std::vector<
         IntegrationPointDataSoil<NodalRowVectorType, GlobalDimNodalMatrixType>,
-        Eigen::aligned_allocator<
-            IntegrationPointDataSoil<NodalRowVectorType, GlobalDimNodalMatrixType>>>
+        Eigen::aligned_allocator<IntegrationPointDataSoil<
+            NodalRowVectorType, GlobalDimNodalMatrixType>>>
         _ip_data;
 
     IntegrationMethod const _integration_method;
diff --git a/ProcessLib/HeatTransportBHE/LocalAssemblers/IntegrationPointDataSoil.h b/ProcessLib/HeatTransportBHE/LocalAssemblers/IntegrationPointDataSoil.h
index a0b706978d7..1bc722b3fa7 100644
--- a/ProcessLib/HeatTransportBHE/LocalAssemblers/IntegrationPointDataSoil.h
+++ b/ProcessLib/HeatTransportBHE/LocalAssemblers/IntegrationPointDataSoil.h
@@ -18,8 +18,8 @@ template <typename NodalRowVectorType, typename GlobalDimNodalMatrixType>
 struct IntegrationPointDataSoil final
 {
     IntegrationPointDataSoil(NodalRowVectorType N_,
-                         GlobalDimNodalMatrixType dNdx_,
-                         double const& integration_weight_)
+                             GlobalDimNodalMatrixType dNdx_,
+                             double const& integration_weight_)
         : N(std::move(N_)),
           dNdx(std::move(dNdx_)),
           integration_weight(integration_weight_)
-- 
GitLab