v0.15.0
Loading...
Searching...
No Matches
EshelbianPlasticity::HMHHencky Struct Reference
Inheritance diagram for EshelbianPlasticity::HMHHencky:
[legend]
Collaboration diagram for EshelbianPlasticity::HMHHencky:
[legend]

Classes

struct  BlockData
 
struct  OpCalculateEnergy
 Calculate energy density for Hencky material model. More...
 
struct  OpCalculateStretchFromStress
 
struct  OpHenckyJacobian
 
struct  OpSpatialPhysical
 
struct  OpSpatialPhysical_du_du
 
struct  OpSpatialPhysicalExternalStrain
 

Public Member Functions

 HMHHencky (MoFEM::Interface &m_field, const double E, const double nu)
 
MoFEMErrorCode recordTape (const int tag, DTensor2Ptr *t_h)
 
virtual UserDataOperatorreturnOpJacobian (const int tag, const bool eval_rhs, const bool eval_lhs, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
 
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)
 
VolUserDataOperatorreturnOpSpatialPhysical_du_du (std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha)
 
VolUserDataOperatorreturnOpCalculateEnergy (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< double > total_energy_ptr)
 
VolUserDataOperatorreturnOpCalculateStretchFromStress (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
 
VolUserDataOperatorreturnOpCalculateVarStretchFromStress (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
 
MoFEMErrorCode getOptions (boost::shared_ptr< DataAtIntegrationPts > data_ptr)
 
MoFEMErrorCode extractBlockData (Sev sev)
 
MoFEMErrorCode extractBlockData (std::vector< const CubitMeshSets * > meshset_vec_ptr, Sev sev)
 
MoFEMErrorCode getMatDPtr (boost::shared_ptr< MatrixDouble > mat_D_ptr, boost::shared_ptr< MatrixDouble > mat_axiator_D_ptr, boost::shared_ptr< MatrixDouble > mat_deviator_D_ptr, double bulk_modulus_K, double shear_modulus_G)
 
MoFEMErrorCode getInvMatDPtr (boost::shared_ptr< MatrixDouble > mat_inv_D_ptr, double bulk_modulus_K, double shear_modulus_G)
 
- Public Member Functions inherited from EshelbianPlasticity::PhysicalEquations
 PhysicalEquations ()=delete
 
 PhysicalEquations (const int size_active, const int size_dependent)
 
virtual ~PhysicalEquations ()=default
 
virtual VolUserDataOperatorreturnOpSetScale (boost::shared_ptr< double > scale_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
 
DTensor2Ptr get_P ()
 
DTensor3Ptr get_P_dh0 ()
 
DTensor3Ptr get_P_dh1 ()
 
DTensor3Ptr get_P_dh2 ()
 
DTensor2Ptr get_h ()
 

Private Attributes

MoFEM::InterfacemField
 
std::vector< BlockDatablockData
 
double E
 
double nu
 
Sev getOptionsSeverityLevels = Sev::inform
 

Additional Inherited Members

- Public Types inherited from EshelbianPlasticity::PhysicalEquations
typedef FTensor::Tensor1< adouble, 3 > ATensor1
 
typedef FTensor::Tensor2< adouble, 3, 3 > ATensor2
 
typedef FTensor::Tensor3< adouble, 3, 3, 3 > ATensor3
 
typedef FTensor::Tensor1< double, 3 > DTensor1
 
typedef FTensor::Tensor2< double, 3, 3 > DTensor2
 
typedef FTensor::Tensor3< double, 3, 3, 3 > DTensor3
 
typedef FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > DTensor0Ptr
 
typedef FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, 3, 3 > DTensor2Ptr
 
typedef FTensor::Tensor3< FTensor::PackPtr< double *, 1 >, 3, 3, 3 > DTensor3Ptr
 
- Static Public Member Functions inherited from EshelbianPlasticity::PhysicalEquations
template<int S>
static DTensor2Ptr get_VecTensor2 (std::vector< double > &v)
 
template<int S>
static DTensor0Ptr get_VecTensor0 (std::vector< double > &v)
 
template<int S0>
static DTensor3Ptr get_vecTensor3 (std::vector< double > &v, const int nba)
 
- Public Attributes inherited from EshelbianPlasticity::PhysicalEquations
std::vector< doubleactiveVariables
 
std::vector< doubledependentVariablesPiola
 
std::vector< doubledependentVariablesPiolaDirevatives
 

Detailed Description

Definition at line 12 of file HMHHencky.cpp.

Constructor & Destructor Documentation

◆ HMHHencky()

EshelbianPlasticity::HMHHencky::HMHHencky ( MoFEM::Interface & m_field,
const double E,
const double nu )
inline

Member Function Documentation

◆ extractBlockData() [1/2]

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

Definition at line 230 of file HMHHencky.cpp.

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

◆ extractBlockData() [2/2]

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

Definition at line 243 of file HMHHencky.cpp.

244 {
246
247 for (auto m : meshset_vec_ptr) {
248 MOFEM_TAG_AND_LOG("WORLD", sev, "MatBlock") << *m;
249 std::vector<double> block_data;
250 CHKERR m->getAttributes(block_data);
251 if (block_data.size() < 2) {
252 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
253 "Expected that block has atleast two attributes");
254 }
255 auto get_block_ents = [&]() {
256 Range ents;
257 CHKERR mField.get_moab().get_entities_by_handle(m->meshset, ents, true);
258 return ents;
259 };
260
261 double young_modulus = block_data[0];
262 double poisson_ratio = block_data[1];
263 double bulk_modulus_K = young_modulus / (3 * (1 - 2 * poisson_ratio));
264 double shear_modulus_G = young_modulus / (2 * (1 + poisson_ratio));
265
266 MOFEM_TAG_AND_LOG("WORLD", sev, "MatBlock")
267 << "E = " << young_modulus << " nu = " << poisson_ratio;
268
269 blockData.push_back({bulk_modulus_K, shear_modulus_G, get_block_ents()});
270 }
271 MOFEM_LOG_CHANNEL("WORLD");
273 }
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
double bulk_modulus_K
double shear_modulus_G
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
double young_modulus
Young modulus.
Definition plastic.cpp:125
double poisson_ratio
Poisson ratio.
Definition plastic.cpp:126
FTensor::Index< 'm', 3 > m
std::vector< BlockData > blockData
virtual moab::Interface & get_moab()=0

◆ getInvMatDPtr()

MoFEMErrorCode EshelbianPlasticity::HMHHencky::getInvMatDPtr ( boost::shared_ptr< MatrixDouble > mat_inv_D_ptr,
double bulk_modulus_K,
double shear_modulus_G )
inline

[Calculate elasticity tensor]

[Calculate elasticity tensor]

Definition at line 309 of file HMHHencky.cpp.

310 {
312 //! [Calculate elasticity tensor]
313 auto set_material_compilance = [&]() {
319 const double A = 1. / (2. * shear_modulus_G);
320 const double B =
321 (1. / (9. * bulk_modulus_K)) - (1. / (6. * shear_modulus_G));
322 auto t_inv_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
323 &*(mat_inv_D_ptr->data().begin()));
324 t_inv_D(i, j, k, l) =
325 A * ((t_kd(i, k) ^ t_kd(j, l)) / 4.) + B * t_kd(i, j) * t_kd(k, l);
326 };
327 //! [Calculate elasticity tensor]
328 constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2;
329 mat_inv_D_ptr->resize(size_symm, size_symm, false);
330 set_material_compilance();
332 }
#define FTENSOR_INDEX(DIM, I)
constexpr int SPACE_DIM
Kronecker Delta class symmetric.
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
static constexpr auto size_symm

◆ getMatDPtr()

MoFEMErrorCode EshelbianPlasticity::HMHHencky::getMatDPtr ( boost::shared_ptr< MatrixDouble > mat_D_ptr,
boost::shared_ptr< MatrixDouble > mat_axiator_D_ptr,
boost::shared_ptr< MatrixDouble > mat_deviator_D_ptr,
double bulk_modulus_K,
double shear_modulus_G )
inline

[Calculate elasticity tensor]

[Calculate elasticity tensor]

Definition at line 275 of file HMHHencky.cpp.

278 {
280 //! [Calculate elasticity tensor]
281 auto set_material_stiffness = [&]() {
287 auto t_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
288 &*(mat_D_ptr->data().begin()));
289 auto t_axiator_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
290 &*mat_axiator_D_ptr->data().begin());
291 auto t_deviator_D = getFTensor4DdgFromPtr<SPACE_DIM, SPACE_DIM, 0>(
292 &*mat_deviator_D_ptr->data().begin());
293 t_axiator_D(i, j, k, l) = (bulk_modulus_K - (2. / 3.) * shear_modulus_G) *
294 t_kd(i, j) * t_kd(k, l);
295 t_deviator_D(i, j, k, l) =
296 2 * shear_modulus_G * ((t_kd(i, k) ^ t_kd(j, l)) / 4.);
297 t_D(i, j, k, l) = t_axiator_D(i, j, k, l) + t_deviator_D(i, j, k, l);
298 };
299 //! [Calculate elasticity tensor]
300 constexpr auto size_symm = (SPACE_DIM * (SPACE_DIM + 1)) / 2;
301 mat_D_ptr->resize(size_symm, size_symm, false);
302 mat_axiator_D_ptr->resize(size_symm, size_symm, false);
303 mat_deviator_D_ptr->resize(size_symm, size_symm, false);
304 set_material_stiffness();
306 }

◆ getOptions()

MoFEMErrorCode EshelbianPlasticity::HMHHencky::getOptions ( boost::shared_ptr< DataAtIntegrationPts > data_ptr)
inline

Definition at line 210 of file HMHHencky.cpp.

210 {
212 PetscOptionsBegin(PETSC_COMM_WORLD, "hencky_", "", "none");
213
214 CHKERR PetscOptionsScalar("-young_modulus", "Young modulus", "", E, &E,
215 PETSC_NULLPTR);
216 CHKERR PetscOptionsScalar("-poisson_ratio", "poisson ratio", "", nu, &nu,
217 PETSC_NULLPTR);
218
219 PetscOptionsEnd();
220
222 << "Hencky: E = " << E << " nu = " << nu;
223 getOptionsSeverityLevels = Sev::verbose;
224
225 CHKERRG(ierr);
226
228 }
static PetscErrorCode ierr
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
#define MOFEM_LOG(channel, severity)
Log.

◆ recordTape()

MoFEMErrorCode EshelbianPlasticity::HMHHencky::recordTape ( const int tag,
DTensor2Ptr * t_h )
inlinevirtual

Implements EshelbianPlasticity::PhysicalEquations.

Definition at line 17 of file HMHHencky.cpp.

17{ return 0; }

◆ returnOpCalculateEnergy()

VolUserDataOperator * EshelbianPlasticity::HMHHencky::returnOpCalculateEnergy ( boost::shared_ptr< DataAtIntegrationPts > data_ptr,
boost::shared_ptr< double > total_energy_ptr )
inlinevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 172 of file HMHHencky.cpp.

173 {
174 return new OpCalculateEnergy(data_ptr, total_energy_ptr);
175 }

◆ returnOpCalculateStretchFromStress()

VolUserDataOperator * EshelbianPlasticity::HMHHencky::returnOpCalculateStretchFromStress ( boost::shared_ptr< DataAtIntegrationPts > data_ptr,
boost::shared_ptr< PhysicalEquations > physics_ptr )
inlinevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 193 of file HMHHencky.cpp.

195 {
196 return new OpCalculateStretchFromStress(
197 data_ptr, data_ptr->getLogStretchTensorAtPts(),
198 data_ptr->getApproxPAtPts(),
199 boost::dynamic_pointer_cast<HMHHencky>(physics_ptr));
200 }

◆ returnOpCalculateVarStretchFromStress()

VolUserDataOperator * EshelbianPlasticity::HMHHencky::returnOpCalculateVarStretchFromStress ( boost::shared_ptr< DataAtIntegrationPts > data_ptr,
boost::shared_ptr< PhysicalEquations > physics_ptr )
inlinevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 202 of file HMHHencky.cpp.

204 {
205 return new OpCalculateStretchFromStress(
206 data_ptr, data_ptr->getVarLogStreachPts(), data_ptr->getVarPiolaPts(),
207 boost::dynamic_pointer_cast<HMHHencky>(physics_ptr));
208 }

◆ returnOpJacobian()

virtual UserDataOperator * EshelbianPlasticity::HMHHencky::returnOpJacobian ( const int tag,
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 70 of file HMHHencky.cpp.

72 {
73 return (new OpHenckyJacobian(
74 data_ptr, boost::dynamic_pointer_cast<HMHHencky>(physics_ptr)));
75 }

◆ returnOpSpatialPhysical()

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

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 95 of file HMHHencky.cpp.

97 {
98 return new OpSpatialPhysical(field_name, data_ptr, alpha_u);
99 }
constexpr auto field_name

◆ returnOpSpatialPhysical_du_du()

VolUserDataOperator * EshelbianPlasticity::HMHHencky::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 141 of file HMHHencky.cpp.

143 {
144 return new OpSpatialPhysical_du_du(row_field, col_field, data_ptr, alpha);
145 }

◆ returnOpSpatialPhysicalExternalStrain()

virtual VolUserDataOperator * EshelbianPlasticity::HMHHencky::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 115 of file HMHHencky.cpp.

120 {
121 return new OpSpatialPhysicalExternalStrain(
122 field_name, data_ptr, external_strain_vec_ptr, smv);
123 }

Member Data Documentation

◆ blockData

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

Definition at line 342 of file HMHHencky.cpp.

◆ E

double EshelbianPlasticity::HMHHencky::E
private

Definition at line 344 of file HMHHencky.cpp.

◆ getOptionsSeverityLevels

Sev EshelbianPlasticity::HMHHencky::getOptionsSeverityLevels = Sev::inform
private

Definition at line 349 of file HMHHencky.cpp.

◆ mField

MoFEM::Interface& EshelbianPlasticity::HMHHencky::mField
private

Definition at line 335 of file HMHHencky.cpp.

◆ nu

double EshelbianPlasticity::HMHHencky::nu
private

Definition at line 345 of file HMHHencky.cpp.


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