Newer
Older
/**
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "CreateSmallDeformationProcess.h"
#include <cassert>
#include "MaterialLib/SolidModels/CreateLinearElasticIsotropic.h"
#include "MaterialLib/FractureModels/CreateLinearElasticIsotropic.h"
#include "MaterialLib/FractureModels/CreateMohrCoulomb.h"
#include "ProcessLib/Utils/ParseSecondaryVariables.h"
#include "ProcessLib/Utils/ProcessUtils.h" // required for findParameter
#include "SmallDeformationProcess.h"
#include "SmallDeformationProcessData.h"
namespace ProcessLib
{
Norihiro Watanabe
committed
namespace LIE
Norihiro Watanabe
committed
namespace SmallDeformation
{
template <int DisplacementDim>
class SmallDeformationProcess;
extern template class SmallDeformationProcess<2>;
template <int DisplacementDim>
std::unique_ptr<Process>
createSmallDeformationProcess(
MeshLib::Mesh& mesh,
std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
std::vector<ProcessVariable> const& variables,
std::vector<std::unique_ptr<ParameterBase>> const& parameters,
unsigned const integration_order,
BaseLib::ConfigTree const& config)
{
//! \ogs_file_param{process__type}
config.checkConfigParameter("type", "SMALL_DEFORMATION_WITH_LIE");
DBUG("Create SmallDeformationProcess with LIE.");
// Process variables
auto const pv_conf = config.getConfigSubtree("process_variables");
auto range = pv_conf.getConfigParameterList<std::string>("process_variable");
std::vector<std::reference_wrapper<ProcessVariable>> process_variables;
for (std::string const& pv_name : range)
{
if (pv_name != "displacement"
&& pv_name.find("displacement_jump") != 0)
OGS_FATAL("Found a process variable name '%s'. It should be 'displacement' or 'displacement_jumpN'");
auto variable = std::find_if(
variables.cbegin(), variables.cend(),
[&pv_name](ProcessVariable const& v) { return v.getName() == pv_name; });
if (variable == variables.end())
{
OGS_FATAL(
"Could not find process variable '%s' in the provided variables "
"list for config tag <%s>.",
pv_name.c_str(), "process_variable");
}
DBUG("Found process variable \'%s\' for config tag <%s>.",
variable->getName().c_str(), "process_variable");
process_variables.emplace_back(const_cast<ProcessVariable&>(*variable));
}
auto const n_fractures = process_variables.size()-1;
if (n_fractures < 1)
OGS_FATAL("No displacement jump variables are specified");
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
DBUG("Associate displacement with process variable \'%s\'.",
process_variables.back().get().getName().c_str());
if (process_variables.back().get().getNumberOfComponents() !=
DisplacementDim)
{
OGS_FATAL(
"Number of components of the process variable '%s' is different "
"from the displacement dimension: got %d, expected %d",
process_variables.back().get().getName().c_str(),
process_variables.back().get().getNumberOfComponents(),
DisplacementDim);
}
// Constitutive relation.
// read type;
auto const constitutive_relation_config =
//! \ogs_file_param{process__SMALL_DEFORMATION_WITH_LIE__constitutive_relation}
config.getConfigSubtree("constitutive_relation");
auto const type =
constitutive_relation_config.peekConfigParameter<std::string>("type");
std::unique_ptr<MaterialLib::Solids::MechanicsBase<DisplacementDim>> material = nullptr;
if (type == "LinearElasticIsotropic")
{
material = MaterialLib::Solids::createLinearElasticIsotropic<DisplacementDim>(
parameters, constitutive_relation_config);
}
else
{
OGS_FATAL(
"Cannot construct constitutive relation of given type \'%s\'.",
type.c_str());
}
// Fracture constitutive relation.
// read type;
auto const fracture_constitutive_relation_config =
//! \ogs_file_param{process__SMALL_DEFORMATION_WITH_LIE__constitutive_relation}
config.getConfigSubtree("fracture_constitutive_relation");
auto const frac_type =
fracture_constitutive_relation_config.peekConfigParameter<std::string>("type");
std::unique_ptr<MaterialLib::Fracture::FractureModelBase<DisplacementDim>> fracture_model = nullptr;
if (frac_type == "LinearElasticIsotropic")
{
fracture_model = MaterialLib::Fracture::createLinearElasticIsotropic<DisplacementDim>(
parameters, fracture_constitutive_relation_config);
}
else if (frac_type == "MohrCoulomb")
{
fracture_model = MaterialLib::Fracture::createMohrCoulomb<DisplacementDim>(
parameters, fracture_constitutive_relation_config);
}
else
{
OGS_FATAL(
"Cannot construct fracture constitutive relation of given type \'%s\'.",
frac_type.c_str());
}
// Fracture properties
std::vector<std::unique_ptr<FractureProperty>> vec_fracture_property;
//! \ogs_file_param{process__SMALL_DEFORMATION_WITH_LIE__fracture_properties}
for (auto fracture_properties_config : config.getConfigSubtreeList("fracture_properties"))
{
auto& para_b0 = ProcessLib::findParameter<double>(
fracture_properties_config, "initial_aperture", parameters, 1);
auto frac_prop(new FractureProperty());
frac_prop->fracture_id = vec_fracture_property.size();
frac_prop->mat_id = fracture_properties_config.getConfigParameter<int>("material_id");
frac_prop->aperture0 = ¶_b0;
vec_fracture_property.emplace_back(frac_prop);
}
if (n_fractures != vec_fracture_property.size())
OGS_FATAL(
"The number of displacement jumps and the number of <fracture_properties> "
"are not consistent");
SmallDeformationProcessData<DisplacementDim> process_data(
std::move(material), std::move(fracture_model), std::move(vec_fracture_property));
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
SecondaryVariableCollection secondary_variables;
NumLib::NamedFunctionCaller named_function_caller(
{"SmallDeformation_displacement"});
ProcessLib::parseSecondaryVariables(config, secondary_variables,
named_function_caller);
return std::unique_ptr<SmallDeformationProcess<DisplacementDim>>{
new SmallDeformationProcess<DisplacementDim>{
mesh, std::move(jacobian_assembler), parameters, integration_order,
std::move(process_variables), std::move(process_data),
std::move(secondary_variables), std::move(named_function_caller)}};
}
template
std::unique_ptr<Process>
createSmallDeformationProcess<2>(
MeshLib::Mesh& mesh,
std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
std::vector<ProcessVariable> const& variables,
std::vector<std::unique_ptr<ParameterBase>> const& parameters,
unsigned const integration_order,
BaseLib::ConfigTree const& config);
Norihiro Watanabe
committed
} // namespace SmallDeformation
} // namespace LIE
} // namespace ProcessLib