28 PetscOptionsBegin(PETSC_COMM_WORLD,
"neo_hookean_",
"",
"none");
29 CHKERR PetscOptionsScalar(
"-c10",
"C10",
"",
C10, &
C10, PETSC_NULLPTR);
30 CHKERR PetscOptionsScalar(
"-K",
"Bulk modulus K",
"",
K, &
K,
34 std::string block_name =
"MAT_NEOHOOKEAN";
41 std::regex((boost::format(
"%s(.*)") % block_name).str()))
45 std::vector<double> block_data;
46 CHKERR m->getAttributes(block_data);
47 auto get_block_ents = [&]() {
50 m->meshset, ents,
true),
51 "can not get block entities");
56 m->getMeshsetId(), get_block_ents(),
63 "Command line Neohookean parameters")
64 <<
"C10 = " <<
C10 <<
" K = " <<
K;
72 int block_id,
const Range &block_entities,
73 const std::vector<double> &block_data)
override {
76 const auto json_params =
78 "MAT_NEOHOOKEAN", block_id);
79 if (!json_params.empty() && (json_params.size() != 2 ||
80 json_params.find(
"c10") == json_params.end() ||
81 json_params.find(
"k") == json_params.end())) {
83 "Neohookean JSON block %s needs exactly C10 and K attributes",
87 if (block_data.size() < 2) {
89 "Neohookean block %s has %d attributes; expected C10 and K",
90 block_name.c_str(),
static_cast<int>(block_data.size()));
92 std::vector<double> params = {block_data[0], block_data[1]};
97 << block_name <<
" C10 = " << params[0] <<
" K = " << params[1];
106 if (std::find(range.begin(), range.end(), ent) != range.end()) {
107 set_param_vec(
A::tAg, param_vec.size(), param_vec.data());
118 "Neohookean material parameters not found for entity %lu",
119 static_cast<unsigned long>(ent));
136 auto t_F = getFTensor2FromPtr<DIM, DIM>(
138 auto t_P = getFTensor2FromPtr<DIM, DIM>(
157 auto p_c10 = mkparam(
C10);
158 auto p_K = mkparam(
K);
160 ta_F(
i,
J) <<= t_F(
i,
J);
169 ta_P(
i,
I) = 2. * p_c10 * (ta_F(
i,
I) - ta_invF(
i,
I)) +
170 p_K * log(det_aF) * ta_invF(
i,
I);
172 ta_P(
i,
I) >>= t_P(
i,
I);
186boost::shared_ptr<PhysicalEquations>
188 boost::shared_ptr<MatOpsData> mat_ops_data_ptr,
int tag) {
189 return boost::make_shared<MatNeohookean<3>>(mat_ops_data_ptr, tag);
193boost::shared_ptr<PhysicalEquations>
195 boost::shared_ptr<MatOpsData> mat_ops_data_ptr,
int tag) {
196 return boost::make_shared<MatNeohookean<2>>(mat_ops_data_ptr, tag);
200boost::shared_ptr<PhysicalEquations>
202 boost::shared_ptr<MatOpsData> mat_ops_data_ptr,
int tag) {
203 return boost::make_shared<MatNeohookean<3>>(mat_ops_data_ptr, tag);
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define FTENSOR_INDEX(DIM, I)
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
#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(channel)
Set and reset channel.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
FTensor::Index< 'j', 3 > j
boost::shared_ptr< PhysicalEquations > createMatOpsPhysicalEquationsPtr< ELASTICITY::NEOHOOKEAN, MODEL_AXISYMMETRIC >(boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag)
boost::shared_ptr< PhysicalEquations > createMatOpsPhysicalEquationsPtr< ELASTICITY::NEOHOOKEAN, MODEL_3D >(boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag)
boost::shared_ptr< PhysicalEquations > createMatOpsPhysicalEquationsPtr< ELASTICITY::NEOHOOKEAN, MODEL_2D_PLANE_STRAIN >(boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
static MoFEMErrorCode invertTensor(FTensor::Tensor2< T1, DIM, DIM > &t, T2 &det, FTensor::Tensor2< T3, DIM, DIM > &inv_t)
static auto determinantTensor(FTensor::Tensor2< T, DIM, DIM > &t)
Calculate the determinant of a tensor of rank DIM.
constexpr IntegrationType I
FTensor::Index< 'm', 3 > m
static bool useDeformationGradient
MoFEMErrorCode recordTape() override
MoFEMErrorCode addBlockParameters(MoFEM::Interface &m_field, const std::string &block_name, int block_id, const Range &block_entities, const std::vector< double > &block_data) override
std::vector< double > commandLineParameters
MoFEMErrorCode setParams(FEMethod *fe_ptr, int gg) override
MoFEMErrorCode getOptions(MoFEM::Interface *m_field_ptr=nullptr) override
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
boost::shared_ptr< MatOpsData > matOpsDataPtr
Deprecated interface functions.
Structure for user loop methods on finite elements.
EntityHandle getFEEntityHandle() const
Get the entity handle of the current finite element.
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.