8000 Mechanics Process by endJunction · Pull Request #1340 · ufz/ogs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Mechanics Process #1340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Applications/ApplicationsLib/ProjectData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "ProcessLib/UncoupledProcessesTimeLoop.h"

#include "ProcessLib/GroundwaterFlow/CreateGroundwaterFlowProcess.h"
#include "ProcessLib/SmallDeformation/CreateSmallDeformationProcess.h"
#include "ProcessLib/TES/CreateTESProcess.h"
#include "ProcessLib/HeatConduction/CreateHeatConductionProcess.h"

Expand Down Expand Up @@ -269,6 +270,28 @@ void ProjectData::parseProcesses(BaseLib::ConfigTree const& processes_config)
process = ProcessLib::HeatConduction::createHeatConductionProcess(
*_mesh_vec[0], _process_variables, _parameters, process_config);
}
else if (type == "SMALL_DEFORMATION")
{
switch (process_config.getConfigParameter<int>("dimension"))
{
case 2:
process = ProcessLib::SmallDeformation::
createSmallDeformationProcess<2>(
*_mesh_vec[0], _process_variables, _parameters,
process_config);
break;
case 3:
process = ProcessLib::SmallDeformation::
createSmallDeformationProcess<3>(
*_mesh_vec[0], _process_variables, _parameters,
process_config);
break;
default:
OGS_FATAL(
"SMALL_DEFORMATION process does not support "
"given dimension");
}
}
else
{
OGS_FATAL("Unknown process type: %s", type.c_str());
Expand Down
46 changes: 46 additions & 0 deletions Applications/CLI/Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,52 @@ if(NOT OGS_USE_MPI)
temperature_analytical.vtu line_60_heat_pcs_0_ts_405_t_31640625.000000.vtu Temperature_Analytical_1year temperature
)

# Mechanics; Small deformations, linear (SDL)
AddTest(
NAME Mechanics_SDL_square_1e0_displacementBC
PATH Mechanics/Linear
EXECUTABLE ogs
EXECUTABLE_ARGS square_1e0.prj
WRAPPER time
TESTER vtkdiff
ABSTOL 1e-16 RELTOL 1e-16
DIFF_DATA
square_1e0_expected_pcs_0_ts_4_t_1.000000.vtu square_1e0_pcs_0_ts_4_t_1.000000.vtu displacement displacement
)
AddTest(
NAME Mechanics_SDL_square_1e2_tractionBC
PATH Mechanics/Linear
EXECUTABLE ogs
EXECUTABLE_ARGS square_1e2.prj
WRAPPER time
TESTER vtkdiff
ABSTOL 1e-16 RELTOL 1e-16
DIFF_DATA
square_1e2_expected_pcs_0_ts_4_t_1.000000.vtu square_1e2_pcs_0_ts_4_t_1.000000.vtu displacement displacement
)
AddTest(
NAME LARGE_Mechanics_SDL_disc_with_hole
PATH Mechanics/Linear
EXECUTABLE ogs
EXECUTABLE_ARGS disc_with_hole.prj
WRAPPER time
TESTER vtkdiff
ABSTOL 1e-16 RELTOL 1e-16
DIFF_DATA
disc_with_hole_expected_pcs_0_ts_4_t_1.000000.vtu disc_with_hole_pcs_0_ts_4_t_1.000000.vtu displacement displacement
)
AddTest(
NAME LARGE_Mechanics_SDL_square_1e5_tractionBC
PATH Mechanics/Linear
EXECUTABLE ogs
EXECUTABLE_ARGS square_1e5.prj
WRAPPER time
TESTER vtkdiff
ABSTOL 1e-16 RELTOL 1e-16
DIFF_DATA
square_1e5_expected_pcs_0_ts_4_t_1.000000.vtu square_1e5_pcs_0_ts_4_t_1.000000.vtu displacement displacement
)

else()
# MPI groundwater flow tests
AddTest(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deformation process with linear kinematics.
Copy link
Collaborator
@chleh chleh Aug 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamics rather than kinematics? (since forces are involved.)
Or maybe just say, that it's for infinitesimal deformations?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linear kinematics implies small deformations.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Isotropic linear elastic material model.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Poisson's ratio of a linear elastic material.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Young's modulus of a linear elastic material.
F438
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The displacement vector field.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Displacement vector dimension. The displacement dimension must be equal to the mesh dimension.
49 changes: 49 additions & 0 deletions MaterialLib/SolidModels/CreateLinearElasticIsotropic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* \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
*
*/

#ifndef MATERIALLIB_SOLIDMODELS_CREATELINEARELASTICISOTROPIC_H_
#define MATERIALLIB_SOLIDMODELS_CREATELINEARELASTICISOTROPIC_H_

#include "ProcessLib/Utils/ProcessUtils.h" // required for findParameter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the circular dependency still exists here.

#include "LinearElasticIsotropic.h"

namespace Solids
{

template <int DisplacementDim>
std::unique_ptr<LinearElasticIsotropic<DisplacementDim>>
createLinearElasticIsotropic(
std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const& parameters,
BaseLib::ConfigTree const& config)
{
config.checkConfigParameter("type", "LinearElasticIsotropic");
DBUG("Create LinearElasticIsotropic material");

// Youngs modulus
auto& youngs_modulus = ProcessLib::findParameter<double>(
config, "youngs_modulus", parameters, 1);

DBUG("Use '%s' as youngs_modulus parameter.", youngs_modulus.name.c_str());

// Poissons ratio
auto& poissons_ratio = ProcessLib::findParameter<double>(
config, "poissons_ratio", parameters, 1);

DBUG("Use '%s' as poissons_ratio parameter.", poissons_ratio.name.c_str());

typename LinearElasticIsotropic<DisplacementDim>::MaterialProperties mp{
youngs_modulus, poissons_ratio};

return std::unique_ptr<LinearElasticIsotropic<DisplacementDim>>{
new LinearElasticIsotropic<DisplacementDim>{mp}};
}

} // namespace Solids

#endif // MATERIALLIB_SOLIDMODELS_CREATELINEARELASTICISOTROPIC_H_
19 changes: 19 additions & 0 deletions MaterialLib/SolidModels/LinearElasticIsotropic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* \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 "LinearElasticIsotropic.h"

namespace Solids
{

template class LinearElasticIsotropic<2>;
template class LinearElasticIsotropic<3>;


} // namespace Solids
112 changes: 112 additions & 0 deletions MaterialLib/SolidModels/LinearElasticIsotropic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/**
* \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
*
*/

#ifndef MATERIALLIB_SOLIDMODELS_LINEARELASTICISOTROPIC_H_
#define MATERIALLIB_SOLIDMODELS_LINEARELASTICISOTROPIC_H_

#include "MechanicsBase.h"

namespace Solids
{
template <int DisplacementDim>
class LinearElasticIsotropic final : public MechanicsBase<DisplacementDim>
{
public:
/// Variables specific to the material model
class MaterialProperties
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Maybe nested classes shouldn't become the default way of grouping things together.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For discussion... Can be created from different configs with same result. Are shared as a single quantity between the local assemblers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. The suggestion was to make a not nested class LinearElasticIsotropicMaterialProperties (or something with shorter name).

{
using P = ProcessLib::Parameter<double>;
using X = ProcessLib::SpatialPosition;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: I'd prefer to omit these aliases.


public:
MaterialProperties(P const& youngs_modulus, P const& poissons_ratio)
: _youngs_modulus(youngs_modulus), _poissons_ratio(poissons_ratio)
{
}

/// Lamé's first parameter.
double lambda(double const t, X const& x) const
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense to pass time? i can't imagine a case lambda needs this.

Co 3D11 py link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just the interface of Parameter class. Would be writing 0 instead of time otherwise, but that is even more questionable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document it as 'Lame parameter', or change the function name to lame_parameter.

{
return _youngs_modulus(t, x)[0] * _poissons_ratio(t, x)[0] /
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remark for future optimisation: if parameter(t, x) is expensive, we need to find a way to minimize the number of calling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple one: One could simply pass lambda and mu as already computed parameters. Young's modulus and Poisson's ratio are now in the config because these are readily available quantities.

Simplifying such expressions of Parameters would require a (JIT) compiler.

(1 + _poissons_ratio(t, x)[0]) /
(1 - 2 * _poissons_ratio(t, x)[0]);
}

/// Lamé's second parameter, the shear modulus.
double mu(double const t, X const& x) const
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shear modulus.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd only document both lambda and mu as Lame parameter, don't rename one to firstLameParameter and the other to shearModulus. OK?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentations for the two parameter are OK (Especially for mu, the second Lame parameter, known as shear modulus in the physical meaning),

{
return _youngs_modulus(t, x)[0] /
(2 * (1 + _poissons_ratio(t, x)[0]));
}

private:
P const& _youngs_modulus;
P const& _poissons_ratio;
};

struct MaterialStateVariables
: public MechanicsBase<DisplacementDim>::MaterialStateVariables
{
void pushBackState() {}
};

std::unique_ptr<
typename MechanicsBase<DisplacementDim>::MaterialStateVariables>
createMaterialStateVariables() override
{
return std::unique_ptr<
typename MechanicsBase<DisplacementDim>::MaterialStateVariables>{
new MaterialStateVariables};
}

public:
static int const KelvinVectorSize =
ProcessLib::KelvinVectorDimensions<DisplacementDim>::value;
using KelvinVector = ProcessLib::KelvinVectorType<DisplacementDim>;
using KelvinMatrix = ProcessLib::KelvinMatrixType<DisplacementDim>;

explicit LinearElasticIsotropic(
MaterialProperties const& material_properties)
: _mp(material_properties)
{
}

void computeConstitutiveRelation(
double const t,
ProcessLib::SpatialPosition const& x,
double const /*dt*/,
KelvinVector const& eps_prev,
KelvinVector const& eps,
KelvinVector const& sigma_prev,
KelvinVector& sigma,
KelvinMatrix& C,
typename MechanicsBase<DisplacementDim>::MaterialStateVariables&
/*material_state_variables*/) override
{
C.setZero();

C.template topLeftCorner<3, 3>().setConstant(_mp.lambda(t, x));
C.noalias() += 2 * _mp.mu(t, x) * KelvinMatrix::Identity();

sigma.noalias() = sigma_prev + C * (eps - eps_prev);
}

private:
MaterialProperties _mp;
};

} // namespace Solids

namespace Solids
{
extern template class LinearElasticIsotropic<2>;
extern template class LinearElasticIsotropic<3>;
} // namespace Solids

#endif // MATERIALLIB_SOLIDMODELS_LINEARELASTICISOTROPIC_H_
110 changes: 110 additions & 0 deletions MaterialLib/SolidModels/MechanicsBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* \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
*
*/

#ifndef MATERIALLIB_SOLIDMODELS_MECHANICSBASE_H_
#define MATERIALLIB_SOLIDMODELS_MECHANICSBASE_H_

#include <memory>

#include "ProcessLib/Deformation/BMatrixPolicy.h"
#include "ProcessLib/Parameter/Parameter.h"

namespace MeshLib
{
class Element;
}

namespace Solids
{
/// Interface for mechanical solid material models. Provides updates of the
/// stress for a given current state and also a tangent at that position. If the
/// implemented material model stores an internal state, the nested
/// MaterialStateVariables class should be used; it's only responsibility is to
/// provide state's push back possibility.
template <int DisplacementDim>
struct MechanicsBase
{
/// The MaterialStateVariables may store material model specific state
/// (other than sigma and eps), which are usually material history
/// dependent. The objects are stored by the user (usually in assembly per
/// integration point) and are created via \ref
/// createMaterialStateVariables().
struct MaterialStateVariables
{
virtual ~MaterialStateVariables() = default;
virtual void pushBackState() = 0;
};

/// Polymorphic creator for MaterialStateVariables objects specific for a
/// material model.
virtual std::unique_ptr<MaterialStateVariables>
createMaterialStateVariables() = 0;

using KelvinVector = ProcessLib::KelvinVectorType<DisplacementDim>;
using KelvinMatrix = ProcessLib::KelvinMatrixType<DisplacementDim>;

/// Dynamic size Kelvin vector and matrix wrapper for the polymorphic
/// constitutive relation compute function.
void computeConstitutiveRelation(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please document this function

double const t,
ProcessLib::SpatialPosition const& x,
double const dt,
Eigen::Matrix<double, Eigen::Dynamic, 1> const& eps_prev,
Eigen::Matrix<double, Eigen::Dynamic, 1> const& eps,
Eigen::Matrix<double, Eigen::Dynamic, 1> const& sigma_prev,
Eigen::Matrix<double, Eigen::Dynamic, 1>& sigma,
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>&
C,
MaterialStateVariables& material_state_variables)
{
// TODO Avoid copies of data:
// Using MatrixBase<Derived> not possible because template functions
// cannot be virtual. Maybe there is a workaround for this. Using
// Map<Matrix<double, ...>> makes the interface (for the material model
// implementation) unnecessary difficult.
KelvinVector const eps_prev_{eps_prev};
KelvinVector const eps_{eps};
KelvinVector const sigma_prev_{sigma_prev};
KelvinVector sigma_{sigma};
KelvinMatrix C_{C};

computeConstitutiveRelation(t,
x,
dt,
eps_prev_,
eps_,
sigma_prev_,
sigma_,
C_,
material_state_variables);

sigma = sigma_;
C = C_;
}

/// Computation of the constitutive relation for specific material model.
/// This should be implemented in the derived model. Fixed Kelvin vector and
/// matrix size version; for dynamic size arguments there is an overloaded
/// wrapper function.
virtual void computeConstitutiveRelation(
double const t,
ProcessLib::SpatialPosition const& x,
double const dt,
KelvinVector const& eps_prev,
KelvinVector const& eps,
KelvinVector const& sigma_prev,
KelvinVector& sigma,
KelvinMatrix& C,
MaterialStateVariables& material_state_variables) = 0;

virtual ~MechanicsBase() = default;
};
}

#endif // MATERIALLIB_SOLIDMODELS_MECHANICSBASE_H_
Loading
0