-
Notifications
You must be signed in to change notification settings - Fork 239
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
Mechanics Process #1340
Changes from all commits
83860fd
77b246a
b0413d8
5d8c7fb
92aaf54
0ba099d
d98f6aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Deformation process with linear kinematics. | ||
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. |
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. |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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_ |
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 |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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] / | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remark for future optimisation: if parameter There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shear modulus. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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_ |
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( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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_ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.