From 0bd3ee5d1361f704869b84fbcf9c8f9426d694a2 Mon Sep 17 00:00:00 2001
From: Wenqing Wang <wenqing.wang@ufz.de>
Date: Wed, 11 Jul 2018 16:36:05 +0200
Subject: [PATCH] [BGRa] added createCreepBGRa

---
 .../CreepBGRa/c_CreepBGRa.md                  |  1 +
 .../constitutive_relation/CreepBGRa/t_a.md    |  1 +
 .../constitutive_relation/CreepBGRa/t_n.md    |  1 +
 .../constitutive_relation/CreepBGRa/t_q.md    |  1 +
 .../CreepBGRa/t_sigma0.md                     |  1 +
 MaterialLib/SolidModels/CreateCreepBGRa.cpp   | 84 +++++++++++++++++++
 MaterialLib/SolidModels/CreateCreepBGRa.h     | 53 ++++++++++++
 7 files changed, 142 insertions(+)
 create mode 100644 Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/c_CreepBGRa.md
 create mode 100644 Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_a.md
 create mode 100644 Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_n.md
 create mode 100644 Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_q.md
 create mode 100644 Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_sigma0.md
 create mode 100644 MaterialLib/SolidModels/CreateCreepBGRa.cpp
 create mode 100644 MaterialLib/SolidModels/CreateCreepBGRa.h

diff --git a/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/c_CreepBGRa.md b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/c_CreepBGRa.md
new file mode 100644
index 00000000000..f6b61cf3af4
--- /dev/null
+++ b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/c_CreepBGRa.md
@@ -0,0 +1 @@
+\copydoc MaterialLib::Solids::Creep::CreepBGRa
diff --git a/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_a.md b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_a.md
new file mode 100644
index 00000000000..eb91479048b
--- /dev/null
+++ b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_a.md
@@ -0,0 +1 @@
+Parameter A.
\ No newline at end of file
diff --git a/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_n.md b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_n.md
new file mode 100644
index 00000000000..cc6cbcb6154
--- /dev/null
+++ b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_n.md
@@ -0,0 +1 @@
+Parameter n.
\ No newline at end of file
diff --git a/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_q.md b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_q.md
new file mode 100644
index 00000000000..fdb36e43e26
--- /dev/null
+++ b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_q.md
@@ -0,0 +1 @@
+Parameter Q.
\ No newline at end of file
diff --git a/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_sigma0.md b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_sigma0.md
new file mode 100644
index 00000000000..83bb2b19834
--- /dev/null
+++ b/Documentation/ProjectFile/material/solid/constitutive_relation/CreepBGRa/t_sigma0.md
@@ -0,0 +1 @@
+Parameter sigma_0.
diff --git a/MaterialLib/SolidModels/CreateCreepBGRa.cpp b/MaterialLib/SolidModels/CreateCreepBGRa.cpp
new file mode 100644
index 00000000000..9c63f0ea152
--- /dev/null
+++ b/MaterialLib/SolidModels/CreateCreepBGRa.cpp
@@ -0,0 +1,84 @@
+/**
+ * \copyright
+ * Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ *  \file   CreateCreepBGRa.cpp
+ *  Created on July 11, 2018, 2:26 PM
+ */
+
+#include "CreateCreepBGRa.h"
+
+#include "CreateLinearElasticIsotropic.h"
+#include "CreateNewtonRaphsonSolverParameters.h"
+
+#include "CreepBGRa.h"
+
+#include "MechanicsBase.h"
+
+#include "BaseLib/ConfigTree.h"
+#include "BaseLib/Error.h"
+
+#include "ProcessLib/Parameter/Parameter.h"
+
+namespace MaterialLib
+{
+namespace Solids
+{
+namespace Creep
+{
+template <int DisplacementDim>
+std::unique_ptr<MaterialLib::Solids::MechanicsBase<DisplacementDim>>
+createCreepBGRa(
+    std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters,
+    BaseLib::ConfigTree const& config)
+{
+    //! \ogs_file_param{material__solid__constitutive_relation__type}
+    config.checkConfigParameter("type", "CreepBGRa");
+    DBUG("Create CreepBGRa material");
+
+    // Read elastic data frist.
+    const bool skip_type_checking = true;
+    auto elastic_data =
+        MaterialLib::Solids::createLinearElasticIsotropic<DisplacementDim>(
+            parameters, config, skip_type_checking);
+
+    //! \ogs_file_param_special{material__solid__constitutive_relation__CreepBGRa__a}
+    const auto A = config.getConfigParameter<double>("a");
+    DBUG("CreepBGRa parameter A=%g", A);
+
+    //! \ogs_file_param_special{material__solid__constitutive_relation__CreepBGRa__n}
+    const auto n = config.getConfigParameter<double>("n");
+    DBUG("CreepBGRa parameter n=%g", n);
+
+    //! \ogs_file_param_special{material__solid__constitutive_relation__CreepBGRa__sigma0}
+    const auto sigma0 = config.getConfigParameter<double>("sigma0");
+    DBUG("CreepBGRa parameter sigma0=%g", sigma0);
+
+    //! \ogs_file_param_special{material__solid__constitutive_relation__CreepBGRa__q}
+    const auto Q = config.getConfigParameter<double>("q");
+    DBUG("CreepBGRa parameter Q=%g", Q);
+
+    auto const nonlinear_solver_parameters =
+        createNewtonRaphsonSolverParameters(config);
+
+    return std::unique_ptr<CreepBGRa<DisplacementDim>>{
+        new CreepBGRa<DisplacementDim>{elastic_data->getMaterialProperties(),
+                                       nonlinear_solver_parameters, A, n,
+                                       sigma0, Q}};
+}
+
+template std::unique_ptr<MaterialLib::Solids::MechanicsBase<2>>
+createCreepBGRa<2>(
+    std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters,
+    BaseLib::ConfigTree const& config);
+
+template std::unique_ptr<MaterialLib::Solids::MechanicsBase<3>>
+createCreepBGRa<3>(
+    std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters,
+    BaseLib::ConfigTree const& config);
+}  // namespace Creep
+}  // namespace Solids
+}  // namespace MaterialLib
diff --git a/MaterialLib/SolidModels/CreateCreepBGRa.h b/MaterialLib/SolidModels/CreateCreepBGRa.h
new file mode 100644
index 00000000000..34832927839
--- /dev/null
+++ b/MaterialLib/SolidModels/CreateCreepBGRa.h
@@ -0,0 +1,53 @@
+/**
+ * \copyright
+ * Copyright (c) 2012-2018, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ *  \file   CreateCreepBGRa.h
+ *  Created on July 11, 2018, 2:26 PM
+ */
+
+#pragma once
+
+#include <memory>
+#include <vector>
+
+namespace BaseLib
+{
+class ConfigTree;
+}
+
+namespace ProcessLib
+{
+struct ParameterBase;
+}
+
+namespace MaterialLib
+{
+namespace Solids
+{
+template <int DisplacementDim>
+struct MechanicsBase;
+
+namespace Creep
+{
+template <int DisplacementDim>
+std::unique_ptr<MaterialLib::Solids::MechanicsBase<DisplacementDim>>
+createCreepBGRa(
+    std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters,
+    BaseLib::ConfigTree const& config);
+
+extern template std::unique_ptr<MaterialLib::Solids::MechanicsBase<2>>
+createCreepBGRa<2>(
+    std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters,
+    BaseLib::ConfigTree const& config);
+
+extern template std::unique_ptr<MaterialLib::Solids::MechanicsBase<3>>
+createCreepBGRa<3>(
+    std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters,
+    BaseLib::ConfigTree const& config);
+}
+}
+}
-- 
GitLab