From cc34f35eabf4ad3e370f0a27d1ee06eabb04e19a Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Tue, 5 Jul 2016 12:58:21 +0200
Subject: [PATCH] [PL] added missing TES secondary vars

---
 ProcessLib/TES/TESLocalAssembler-impl.h | 34 +++++++++++++++++++++++++
 ProcessLib/TES/TESLocalAssembler.h      | 12 +++++++++
 ProcessLib/TES/TESProcess.cpp           |  8 +++---
 3 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/ProcessLib/TES/TESLocalAssembler-impl.h b/ProcessLib/TES/TESLocalAssembler-impl.h
index 391b2930736..2054596137e 100644
--- a/ProcessLib/TES/TESLocalAssembler-impl.h
+++ b/ProcessLib/TES/TESLocalAssembler-impl.h
@@ -199,6 +199,40 @@ std::vector<double> const& TESLocalAssembler<
     return _d.getData().solid_density;
 }
 
+template <typename ShapeFunction_, typename IntegrationMethod_,
+          unsigned GlobalDim>
+std::vector<double> const& TESLocalAssembler<
+    ShapeFunction_, IntegrationMethod_,
+    GlobalDim>::getIntPtLoading(std::vector<double>& cache) const
+{
+    auto const rho_SR = _d.getData().solid_density;
+    auto const rho_SR_dry = _d.getAssemblyParameters().rho_SR_dry;
+
+    cache.clear();
+    cache.reserve(rho_SR.size());
+
+    for (auto const rho : rho_SR) {
+        cache.push_back(rho/rho_SR_dry - 1.0);
+    }
+
+    return cache;
+}
+
+template <typename ShapeFunction_, typename IntegrationMethod_,
+          unsigned GlobalDim>
+std::vector<double> const&
+TESLocalAssembler<ShapeFunction_, IntegrationMethod_, GlobalDim>::
+    getIntPtReactionDampingFactor(std::vector<double>& cache) const
+{
+    auto const fac = _d.getData().reaction_adaptor->getReactionDampingFactor();
+    auto const num_integration_points = _d.getData().solid_density.size();
+
+    cache.clear();
+    cache.resize(num_integration_points, fac);
+
+    return cache;
+}
+
 template <typename ShapeFunction_, typename IntegrationMethod_,
           unsigned GlobalDim>
 std::vector<double> const& TESLocalAssembler<
diff --git a/ProcessLib/TES/TESLocalAssembler.h b/ProcessLib/TES/TESLocalAssembler.h
index 5509c0cacf4..72efb4ea24e 100644
--- a/ProcessLib/TES/TESLocalAssembler.h
+++ b/ProcessLib/TES/TESLocalAssembler.h
@@ -36,6 +36,12 @@ public:
     virtual std::vector<double> const& getIntPtSolidDensity(
         std::vector<double>& /*cache*/) const = 0;
 
+    virtual std::vector<double> const& getIntPtLoading(
+        std::vector<double>& cache) const = 0;
+
+    virtual std::vector<double> const& getIntPtReactionDampingFactor(
+        std::vector<double>& cache) const = 0;
+
     virtual std::vector<double> const& getIntPtReactionRate(
         std::vector<double>& /*cache*/) const = 0;
 
@@ -84,6 +90,12 @@ public:
     std::vector<double> const& getIntPtSolidDensity(
         std::vector<double>& /*cache*/) const override;
 
+    std::vector<double> const& getIntPtLoading(
+        std::vector<double>& cache) const override;
+
+    std::vector<double> const& getIntPtReactionDampingFactor(
+        std::vector<double>& cache) const override;
+
     std::vector<double> const& getIntPtReactionRate(
         std::vector<double>& /*cache*/) const override;
 
diff --git a/ProcessLib/TES/TESProcess.cpp b/ProcessLib/TES/TESProcess.cpp
index 3d00df47d7b..b50c76cc8b0 100644
--- a/ProcessLib/TES/TESProcess.cpp
+++ b/ProcessLib/TES/TESProcess.cpp
@@ -188,9 +188,11 @@ void TESProcess::initializeConcreteProcess(
                                             _local_assemblers, method);
     };
 
-    // add2nd("solid_density", 1, makeEx(TESIntPtVariables::SOLID_DENSITY));
+    add2nd("solid_density", 1,
+           makeEx(&TESLocalAssemblerInterface::getIntPtSolidDensity));
     add2nd("reaction_rate", 1,
            makeEx(&TESLocalAssemblerInterface::getIntPtReactionRate));
+
     add2nd("velocity_x", 1,
            makeEx(&TESLocalAssemblerInterface::getIntPtDarcyVelocityX));
     if (mesh.getDimension() >= 2)
@@ -200,9 +202,9 @@ void TESProcess::initializeConcreteProcess(
         add2nd("velocity_z", 1,
                makeEx(&TESLocalAssemblerInterface::getIntPtDarcyVelocityZ));
 
-    /*add2nd("loading", 1, makeEx(TESIntPtVariables::LOADING));
+    add2nd("loading", 1, makeEx(&TESLocalAssemblerInterface::getIntPtLoading));
     add2nd("reaction_damping_factor", 1,
-           makeEx(TESIntPtVariables::REACTION_DAMPING_FACTOR));*/
+           makeEx(&TESLocalAssemblerInterface::getIntPtReactionDampingFactor));
 
     namespace PH = std::placeholders;
     using Self = TESProcess;
-- 
GitLab