Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ogs
ogs
Commits
753da562
Commit
753da562
authored
Oct 16, 2020
by
wenqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Process/TRM] Added the process creator
parent
d1feb884
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
313 additions
and
0 deletions
+313
-0
ProcessLib/ThermoRichardsMechanics/CreateThermoRichardsMechanicsProcess.cpp
...ichardsMechanics/CreateThermoRichardsMechanicsProcess.cpp
+224
-0
ProcessLib/ThermoRichardsMechanics/CreateThermoRichardsMechanicsProcess.h
...oRichardsMechanics/CreateThermoRichardsMechanicsProcess.h
+89
-0
No files found.
ProcessLib/ThermoRichardsMechanics/CreateThermoRichardsMechanicsProcess.cpp
0 → 100644
View file @
753da562
/**
* \file
* \copyright
* Copyright (c) 2012-2021, 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 "CreateThermoRichardsMechanicsProcess.h"
#include <cassert>
#include "MaterialLib/MPL/CreateMaterialSpatialDistributionMap.h"
#include "MaterialLib/MPL/MaterialSpatialDistributionMap.h"
#include "MaterialLib/MPL/Medium.h"
#include "MaterialLib/SolidModels/CreateConstitutiveRelation.h"
#include "MaterialLib/SolidModels/MechanicsBase.h"
#include "ParameterLib/Utils.h"
#include "ProcessLib/Output/CreateSecondaryVariables.h"
#include "ProcessLib/Utils/ProcessUtils.h"
#include "ThermoRichardsMechanicsProcess.h"
#include "ThermoRichardsMechanicsProcessData.h"
namespace
ProcessLib
{
namespace
ThermoRichardsMechanics
{
void
checkMPLProperties
(
std
::
map
<
int
,
std
::
shared_ptr
<
MaterialPropertyLib
::
Medium
>>
const
&
media
)
{
std
::
array
const
required_medium_properties
=
{
MaterialPropertyLib
::
porosity
,
MaterialPropertyLib
::
biot_coefficient
,
MaterialPropertyLib
::
bishops_effective_stress
,
MaterialPropertyLib
::
relative_permeability
,
MaterialPropertyLib
::
saturation
};
std
::
array
const
required_liquid_properties
=
{
MaterialPropertyLib
::
viscosity
,
MaterialPropertyLib
::
density
,
MaterialPropertyLib
::
bulk_modulus
};
std
::
array
const
required_solid_properties
=
{
MaterialPropertyLib
::
density
};
// Thermal properties are not checked because they can be phase property or
// meduim property (will be enabled later).
for
(
auto
const
&
m
:
media
)
{
checkRequiredProperties
(
*
m
.
second
,
required_medium_properties
);
checkRequiredProperties
(
m
.
second
->
phase
(
"AqueousLiquid"
),
required_liquid_properties
);
checkRequiredProperties
(
m
.
second
->
phase
(
"Solid"
),
required_solid_properties
);
}
}
void
checkProcessVariableComponents
(
ProcessVariable
const
&
variable
,
const
int
dim
)
{
DBUG
(
"Associate displacement with process variable '{:s}'."
,
variable
.
getName
());
if
(
variable
.
getNumberOfGlobalComponents
()
!=
dim
)
{
OGS_FATAL
(
"Number of components of the process variable '{:s}' is different "
"from the displacement dimension: got {:d}, expected {:d}"
,
variable
.
getName
(),
variable
.
getNumberOfGlobalComponents
(),
dim
);
}
}
template
<
int
DisplacementDim
>
std
::
unique_ptr
<
Process
>
createThermoRichardsMechanicsProcess
(
std
::
string
name
,
MeshLib
::
Mesh
&
mesh
,
std
::
unique_ptr
<
ProcessLib
::
AbstractJacobianAssembler
>&&
jacobian_assembler
,
std
::
vector
<
ProcessVariable
>
const
&
variables
,
std
::
vector
<
std
::
unique_ptr
<
ParameterLib
::
ParameterBase
>>
const
&
parameters
,
boost
::
optional
<
ParameterLib
::
CoordinateSystem
>
const
&
local_coordinate_system
,
unsigned
const
integration_order
,
BaseLib
::
ConfigTree
const
&
config
,
std
::
map
<
int
,
std
::
shared_ptr
<
MaterialPropertyLib
::
Medium
>>
const
&
media
)
{
//! \ogs_file_param{prj__processes__process__type}
config
.
checkConfigParameter
(
"type"
,
"THERMO_RICHARDS_MECHANICS"
);
DBUG
(
"Create ThermoRichardsMechanicsProcess."
);
auto
const
staggered_scheme
=
//! \ogs_file_param{prj__processes__process__THERMO_RICHARDS_MECHANICS__coupling_scheme}
config
.
getConfigParameterOptional
<
std
::
string
>
(
"coupling_scheme"
);
const
bool
use_monolithic_scheme
=
!
(
staggered_scheme
&&
(
*
staggered_scheme
==
"staggered"
));
// Process variable.
//! \ogs_file_param{prj__processes__process__THERMO_RICHARDS_MECHANICS__process_variables}
auto
const
pv_config
=
config
.
getConfigSubtree
(
"process_variables"
);
ProcessVariable
*
variable_T
;
ProcessVariable
*
variable_p
;
ProcessVariable
*
variable_u
;
std
::
vector
<
std
::
vector
<
std
::
reference_wrapper
<
ProcessVariable
>>>
process_variables
;
if
(
use_monolithic_scheme
)
// monolithic scheme.
{
auto
per_process_variables
=
findProcessVariables
(
variables
,
pv_config
,
{
//! \ogs_file_param_special{prj__processes__process__THERMO_RICHARDS_MECHANICS__process_variables__temperature}
"temperature"
,
//! \ogs_file_param_special{prj__processes__process__THERMO_RICHARDS_MECHANICS__process_variables__pressure}
"pressure"
,
//! \ogs_file_param_special{prj__processes__process__THERMO_RICHARDS_MECHANICS__process_variables__displacement}
"displacement"
});
variable_T
=
&
per_process_variables
[
0
].
get
();
variable_p
=
&
per_process_variables
[
1
].
get
();
variable_u
=
&
per_process_variables
[
2
].
get
();
process_variables
.
push_back
(
std
::
move
(
per_process_variables
));
}
else
// staggered scheme.
{
OGS_FATAL
(
"So far, only the monolithic scheme is implemented for "
"THERMO_RICHARDS_MECHANICS"
);
}
checkProcessVariableComponents
(
*
variable_T
,
1
);
checkProcessVariableComponents
(
*
variable_p
,
1
);
checkProcessVariableComponents
(
*
variable_u
,
DisplacementDim
);
auto
solid_constitutive_relations
=
MaterialLib
::
Solids
::
createConstitutiveRelations
<
DisplacementDim
>
(
parameters
,
local_coordinate_system
,
config
);
// Specific body force
Eigen
::
Matrix
<
double
,
DisplacementDim
,
1
>
specific_body_force
;
{
std
::
vector
<
double
>
const
b
=
//! \ogs_file_param{prj__processes__process__THERMO_RICHARDS_MECHANICS__specific_body_force}
config
.
getConfigParameter
<
std
::
vector
<
double
>>
(
"specific_body_force"
);
if
(
b
.
size
()
!=
DisplacementDim
)
{
OGS_FATAL
(
"The size of the specific body force vector does not match the "
"displacement dimension. Vector size is {:d}, displacement "
"dimension is {:d}"
,
b
.
size
(),
DisplacementDim
);
}
std
::
copy_n
(
b
.
data
(),
b
.
size
(),
specific_body_force
.
data
());
}
auto
media_map
=
MaterialPropertyLib
::
createMaterialSpatialDistributionMap
(
media
,
mesh
);
DBUG
(
"Check the media properties of ThermoRichardsMechanics process "
"..."
);
checkMPLProperties
(
media
);
DBUG
(
"Media properties verified."
);
// Initial stress conditions
auto
const
initial_stress
=
ParameterLib
::
findOptionalTagParameter
<
double
>
(
//! \ogs_file_param_special{prj__processes__process__THERMO_RICHARDS_MECHANICS__initial_stress}
config
,
"initial_stress"
,
parameters
,
// Symmetric tensor size, 4 or 6, not a Kelvin vector.
MathLib
::
KelvinVector
::
KelvinVectorDimensions
<
DisplacementDim
>::
value
,
&
mesh
);
bool
mass_lumping
=
false
;
if
(
auto
const
mass_lumping_ptr
=
//! \ogs_file_param{prj__processes__process__THERMO_RICHARDS_MECHANICS__mass_lumping}
config
.
getConfigParameterOptional
<
bool
>
(
"mass_lumping"
))
{
DBUG
(
"Using mass lumping for the Richards flow equation."
);
mass_lumping
=
*
mass_lumping_ptr
;
}
ThermoRichardsMechanicsProcessData
<
DisplacementDim
>
process_data
{
materialIDs
(
mesh
),
std
::
move
(
media_map
),
std
::
move
(
solid_constitutive_relations
),
initial_stress
,
specific_body_force
,
mass_lumping
};
SecondaryVariableCollection
secondary_variables
;
ProcessLib
::
createSecondaryVariables
(
config
,
secondary_variables
);
return
std
::
make_unique
<
ThermoRichardsMechanicsProcess
<
DisplacementDim
>>
(
std
::
move
(
name
),
mesh
,
std
::
move
(
jacobian_assembler
),
parameters
,
integration_order
,
std
::
move
(
process_variables
),
std
::
move
(
process_data
),
std
::
move
(
secondary_variables
),
use_monolithic_scheme
);
}
template
std
::
unique_ptr
<
Process
>
createThermoRichardsMechanicsProcess
<
2
>
(
std
::
string
name
,
MeshLib
::
Mesh
&
mesh
,
std
::
unique_ptr
<
ProcessLib
::
AbstractJacobianAssembler
>&&
jacobian_assembler
,
std
::
vector
<
ProcessVariable
>
const
&
variables
,
std
::
vector
<
std
::
unique_ptr
<
ParameterLib
::
ParameterBase
>>
const
&
parameters
,
boost
::
optional
<
ParameterLib
::
CoordinateSystem
>
const
&
local_coordinate_system
,
unsigned
const
integration_order
,
BaseLib
::
ConfigTree
const
&
config
,
std
::
map
<
int
,
std
::
shared_ptr
<
MaterialPropertyLib
::
Medium
>>
const
&
media
);
template
std
::
unique_ptr
<
Process
>
createThermoRichardsMechanicsProcess
<
3
>
(
std
::
string
name
,
MeshLib
::
Mesh
&
mesh
,
std
::
unique_ptr
<
ProcessLib
::
AbstractJacobianAssembler
>&&
jacobian_assembler
,
std
::
vector
<
ProcessVariable
>
const
&
variables
,
std
::
vector
<
std
::
unique_ptr
<
ParameterLib
::
ParameterBase
>>
const
&
parameters
,
boost
::
optional
<
ParameterLib
::
CoordinateSystem
>
const
&
local_coordinate_system
,
unsigned
const
integration_order
,
BaseLib
::
ConfigTree
const
&
config
,
std
::
map
<
int
,
std
::
shared_ptr
<
MaterialPropertyLib
::
Medium
>>
const
&
media
);
}
// namespace ThermoRichardsMechanics
}
// namespace ProcessLib
ProcessLib/ThermoRichardsMechanics/CreateThermoRichardsMechanicsProcess.h
0 → 100644
View file @
753da562
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
#include <boost/optional.hpp>
#include <map>
#include <memory>
#include <vector>
namespace
BaseLib
{
class
ConfigTree
;
}
namespace
MeshLib
{
class
Mesh
;
}
namespace
MathLib
{
class
PiecewiseLinearInterpolation
;
}
namespace
MaterialPropertyLib
{
class
Medium
;
}
namespace
ParameterLib
{
struct
CoordinateSystem
;
struct
ParameterBase
;
}
// namespace ParameterLib
namespace
ProcessLib
{
class
AbstractJacobianAssembler
;
class
Process
;
class
ProcessVariable
;
}
// namespace ProcessLib
namespace
ProcessLib
{
namespace
ThermoRichardsMechanics
{
template
<
int
DisplacementDim
>
std
::
unique_ptr
<
Process
>
createThermoRichardsMechanicsProcess
(
std
::
string
name
,
MeshLib
::
Mesh
&
mesh
,
std
::
unique_ptr
<
ProcessLib
::
AbstractJacobianAssembler
>&&
jacobian_assembler
,
std
::
vector
<
ProcessVariable
>
const
&
variables
,
std
::
vector
<
std
::
unique_ptr
<
ParameterLib
::
ParameterBase
>>
const
&
parameters
,
boost
::
optional
<
ParameterLib
::
CoordinateSystem
>
const
&
local_coordinate_system
,
unsigned
const
integration_order
,
BaseLib
::
ConfigTree
const
&
config
,
std
::
map
<
int
,
std
::
shared_ptr
<
MaterialPropertyLib
::
Medium
>>
const
&
media
);
extern
template
std
::
unique_ptr
<
Process
>
createThermoRichardsMechanicsProcess
<
2
>
(
std
::
string
name
,
MeshLib
::
Mesh
&
mesh
,
std
::
unique_ptr
<
ProcessLib
::
AbstractJacobianAssembler
>&&
jacobian_assembler
,
std
::
vector
<
ProcessVariable
>
const
&
variables
,
std
::
vector
<
std
::
unique_ptr
<
ParameterLib
::
ParameterBase
>>
const
&
parameters
,
boost
::
optional
<
ParameterLib
::
CoordinateSystem
>
const
&
local_coordinate_system
,
unsigned
const
integration_order
,
BaseLib
::
ConfigTree
const
&
config
,
std
::
map
<
int
,
std
::
shared_ptr
<
MaterialPropertyLib
::
Medium
>>
const
&
media
);
extern
template
std
::
unique_ptr
<
Process
>
createThermoRichardsMechanicsProcess
<
3
>
(
std
::
string
name
,
MeshLib
::
Mesh
&
mesh
,
std
::
unique_ptr
<
ProcessLib
::
AbstractJacobianAssembler
>&&
jacobian_assembler
,
std
::
vector
<
ProcessVariable
>
const
&
variables
,
std
::
vector
<
std
::
unique_ptr
<
ParameterLib
::
ParameterBase
>>
const
&
parameters
,
boost
::
optional
<
ParameterLib
::
CoordinateSystem
>
const
&
local_coordinate_system
,
unsigned
const
integration_order
,
BaseLib
::
ConfigTree
const
&
config
,
std
::
map
<
int
,
std
::
shared_ptr
<
MaterialPropertyLib
::
Medium
>>
const
&
media
);
}
// namespace ThermoRichardsMechanics
}
// namespace ProcessLib
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment