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

Classes

struct  BlockData
 
struct  OpGetScale
 
struct  OpJacobian
 
struct  OpSpatialPhysical
 
struct  OpSpatialPhysical_du_du
 
struct  OpSpatialPhysicalExternalStrain
 

Public Member Functions

 HMHNeohookean (MoFEM::Interface &m_field, const double c10, const double K)
 
auto getMaterialParameters (EntityHandle ent)
 
VolUserDataOperatorreturnOpSetScale (boost::shared_ptr< double > scale_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
 
UserDataOperatorreturnOpJacobian (const int tag, 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)
 
MoFEMErrorCode recordTape (const int tape, DTensor2Ptr *t_h_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)
 
- Public Member Functions inherited from EshelbianPlasticity::PhysicalEquations
 PhysicalEquations ()=delete
 
 PhysicalEquations (const int size_active, const int size_dependent)
 
virtual ~PhysicalEquations ()=default
 
virtual VolUserDataOperatorreturnOpCalculateEnergy (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< double > total_energy_ptr)
 
virtual VolUserDataOperatorreturnOpCalculateStretchFromStress (boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
 
virtual VolUserDataOperatorreturnOpCalculateVarStretchFromStress (boost::shared_ptr< DataAtIntegrationPts > data_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 ()
 

Static Public Member Functions

static double fun_neohookean (double c10, double v)
 Definition of Neo-hookean function.
 
static double fun_d_neohookean (double c10, double v)
 Definition of derivative of Neo-hookean function.
 
static double fun_neohookean_bulk (double K, double tr)
 Definition of axiator of Neo-hookean function.
 
static double fun_diff_neohookean_bulk (double K, double tr)
 Definition of derivative of axiator of Neo-hookean function.
 
- 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)
 

Static Public Attributes

static constexpr int numberOfActiveVariables = 9
 
static constexpr int numberOfDependentVariables = 9
 

Private Attributes

MoFEM::InterfacemField
 
double c10_default
 
double K_default
 
double alphaGradU
 
std::vector< BlockDatablockData
 
double eqScaling = 1.
 
PetscBool adolCOn = PETSC_FALSE
 
ATensor2 th
 
ATensor2 tF
 
adouble detF
 
ATensor2 tInvF
 
ATensor2 tCof
 
ATensor2 tP
 

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
 
- Public Attributes inherited from EshelbianPlasticity::PhysicalEquations
std::vector< doubleactiveVariables
 
std::vector< doubledependentVariablesPiola
 
std::vector< doubledependentVariablesPiolaDirevatives
 

Detailed Description

Definition at line 13 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 64 of file HMHNeohookean.cpp.

66 mField(m_field), c10_default(c10), K_default(K) {
67
68 CHK_THROW_MESSAGE(getOptions(), "get options failed");
70 "extract block data failed");
71
72#ifdef NEOHOOKEAN_SCALING
73 if (blockData.size()) {
74 double ave_K = 0;
75 for (auto b : blockData) {
76 ave_K += b.K;
77 }
78 eqScaling = ave_K / blockData.size();
79 }
80#endif
81
82 MOFEM_LOG("EP", Sev::inform) << "Neo-Hookean scaling = " << eqScaling;
83
84 if (adolCOn == PETSC_FALSE) {
87 "Stretch selector is not equal to LOG");
88 } else {
89 if (EshelbianCore::exponentBase != exp(1)) {
91 "Exponent base is not equal to exp(1)");
92 }
93 }
94 }
95 }
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MOFEM_LOG(channel, severity)
Log.
static enum StretchSelector stretchSelector
std::vector< BlockData > blockData
MoFEMErrorCode extractBlockData(Sev sev)
static constexpr int numberOfDependentVariables
static constexpr int numberOfActiveVariables

Member Function Documentation

◆ extractBlockData() [1/2]

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

Definition at line 186 of file HMHNeohookean.cpp.

186 {
187 return extractBlockData(
188
189 mField.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
190
191 (boost::format("%s(.*)") % "MAT_NEOHOOKEAN").str()
192
193 )),
194
195 sev);
196 }
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 199 of file HMHNeohookean.cpp.

200 {
202
203 for (auto m : meshset_vec_ptr) {
204 MOFEM_LOG("EP", sev) << *m;
205 std::vector<double> block_data;
206 CHKERR m->getAttributes(block_data);
207 if (block_data.size() < 2) {
208 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
209 "Expected that block has atleast two attributes");
210 }
211 auto get_block_ents = [&]() {
212 Range ents;
213 CHKERR mField.get_moab().get_entities_by_handle(m->meshset, ents, true);
214 return ents;
215 };
216
217 double c10 = block_data[0];
218 double K = block_data[1];
219
220 blockData.push_back({c10, K, get_block_ents()});
221
222 MOFEM_LOG("EP", sev) << "MatBlock Neo-Hookean c10 = "
223 << blockData.back().c10
224 << " K = " << blockData.back().K << " nb ents. = "
225 << blockData.back().blockEnts.size();
226 }
228 }
#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.
FTensor::Index< 'm', 3 > m
virtual moab::Interface & get_moab()=0

◆ fun_d_neohookean()

static double EshelbianPlasticity::HMHNeohookean::fun_d_neohookean ( double c10,
double v )
inlinestatic

Definition of derivative of Neo-hookean function.

Parameters
c10
v
Returns
* double

Definition at line 33 of file HMHNeohookean.cpp.

33 {
34 return
35
36 (4.0 * c10) * EshelbianCore::d_f(2 * v);
37 }
const double v
phase velocity of light in medium (cm/ns)
static boost::function< double(const double)> d_f

◆ fun_diff_neohookean_bulk()

static double EshelbianPlasticity::HMHNeohookean::fun_diff_neohookean_bulk ( double K,
double tr )
inlinestatic

Definition of derivative of axiator of Neo-hookean function.

Parameters
K
tr
Returns
double

Definition at line 57 of file HMHNeohookean.cpp.

57 {
58 return K;
59 }

◆ fun_neohookean()

static double EshelbianPlasticity::HMHNeohookean::fun_neohookean ( double c10,
double v )
inlinestatic

Definition of Neo-hookean function.

Parameters
c10
v
Returns
double

Definition at line 22 of file HMHNeohookean.cpp.

22 {
23 return (2.0 * c10) * (-1. + EshelbianCore::f(2 * v));
24 }
static boost::function< double(const double)> f

◆ fun_neohookean_bulk()

static double EshelbianPlasticity::HMHNeohookean::fun_neohookean_bulk ( double K,
double tr )
inlinestatic

Definition of axiator of Neo-hookean function.

Parameters
c10
v
Returns
double

Definition at line 46 of file HMHNeohookean.cpp.

46 {
47 return K * tr; // K*ln(J)^2
48 }

◆ getMaterialParameters()

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

Definition at line 97 of file HMHNeohookean.cpp.

97 {
98 for (auto &b : blockData) {
99 if (b.blockEnts.find(ent) != b.blockEnts.end()) {
100 return std::make_pair(b.c10, b.K);
101 }
102 }
103 if (blockData.size() != 0)
105 "Block not found for entity handle. If you mat set "
106 "block, set it to all elements");
107 return std::make_pair(c10_default, K_default);
108 }

◆ getOptions()

MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::getOptions ( )
inline

Definition at line 155 of file HMHNeohookean.cpp.

155 {
157 PetscOptionsBegin(PETSC_COMM_WORLD, "neo_hookean_", "", "none");
158
159 c10_default = 1;
160 CHKERR PetscOptionsScalar("-c10", "C10", "", c10_default, &c10_default,
161 PETSC_NULLPTR);
162 K_default = 1;
163 CHKERR PetscOptionsScalar("-K", "Bulk modulus K", "", K_default, &K_default,
164 PETSC_NULLPTR);
165
166 alphaGradU = 0;
167 CHKERR PetscOptionsScalar("-viscosity_alpha_grad_u", "viscosity", "",
168 alphaGradU, &alphaGradU, PETSC_NULLPTR);
169
170 CHKERR PetscOptionsBool("-adolc_on", "adolc ON", "", adolCOn, &adolCOn,
171 PETSC_NULLPTR);
172
173 PetscOptionsEnd();
174
175 MOFEM_LOG_CHANNEL("WORLD");
176 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock Neo-Hookean (default)")
177 << "c10 = " << c10_default << " K = " << K_default
178 << " grad alpha u = " << alphaGradU;
179 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock Neo-Hookean (default)")
180 << "ADOL-C On " << (adolCOn)
181 ? "Yes"
182 : "No";
184 }
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.

◆ recordTape()

MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::recordTape ( const int tape,
DTensor2Ptr * t_h_ptr )
inlinevirtual

Implements EshelbianPlasticity::PhysicalEquations.

Definition at line 230 of file HMHNeohookean.cpp.

230 {
232
233 FTENSOR_INDEX(3, i);
234 FTENSOR_INDEX(3, j);
235 FTENSOR_INDEX(3, I);
236 FTENSOR_INDEX(3, J);
237
238 auto large = [&]() {
240
241 constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
242
243 auto ih = get_h();
244 if (t_h_ptr)
245 ih(i, j) = (*t_h_ptr)(i, j);
246 else {
247 ih(i, j) = t_kd(i, j);
248 }
249
250 auto r_P = get_P();
251
252 enableMinMaxUsingAbs();
253 trace_on(tape);
254
255 // Set active variables to ADOL-C
256 th(i, j) <<= get_h()(i, j);
257
258 tF(i, I) = th(i, I);
261
262 tCof(i, I) = detF * tInvF(I, i);
263
264 tP(i, I) = 2. * c10_default * (tF(i, I) - tInvF(i, I)) +
265 K_default * log(detF) * tCof(i, I);
266
267 // Set dependent variables to ADOL-C
268 tP(i, j) >>= r_P(i, j);
269
270 trace_off();
271
273 };
274
277 case LARGE_ROT:
278 case MODERATE_ROT:
279 CHKERR large();
280 break;
281 default:
282 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
283 "gradApproximator not handled");
284 };
285
287 }
#define FTENSOR_INDEX(DIM, I)
Kronecker Delta class.
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
FTensor::Index< 'j', 3 > j
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
MoFEMErrorCode determinantTensor3by3(T1 &t, T2 &det)
Calculate determinant 3 by 3.
constexpr IntegrationType I

◆ returnOpJacobian()

UserDataOperator * EshelbianPlasticity::HMHNeohookean::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 144 of file HMHNeohookean.cpp.

146 {
147 if (adolCOn) {
148 return PhysicalEquations::returnOpJacobian(tag, eval_rhs, eval_lhs,
149 data_ptr, physics_ptr);
150 } else {
151 return (new OpJacobian(tag, eval_rhs, eval_lhs, data_ptr, physics_ptr));
152 }
153 }
virtual UserDataOperator * returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)

◆ returnOpSetScale()

VolUserDataOperator * EshelbianPlasticity::HMHNeohookean::returnOpSetScale ( boost::shared_ptr< double > scale_ptr,
boost::shared_ptr< PhysicalEquations > physics_ptr )
inlinevirtual

Reimplemented from EshelbianPlasticity::PhysicalEquations.

Definition at line 131 of file HMHNeohookean.cpp.

132 {
133
134 return new OpGetScale(scale_ptr, physics_ptr);
135 };

◆ 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 302 of file HMHNeohookean.cpp.

304 {
305 if (adolCOn) {
307 alpha_u);
308 } else {
309 return new OpSpatialPhysical(field_name, data_ptr, alpha_u);
310 }
311 }
constexpr auto field_name
virtual VolUserDataOperator * returnOpSpatialPhysical(const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha_u)

◆ 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 347 of file HMHNeohookean.cpp.

349 {
350 if (adolCOn) {
352 row_field, col_field, data_ptr, alpha);
353 } else {
354 return new OpSpatialPhysical_du_du(row_field, col_field, data_ptr, alpha);
355 }
356 }
virtual VolUserDataOperator * returnOpSpatialPhysical_du_du(std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha)

◆ 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 328 of file HMHNeohookean.cpp.

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

Member Data Documentation

◆ adolCOn

PetscBool EshelbianPlasticity::HMHNeohookean::adolCOn = PETSC_FALSE
private

Definition at line 374 of file HMHNeohookean.cpp.

◆ alphaGradU

double EshelbianPlasticity::HMHNeohookean::alphaGradU
private

Definition at line 363 of file HMHNeohookean.cpp.

◆ blockData

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

Definition at line 369 of file HMHNeohookean.cpp.

◆ c10_default

double EshelbianPlasticity::HMHNeohookean::c10_default
private

Definition at line 361 of file HMHNeohookean.cpp.

◆ detF

adouble EshelbianPlasticity::HMHNeohookean::detF
private

Definition at line 378 of file HMHNeohookean.cpp.

◆ eqScaling

double EshelbianPlasticity::HMHNeohookean::eqScaling = 1.
private

Definition at line 371 of file HMHNeohookean.cpp.

◆ K_default

double EshelbianPlasticity::HMHNeohookean::K_default
private

Definition at line 362 of file HMHNeohookean.cpp.

◆ mField

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

Definition at line 359 of file HMHNeohookean.cpp.

◆ numberOfActiveVariables

int EshelbianPlasticity::HMHNeohookean::numberOfActiveVariables = 9
staticconstexpr

Definition at line 61 of file HMHNeohookean.cpp.

◆ numberOfDependentVariables

int EshelbianPlasticity::HMHNeohookean::numberOfDependentVariables = 9
staticconstexpr

Definition at line 62 of file HMHNeohookean.cpp.

◆ tCof

ATensor2 EshelbianPlasticity::HMHNeohookean::tCof
private

Definition at line 380 of file HMHNeohookean.cpp.

◆ tF

ATensor2 EshelbianPlasticity::HMHNeohookean::tF
private

Definition at line 377 of file HMHNeohookean.cpp.

◆ th

ATensor2 EshelbianPlasticity::HMHNeohookean::th
private

Definition at line 376 of file HMHNeohookean.cpp.

◆ tInvF

ATensor2 EshelbianPlasticity::HMHNeohookean::tInvF
private

Definition at line 379 of file HMHNeohookean.cpp.

◆ tP

ATensor2 EshelbianPlasticity::HMHNeohookean::tP
private

Definition at line 381 of file HMHNeohookean.cpp.


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