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  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)
 
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)
 
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 ()=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 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)
 

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.
 

Private Attributes

MoFEM::InterfacemField
 
double c10_default
 
double K_default
 
double alphaGradU
 
std::vector< BlockDatablockData
 
double eqScaling = 1.
 

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

69 : PhysicalEquations(), mField(m_field), c10_default(c10),
70 K_default(K) {
71
72 CHK_THROW_MESSAGE(getOptions(), "get options failed");
74 "extract block data failed");
75
76#ifdef NEOHOOKEAN_SCALING
77 if (blockData.size()) {
78 double ave_K = 0;
79 for (auto b : blockData) {
80 ave_K += b.K;
81 }
82 eqScaling = ave_K / blockData.size();
83 }
84#endif
85
86 MOFEM_LOG("EP", Sev::inform) << "Neo-Hookean scaling = " << eqScaling;
87
90 "Stretch selector is not equal to LOG");
91 } else {
92 if (EshelbianCore::exponentBase != exp(1)) {
94 "Exponent base is not equal to exp(1)");
95 }
96 }
97 }
#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
static double exponentBase
std::vector< BlockData > blockData
MoFEMErrorCode extractBlockData(Sev sev)

Member Function Documentation

◆ extractBlockData() [1/2]

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

Definition at line 149 of file HMHNeohookean.cpp.

149 {
150 return extractBlockData(
151
152 mField.getInterface<MeshsetsManager>()->getCubitMeshsetPtr(std::regex(
153
154 (boost::format("%s(.*)") % "MAT_NEOHOOKEAN").str()
155
156 )),
157
158 sev);
159 }
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 162 of file HMHNeohookean.cpp.

163 {
165
166 for (auto m : meshset_vec_ptr) {
167 MOFEM_LOG("EP", sev) << *m;
168 std::vector<double> block_data;
169 CHKERR m->getAttributes(block_data);
170 if (block_data.size() < 2) {
171 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
172 "Expected that block has atleast two attributes");
173 }
174 auto get_block_ents = [&]() {
175 Range ents;
176 CHKERR mField.get_moab().get_entities_by_handle(m->meshset, ents, true);
177 return ents;
178 };
179
180 double c10 = block_data[0];
181 double K = block_data[1];
182
183 blockData.push_back({c10, K, get_block_ents()});
184
185 MOFEM_LOG("EP", sev) << "MatBlock Neo-Hookean c10 = "
186 << blockData.back().c10
187 << " K = " << blockData.back().K << " nb ents. = "
188 << blockData.back().blockEnts.size();
189 }
191 }
#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 38 of file HMHNeohookean.cpp.

38 {
39 return
40
41 (4.0 * c10) * EshelbianCore::d_f(2 * v);
42 }
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 64 of file HMHNeohookean.cpp.

64 {
65 return K;//K * exp(tr) * (1. + tr); // K*2*ln(J)/J
66 }

◆ fun_neohookean()

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

Definition of Neo-hookean function.

P(i, I) = 2. * c10_default * (tF(i, I) - tInvF(i, I)) + K_default * log(detF) * tInvF(i, I) tCof(i, I) = detF * tInvF(I, i) Psi = c10* (trace(tCof) + 2ln(det(F)) - 3) + (K/2.) * (log(detF))^2

Parameters
c10
v
Returns
double

Definition at line 27 of file HMHNeohookean.cpp.

27 {
28 return (2.0 * c10) * (-1. + EshelbianCore::f(2 * v));
29 }
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.

Psi = (K/2.) * (log(J))^2 = (K/2.) * (log(exp tr H))^2 = (K/2.) * (tr H)^2

Parameters
c10
v
Returns
double

Definition at line 53 of file HMHNeohookean.cpp.

53 {
54 return K * tr;
55 }

◆ getMaterialParameters()

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

Definition at line 99 of file HMHNeohookean.cpp.

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

◆ getOptions()

MoFEMErrorCode EshelbianPlasticity::HMHNeohookean::getOptions ( )
inline

Definition at line 125 of file HMHNeohookean.cpp.

125 {
127 PetscOptionsBegin(PETSC_COMM_WORLD, "neo_hookean_", "", "none");
128
129 c10_default = 1;
130 CHKERR PetscOptionsScalar("-c10", "C10", "", c10_default, &c10_default,
131 PETSC_NULLPTR);
132 K_default = 1;
133 CHKERR PetscOptionsScalar("-K", "Bulk modulus K", "", K_default, &K_default,
134 PETSC_NULLPTR);
135
136 alphaGradU = 0;
137 CHKERR PetscOptionsScalar("-viscosity_alpha_grad_u", "viscosity", "",
138 alphaGradU, &alphaGradU, PETSC_NULLPTR);
139
140 PetscOptionsEnd();
141
142 MOFEM_LOG_CHANNEL("WORLD");
143 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock Neo-Hookean (default)")
144 << "c10 = " << c10_default << " K = " << K_default
145 << " grad alpha u = " << alphaGradU;
147 }
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.

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

121 {
122 return (new OpJacobian(eval_rhs, eval_lhs, data_ptr, physics_ptr));
123 }

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

208 {
209 return new OpSpatialPhysical(field_name, data_ptr, alpha_u);
210 }
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 248 of file HMHNeohookean.cpp.

250 {
251 return new OpSpatialPhysical_du_du(row_field, col_field, data_ptr, alpha);
252 }

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

231 {
232 return new OpSpatialPhysicalExternalStrain(field_name, data_ptr,
233 external_strain_vec_ptr, smv);
234 }

Member Data Documentation

◆ alphaGradU

double EshelbianPlasticity::HMHNeohookean::alphaGradU
private

Definition at line 259 of file HMHNeohookean.cpp.

◆ blockData

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

Definition at line 265 of file HMHNeohookean.cpp.

◆ c10_default

double EshelbianPlasticity::HMHNeohookean::c10_default
private

Definition at line 257 of file HMHNeohookean.cpp.

◆ eqScaling

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

Definition at line 267 of file HMHNeohookean.cpp.

◆ K_default

double EshelbianPlasticity::HMHNeohookean::K_default
private

Definition at line 258 of file HMHNeohookean.cpp.

◆ mField

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

Definition at line 255 of file HMHNeohookean.cpp.


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