v0.16.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
EshelbianPlasticity::HMHNeohookean Struct Reference
Inheritance diagram for EshelbianPlasticity::HMHNeohookean:
[legend]
Collaboration diagram for EshelbianPlasticity::HMHNeohookean:
[legend]

Classes

struct  BlockData
 
struct  CalculateStretchFromStress
 Recover the stretch tensor from a prescribed Biot stress. More...
 
struct  OpCalculateStretchFromStress
 
struct  OpJacobian
 
struct  OpSpatialPhysical
 
struct  OpSpatialPhysical_du_du
 
struct  OpSpatialPhysicalExternalStrain
 
struct  PrincipalState
 

Public Member Functions

 HMHNeohookean (MoFEM::Interface &m_field, const double c10, const double K)
 
auto getMaterialParameters (EntityHandle ent)
 
UserDataOperatorreturnOpJacobian (const bool eval_rhs, const bool eval_lhs, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
 
MoFEMErrorCode getOptions ()
 
MoFEMErrorCode extractBlockData (Sev sev)
 
MoFEMErrorCode extractBlockData (std::vector< const CubitMeshSets * > meshset_vec_ptr, Sev sev)
 
virtual VolUserDataOperatorreturnOpSpatialPhysical (const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha_u)
 
virtual VolUserDataOperatorreturnOpSpatialPhysicalExternalStrain (const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< ExternalStrainVec > external_strain_vec_ptr, std::map< std::string, boost::shared_ptr< ScalingMethod > > smv)
 
VolUserDataOperatorreturnOpCalculateExternalPressure (VectorPtr external_pressure_ptr, boost::shared_ptr< ExternalStrainVec > external_strain_vec_ptr, std::map< std::string, boost::shared_ptr< ScalingMethod > > smv) override
 
VolUserDataOperatorreturnOpSpatialPhysical_du_du (std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha)
 
VolUserDataOperatorreturnOpCalculateStretchFromStress (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr, boost::shared_ptr< MatrixDouble > strain_ptr) override
 
VolUserDataOperatorreturnOpCalculateStretchFromStress (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr, boost::shared_ptr< MatrixDouble > strain_ptr, VectorPtr external_pressure_ptr) override
 
- Public Member Functions inherited from EshelbianPlasticity::PhysicalEquations
 PhysicalEquations ()=default
 
virtual ~PhysicalEquations ()=default
 
virtual VolUserDataOperatorreturnOpTopoSpatialPhysical (const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, SmartPetscObj< Vec > assemble_vec, boost::shared_ptr< TopologicalData > topo_ptr, const double alpha_u, boost::shared_ptr< double > J_ptr)
 
virtual VolUserDataOperatorreturnOpCalculateEnergy (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< double > total_energy_ptr)
 
virtual VolUserDataOperatorreturnOpCalculateVarStretchFromStress (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
 

Static Public Member Functions

static double getShearModulus (const double c10)
 
static double getAbaqusD1 (const double K)
 
static MoFEMErrorCode getCoordinateStretchFromStretch (const double stretch, double &coordinate_stretch)
 
template<typename T >
static double getLogJacobian (T &principal_coordinate_stretches)
 
template<typename T >
static PrincipalState getPrincipalState (const double K, T &principal_coordinate_stretches)
 
static MoFEMErrorCode validatePrincipalState (const PrincipalState &state, const char *source)
 
static double getPrincipalCoordinateStress (const double c10, const PrincipalState &state, const double v)
 
static double getPrincipalCoordinateStressDerivativeAtFixedInvariants (const double c10, const PrincipalState &state, const double v)
 
template<typename T >
static double getStrainEnergy (const double c10, const double K, T &principal_coordinate_stretches)
 
static MoFEMErrorCode validateMaterialParameters (const double c10, const double K, const char *source)
 

Private Attributes

MoFEM::InterfacemField
 
double c10_default
 
double K_default
 
double alphaGradU
 
double lambdaMinU = 1e-4
 
double lambdaMaxU = 1e4
 
double betaStretchBoxMin = 1e-6
 
double betaStretchBoxMax = 1e-8
 
std::vector< BlockDatablockData
 

Detailed Description

Definition at line 39 of file HMHNeohookean.cpp.

Constructor & Destructor Documentation

◆ HMHNeohookean()

EshelbianPlasticity::HMHNeohookean::HMHNeohookean ( MoFEM::Interface m_field,
const double  c10,
const double  K 
)
inline

Definition at line 157 of file HMHNeohookean.cpp.

158 : PhysicalEquations(), mField(m_field), c10_default(c10), K_default(K) {
159
160 CHK_THROW_MESSAGE(getOptions(), "get options failed");
162 "extract block data failed");
163
166 }
167
170 "Neo-Hookean requires natural logarithmic stretch");
171 }
172 }
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
static enum StretchSelector stretchSelector
static enum StretchHandling stretchHandling
static bool isNoStretch()
MoFEMErrorCode extractBlockData(Sev sev)

Member Function Documentation

◆ extractBlockData() [1/2]

MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::extractBlockData ( Sev  sev)
inline

Definition at line 226 of file HMHNeohookean.cpp.

226 {
227 return extractBlockData(
228
229 mField.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
230
231 (boost::format("%s(.*)") % "MAT_NEOHOOKEAN").str()
232
233 )),
234
235 sev);
236 }
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ extractBlockData() [2/2]

MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::extractBlockData ( std::vector< const CubitMeshSets * >  meshset_vec_ptr,
Sev  sev 
)
inline

Definition at line 239 of file HMHNeohookean.cpp.

240 {
242
243 for (auto m : meshset_vec_ptr) {
244 MOFEM_LOG("EP", sev) << *m;
245 std::vector<double> block_data;
246 CHKERR m->getAttributes(block_data);
247 auto get_block_ents = [&]() {
248 Range ents;
249 CHKERR mField.get_moab().get_entities_by_handle(m->meshset, ents, true);
250 return ents;
251 };
252
253 const auto json_parameters =
254 mField.getInterface<JsonConfigManager>()->getParamsFromBlockset(
255 "MAT_NEOHOOKEAN", m->getMeshsetId());
256 double c10;
257 double K;
258 if (!json_parameters.empty()) {
259 if (json_parameters.size() != 2 ||
260 json_parameters.find("c10") == json_parameters.end() ||
261 json_parameters.find("k") == json_parameters.end()) {
262 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
263 "MAT_NEOHOOKEAN JSON block must have exactly two "
264 "attributes: c10, k");
265 }
266 c10 = json_parameters.at("c10");
267 K = json_parameters.at("k");
268 } else {
269 if (block_data.size() < 2) {
270 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
271 "MAT_NEOHOOKEAN block must have at least two attributes: "
272 "c10, K");
273 }
274 c10 = block_data[0];
275 K = block_data[1];
276 }
277
278 CHKERR validateMaterialParameters(c10, K, "MAT_NEOHOOKEAN block");
279
280 blockData.push_back({c10, K, get_block_ents()});
281
282 MOFEM_LOG("EP", sev) << "MatBlock Neo-Hookean c10 = "
283 << blockData.back().c10
284 << " K = " << blockData.back().K
285 << " mu = " << getShearModulus(c10)
286 << " Abaqus D1 = " << getAbaqusD1(K)
287 << " nb ents. = "
288 << blockData.back().blockEnts.size();
289 }
291 }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'm', 3 > m
static MoFEMErrorCode validateMaterialParameters(const double c10, const double K, const char *source)
static double getShearModulus(const double c10)
static double getAbaqusD1(const double K)
std::vector< BlockData > blockData
virtual moab::Interface & get_moab()=0

◆ getAbaqusD1()

static double EshelbianPlasticity::HMHNeohookean::getAbaqusD1 ( const double  K)
inlinestatic

Definition at line 48 of file HMHNeohookean.cpp.

48{ return 2. / K; }

◆ getCoordinateStretchFromStretch()

static MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::getCoordinateStretchFromStretch ( const double  stretch,
double coordinate_stretch 
)
inlinestatic

Definition at line 59 of file HMHNeohookean.cpp.

60 {
62 if (!std::isfinite(stretch) || stretch <= 0.) {
63 SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
64 "Abaqus Neo-Hookean stretch must be finite and positive");
65 }
66 coordinate_stretch = std::log(stretch);
67 if (!std::isfinite(coordinate_stretch)) {
68 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_FP,
69 "Non-finite Abaqus Neo-Hookean coordinate stretch");
70 }
72 }
@ MOFEM_INVALID_DATA
Definition definitions.h:36

◆ getLogJacobian()

template<typename T >
static double EshelbianPlasticity::HMHNeohookean::getLogJacobian ( T &  principal_coordinate_stretches)
inlinestatic

Definition at line 75 of file HMHNeohookean.cpp.

75 {
77 constexpr auto t_one = FTensor::One<>();
78 return principal_coordinate_stretches(i) * t_one(i);
79 }
#define FTENSOR_INDEX(DIM, I)
constexpr int SPACE_DIM
Stateless vector whose components are all equal to one.
Definition One.hpp:22
FTensor::Index< 'i', SPACE_DIM > i

◆ getMaterialParameters()

auto EshelbianPlasticity::HMHNeohookean::getMaterialParameters ( EntityHandle  ent)
inline

Definition at line 174 of file HMHNeohookean.cpp.

174 {
175 for (auto &b : blockData) {
176 if (b.blockEnts.find(ent) != b.blockEnts.end()) {
177 return std::make_pair(b.c10, b.K);
178 }
179 }
180 if (blockData.size() != 0)
182 "Block not found for entity handle. If you mat set "
183 "block, set it to all elements");
184 return std::make_pair(c10_default, K_default);
185 }

◆ getOptions()

MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::getOptions ( )
inline

Definition at line 200 of file HMHNeohookean.cpp.

200 {
202 PetscOptionsBegin(PETSC_COMM_WORLD, "neo_hookean_", "", "none");
203
204 CHKERR PetscOptionsScalar("-c10", "C10", "", c10_default, &c10_default,
205 PETSC_NULLPTR);
206 CHKERR PetscOptionsScalar("-K", "Bulk modulus K", "", K_default, &K_default,
207 PETSC_NULLPTR);
208
209 alphaGradU = 0;
210 CHKERR PetscOptionsScalar("-viscosity_alpha_grad_u", "viscosity", "",
211 alphaGradU, &alphaGradU, PETSC_NULLPTR);
212 PetscOptionsEnd();
213
215 "default options");
216
217 MOFEM_LOG_CHANNEL("WORLD");
218 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock Neo-Hookean (default)")
219 << " c10 = " << c10_default << " K = " << K_default
220 << " mu = " << getShearModulus(c10_default)
221 << " Abaqus D1 = " << getAbaqusD1(K_default)
222 << " grad alpha u = " << alphaGradU;
224 }
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.

◆ getPrincipalCoordinateStress()

static double EshelbianPlasticity::HMHNeohookean::getPrincipalCoordinateStress ( const double  c10,
const PrincipalState state,
const double  v 
)
inlinestatic

Definition at line 116 of file HMHNeohookean.cpp.

118 {
119 const double squared_stretch = std::exp(2. * v);
120 return getShearModulus(c10) * state.jacobianToMinusTwoThirds *
121 (squared_stretch - state.firstInvariant / 3.) +
122 state.volumetricStress;
123 }
const double v
phase velocity of light in medium (cm/ns)

◆ getPrincipalCoordinateStressDerivativeAtFixedInvariants()

static double EshelbianPlasticity::HMHNeohookean::getPrincipalCoordinateStressDerivativeAtFixedInvariants ( const double  c10,
const PrincipalState state,
const double  v 
)
inlinestatic

Definition at line 125 of file HMHNeohookean.cpp.

126 {
127 return 2. * getShearModulus(c10) * state.jacobianToMinusTwoThirds *
128 std::exp(2. * v);
129 }

◆ getPrincipalState()

template<typename T >
static PrincipalState EshelbianPlasticity::HMHNeohookean::getPrincipalState ( const double  K,
T &  principal_coordinate_stretches 
)
inlinestatic

Definition at line 83 of file HMHNeohookean.cpp.

83 {
85 constexpr auto t_one = FTensor::One<>();
86 const double log_jacobian = getLogJacobian(principal_coordinate_stretches);
87 const double jacobian = std::exp(log_jacobian);
88 const double jacobian_to_minus_two_thirds =
89 std::exp((-2. / 3.) * log_jacobian);
90 FTensor::Tensor1<double, SPACE_DIM> t_squared_stretches;
91 for (int aa = 0; aa != SPACE_DIM; ++aa) {
92 t_squared_stretches(aa) =
93 std::exp(2. * principal_coordinate_stretches(aa));
94 }
95 const double first_invariant = t_squared_stretches(i) * t_one(i);
96 return {jacobian, jacobian_to_minus_two_thirds, first_invariant,
97 K * jacobian * (jacobian - 1.),
98 K * jacobian * (2. * jacobian - 1.)};
99 }
static double getLogJacobian(T &principal_coordinate_stretches)

◆ getShearModulus()

static double EshelbianPlasticity::HMHNeohookean::getShearModulus ( const double  c10)
inlinestatic

Definition at line 46 of file HMHNeohookean.cpp.

46{ return 2. * c10; }

◆ getStrainEnergy()

template<typename T >
static double EshelbianPlasticity::HMHNeohookean::getStrainEnergy ( const double  c10,
const double  K,
T &  principal_coordinate_stretches 
)
inlinestatic

Definition at line 132 of file HMHNeohookean.cpp.

133 {
134 const auto state = getPrincipalState(K, principal_coordinate_stretches);
135 const double jacobian_minus_one = state.jacobian - 1.;
136 return c10 * (state.jacobianToMinusTwoThirds * state.firstInvariant - 3.) +
137 0.5 * K * jacobian_minus_one * jacobian_minus_one;
138 }
static PrincipalState getPrincipalState(const double K, T &principal_coordinate_stretches)

◆ returnOpCalculateExternalPressure()

VolUserDataOperator * EshelbianPlasticity::HMHNeohookean::returnOpCalculateExternalPressure ( VectorPtr  external_pressure_ptr,
boost::shared_ptr< ExternalStrainVec external_strain_vec_ptr,
std::map< std::string, boost::shared_ptr< ScalingMethod > >  smv 
)
inlineoverridevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 336 of file HMHNeohookean.cpp.

339 {
340 return new OpCalculateExternalPressure(std::move(external_pressure_ptr),
341 std::move(external_strain_vec_ptr),
342 std::move(smv));
343 }
Calculate q = 3 K_ext epsilon_ext at integration points.

◆ returnOpCalculateStretchFromStress() [1/2]

VolUserDataOperator * EshelbianPlasticity::HMHNeohookean::returnOpCalculateStretchFromStress ( boost::shared_ptr< DataAtIntegrationPts data_ptr,
boost::shared_ptr< PhysicalEquations physics_ptr,
boost::shared_ptr< MatrixDouble >  strain_ptr 
)
inlineoverridevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 449 of file HMHNeohookean.cpp.

452 {
453 return returnOpCalculateStretchFromStress(std::move(data_ptr),
454 std::move(physics_ptr),
455 std::move(strain_ptr), nullptr);
456 }
VolUserDataOperator * returnOpCalculateStretchFromStress(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr, boost::shared_ptr< MatrixDouble > strain_ptr) override

◆ returnOpCalculateStretchFromStress() [2/2]

VolUserDataOperator * EshelbianPlasticity::HMHNeohookean::returnOpCalculateStretchFromStress ( boost::shared_ptr< DataAtIntegrationPts data_ptr,
boost::shared_ptr< PhysicalEquations physics_ptr,
boost::shared_ptr< MatrixDouble >  strain_ptr,
VectorPtr  external_pressure_ptr 
)
inlineoverridevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 458 of file HMHNeohookean.cpp.

462 {
463 auto neohookean_ptr =
464 boost::dynamic_pointer_cast<HMHNeohookean>(physics_ptr);
465 if (!neohookean_ptr) {
467 "Pointer to HMHNeohookean is null");
468 }
469 return new OpCalculateStretchFromStress(
470 data_ptr,
471 strain_ptr ? strain_ptr : data_ptr->getLogStretchTensorAtPts(),
472 data_ptr->getApproxPAtPts(), neohookean_ptr,
473 std::move(external_pressure_ptr));
474 }

◆ returnOpJacobian()

UserDataOperator * EshelbianPlasticity::HMHNeohookean::returnOpJacobian ( const bool  eval_rhs,
const bool  eval_lhs,
boost::shared_ptr< DataAtIntegrationPts data_ptr,
boost::shared_ptr< PhysicalEquations physics_ptr 
)
inlinevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 194 of file HMHNeohookean.cpp.

196 {
197 return (new OpJacobian(eval_rhs, eval_lhs, data_ptr, physics_ptr));
198 }

◆ returnOpSpatialPhysical()

virtual VolUserDataOperator * EshelbianPlasticity::HMHNeohookean::returnOpSpatialPhysical ( const std::string &  field_name,
boost::shared_ptr< DataAtIntegrationPts data_ptr,
const double  alpha_u 
)
inlinevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 306 of file HMHNeohookean.cpp.

308 {
309 return new OpSpatialPhysical(field_name, data_ptr, alpha_u);
310 }
constexpr auto field_name

◆ returnOpSpatialPhysical_du_du()

VolUserDataOperator * EshelbianPlasticity::HMHNeohookean::returnOpSpatialPhysical_du_du ( std::string  row_field,
std::string  col_field,
boost::shared_ptr< DataAtIntegrationPts data_ptr,
const double  alpha 
)
inlinevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 357 of file HMHNeohookean.cpp.

359 {
360 return new OpSpatialPhysical_du_du(row_field, col_field, data_ptr, alpha);
361 }

◆ returnOpSpatialPhysicalExternalStrain()

virtual VolUserDataOperator * EshelbianPlasticity::HMHNeohookean::returnOpSpatialPhysicalExternalStrain ( const std::string &  field_name,
boost::shared_ptr< DataAtIntegrationPts data_ptr,
boost::shared_ptr< ExternalStrainVec external_strain_vec_ptr,
std::map< std::string, boost::shared_ptr< ScalingMethod > >  smv 
)
inlinevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 327 of file HMHNeohookean.cpp.

331 {
332 return new OpSpatialPhysicalExternalStrain(field_name, data_ptr,
333 external_strain_vec_ptr, smv);
334 }

◆ validateMaterialParameters()

static MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::validateMaterialParameters ( const double  c10,
const double  K,
const char *  source 
)
inlinestatic

Definition at line 140 of file HMHNeohookean.cpp.

142 {
144 if (!std::isfinite(c10) || c10 <= 0.) {
145 SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
146 "Neo-Hookean c10 must be finite and positive in %s", source);
147 }
148 if (!std::isfinite(K) || K <= 0.) {
149 SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
150 "Abaqus Neo-Hookean K must be finite and positive in %s "
151 "(received c10=%.16g, K=%.16g)",
152 source, c10, K);
153 }
155 }

◆ validatePrincipalState()

static MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::validatePrincipalState ( const PrincipalState state,
const char *  source 
)
inlinestatic

Definition at line 101 of file HMHNeohookean.cpp.

102 {
104 if (!std::isfinite(state.jacobian) || state.jacobian <= 0. ||
105 !std::isfinite(state.jacobianToMinusTwoThirds) ||
106 state.jacobianToMinusTwoThirds <= 0. ||
107 !std::isfinite(state.firstInvariant) || state.firstInvariant <= 0. ||
108 !std::isfinite(state.volumetricStress) ||
109 !std::isfinite(state.volumetricTangent)) {
110 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_FP,
111 "Non-finite Abaqus Neo-Hookean principal state in %s", source);
112 }
114 }

Member Data Documentation

◆ alphaGradU

double EshelbianPlasticity::HMHNeohookean::alphaGradU
private

Definition at line 481 of file HMHNeohookean.cpp.

◆ betaStretchBoxMax

double EshelbianPlasticity::HMHNeohookean::betaStretchBoxMax = 1e-8
private

Definition at line 485 of file HMHNeohookean.cpp.

◆ betaStretchBoxMin

double EshelbianPlasticity::HMHNeohookean::betaStretchBoxMin = 1e-6
private

Definition at line 484 of file HMHNeohookean.cpp.

◆ blockData

std::vector<BlockData> EshelbianPlasticity::HMHNeohookean::blockData
private

Definition at line 491 of file HMHNeohookean.cpp.

◆ c10_default

double EshelbianPlasticity::HMHNeohookean::c10_default
private

Definition at line 479 of file HMHNeohookean.cpp.

◆ K_default

double EshelbianPlasticity::HMHNeohookean::K_default
private

Definition at line 480 of file HMHNeohookean.cpp.

◆ lambdaMaxU

double EshelbianPlasticity::HMHNeohookean::lambdaMaxU = 1e4
private

Definition at line 483 of file HMHNeohookean.cpp.

◆ lambdaMinU

double EshelbianPlasticity::HMHNeohookean::lambdaMinU = 1e-4
private

Definition at line 482 of file HMHNeohookean.cpp.

◆ mField

MoFEM::Interface& EshelbianPlasticity::HMHNeohookean::mField
private

Definition at line 477 of file HMHNeohookean.cpp.


The documentation for this struct was generated from the following file: