23constexpr auto A = AssemblyType::BLOCK_MAT;
25#ifndef __ESHELBIAN_PLASTICITY_HPP__
26 #define __ESHELBIAN_PLASTICITY_HPP__
28 #ifdef ENABLE_PYTHON_BINDING
29 #include <boost/python.hpp>
30 #include <boost/python/def.hpp>
31 #include <boost/python/numpy.hpp>
32namespace bp = boost::python;
33namespace np = boost::python::numpy;
52using EntData = EntitiesFieldData::EntData;
56using EleOnSide = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::FaceSideEle;
61struct AnalyticalExprPython;
64 :
public boost::enable_shared_from_this<DataAtIntegrationPts> {
151 return boost::shared_ptr<double>(shared_from_this(), &
piolaScale);
155 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
159 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
approxPAtPts);
163 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
divPAtPts);
167 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
gradPAtPts);
171 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
divSigmaAtPts);
175 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wL2AtPts);
179 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wL2DotAtPts);
183 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wL2DotDotAtPts);
187 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
192 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
197 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
202 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
207 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
rotAxisAtPts);
211 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
rotAxis0AtPts);
215 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
220 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
225 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
GAtPts);
229 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
GAtPts);
233 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
matD);
237 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
matInvD);
241 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
matAxiatorD);
245 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
matDeviatorD);
249 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wH1AtPts);
253 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
XH1AtPts);
257 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
contactL2AtPts);
261 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wGradH1AtPts);
265 return boost::shared_ptr<VectorDouble>(shared_from_this(), &
jacobianAtPts);
269 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
274 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varRotAxis);
278 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varLogStreach);
282 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varPiola);
286 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varDivPiola);
290 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varWL2);
294 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
299 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
facePiolaAtPts);
303 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
308 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
313 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
318 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
eigenVals);
354 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
355 boost::shared_ptr<PhysicalEquations> physics_ptr);
359 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
360 const double alpha_u);
365 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
366 boost::shared_ptr<ExternalStrainVec> external_strain_vec_ptr,
367 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv);
370 std::string row_field, std::string col_field,
371 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
const double alpha);
375 boost::shared_ptr<double> total_energy_ptr);
378 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
379 boost::shared_ptr<PhysicalEquations> physics_ptr);
382 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
383 boost::shared_ptr<PhysicalEquations> physics_ptr);
387 boost::shared_ptr<PhysicalEquations> physics_ptr);
400 &
v[S + 5], &
v[S + 6], &
v[S + 7], &
v[S + 8]);
412 const int A00 = nba * 0 + S0;
413 const int A01 = nba * 1 + S0;
414 const int A02 = nba * 2 + S0;
415 const int A10 = nba * 3 + S0;
416 const int A11 = nba * 4 + S0;
417 const int A12 = nba * 5 + S0;
418 const int A20 = nba * 6 + S0;
419 const int A21 = nba * 7 + S0;
420 const int A22 = nba * 8 + S0;
424 &
v[A00 + 0], &
v[A00 + 1], &
v[A00 + 2], &
v[A01 + 0], &
v[A01 + 1],
425 &
v[A01 + 2], &
v[A02 + 0], &
v[A02 + 1], &
v[A02 + 2],
427 &
v[A10 + 0], &
v[A10 + 1], &
v[A10 + 2], &
v[A11 + 0], &
v[A11 + 1],
428 &
v[A11 + 2], &
v[A12 + 0], &
v[A12 + 1], &
v[A12 + 2],
430 &
v[A20 + 0], &
v[A20 + 1], &
v[A20 + 2], &
v[A21 + 0], &
v[A21 + 1],
431 &
v[A21 + 2], &
v[A22 + 0], &
v[A22 + 1], &
v[A22 + 2]
546template <
typename OP_PTR>
547std::tuple<std::string, MatrixDouble>
549 const std::string block_name);
551template <
typename OP_PTR>
552std::tuple<std::string, VectorDouble>
554 const std::string block_name);
558 MatrixDouble &m_ref_coords,
559 MatrixDouble &m_ref_normals,
560 const std::string block_name);
565 MatrixDouble &m_ref_coords,
566 const std::string block_name);
568 #ifdef ENABLE_PYTHON_BINDING
569struct AnalyticalExprPython {
570 AnalyticalExprPython() =
default;
571 virtual ~AnalyticalExprPython() =
default;
573 MoFEMErrorCode analyticalExprInit(
const std::string py_file);
574 MoFEMErrorCode evalAnalyticalDisp(
double delta_t,
double t, np::ndarray x,
575 np::ndarray y, np::ndarray z,
576 np::ndarray nx, np::ndarray ny,
578 const std::string &block_name,
579 np::ndarray &analytical_expr);
580 MoFEMErrorCode evalAnalyticalTraction(
double delta_t,
double t, np::ndarray x,
581 np::ndarray y, np::ndarray z,
582 np::ndarray nx, np::ndarray ny,
584 const std::string &block_name,
585 np::ndarray &analytical_expr);
587 MoFEMErrorCode evalAnalyticalExternalStrain(
double delta_t,
double t,
588 np::ndarray x, np::ndarray y,
590 const std::string &block_name,
591 np::ndarray &analytical_expr);
592 template <
typename T>
593 inline std::vector<T>
594 py_list_to_std_vector(
const boost::python::object &iterable) {
595 return std::vector<T>(boost::python::stl_input_iterator<T>(iterable),
596 boost::python::stl_input_iterator<T>());
600 bp::object mainNamespace;
601 bp::object analyticalDispFun;
602 bp::object analyticalTractionFun;
603 bp::object analyticalExternalStrainFun;
606extern boost::weak_ptr<AnalyticalExprPython> AnalyticalExprPythonWeakPtr;
const double v
phase velocity of light in medium (cm/ns)
VectorDouble analytical_externalstrain_function(double delta_t, double t, int nb_gauss_pts, MatrixDouble &m_ref_coords, const std::string block_name)
boost::shared_ptr< MatrixDouble > MatrixPtr
std::vector< AnalyticalTractionBc > AnalyticalTractionBcVec
std::vector< TractionBc > TractionBcVec
std::tuple< std::string, VectorDouble > getAnalyticalExternalStrain(OP_PTR op_ptr, VectorDouble &analytical_expr, const std::string block_name)
std::vector< AnalyticalDisplacementBc > AnalyticalDisplacementBcVec
std::vector< PressureBc > PressureBcVec
std::tuple< std::string, MatrixDouble > getAnalyticalExpr(OP_PTR op_ptr, MatrixDouble &analytical_expr, const std::string block_name)
std::vector< Range > TractionFreeBc
std::vector< ExternalStrain > ExternalStrainVec
ForcesAndSourcesCore::UserDataOperator UserDataOperator
std::vector< BcRot > BcRotVec
std::vector< NormalDisplacementBc > NormalDisplacementBcVec
FaceElementForcesAndSourcesCore::UserDataOperator FaceUserDataOperator
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::FaceSideEle EleOnSide
MatrixDouble analytical_expr_function(double delta_t, double t, int nb_gauss_pts, MatrixDouble &m_ref_coords, MatrixDouble &m_ref_normals, const std::string block_name)
std::vector< BcDisp > BcDispVec
boost::shared_ptr< VectorDouble > VectorPtr
constexpr double t
plate stiffness
constexpr auto field_name
MatrixDouble approxSigmaAtPts
MatrixPtr getHybridDispAtPts()
MatrixDouble diffStretchTensorAtPts
MatrixPtr getBigG0AtPts()
MatrixPtr getLogStretchTensorAtPts()
VectorDouble normalPressureAtPts
MatrixDouble matDeviatorD
MatrixDouble wL2DotDotAtPts
MatrixDouble logStretchTotalTensorAtPts
MatrixDouble hdOmegaAtPts
MatrixDouble rotAxisDotAtPts
MatrixDouble gradHybridDispAtPts
MatrixDouble leviKirchhoffdOmegaAtPts
MatrixDouble leviKirchhoffPAtPts
MatrixDouble stretchTensorAtPts
MatrixPtr getSmallWL2AtPts()
MatrixPtr getFacePiolaAtPts()
MatrixDouble internalStressAtPts
MatrixPtr getInternalStressAtPts()
MatrixDouble logStretchDotTensorAtPts
MatrixPtr getRotAxisAtPts()
MatrixPtr getRotAxis0AtPts()
VectorDouble detStretchTensorAtPts
MatrixPtr getLeviKirchhoffAtPts()
MatrixPtr getSmallWL2DotDotAtPts()
MatrixDouble adjointPdUdPAtPts
MatrixPtr getRotAxisGradDotAtPts()
MatrixDouble adjointPdstretchAtPts
MatrixPtr getVarLogStreachPts()
MatrixPtr getRotAxisDotAtPts()
MatrixPtr getDivVarPiolaPts()
MatrixPtr getSmallWGradH1AtPts()
MatrixPtr getHybridDispDotAtPts()
MatrixPtr getGradHybridDispAtPts()
MatrixPtr getMatAxiatorDPtr()
MatrixPtr getEigenValsAtPts()
MatrixDouble approxPAtPts
MatrixPtr getSmallWH1AtPts()
MatrixPtr getLogStretchDotTensorAtPts()
MatrixDouble divSigmaAtPts
MatrixPtr getContactL2AtPts()
MatrixPtr getApproxSigmaAtPts()
MatrixPtr getApproxPAtPts()
MatrixPtr getStretchTensorAtPts()
MatrixDouble hybridDispDotAtPts
MatrixPtr getMatDeviatorDPtr()
MatrixPtr getVarRotAxisPts()
MatrixDouble hdLogStretchAtPts
MatrixPtr getVarPiolaPts()
MatrixPtr getLargeXH1AtPts()
MatrixPtr getSmallWL2DotAtPts()
MatrixPtr getDivSigmaAtPts()
MatrixDouble adjointPdUAtPts
MatrixDouble rotAxis0AtPts
MatrixDouble tractionAtPts
MatrixDouble varLogStreach
MatrixDouble logStretch2H1AtPts
MatrixPtr getGradLogStretchDotTensorAtPts()
VectorPtr getJacobianAtPts()
MatrixDouble logStretchTensorAtPts
VectorDouble jacobianAtPts
MatrixDouble rotAxisGradDotAtPts
MatrixDouble leviKirchhoffdLogStreatchAtPts
MatrixPtr getGradPAtPts()
MatrixDouble gradLogStretchDotTensorAtPts
MatrixDouble wGradH1AtPts
MatrixDouble leviKirchhoffAtPts
MatrixDouble faceMaterialForceAtPts
MatrixDouble adjointPdUdOmegaAtPts
MatrixDouble hybridDispAtPts
MatrixPtr getMatInvDPtr()
MatrixDouble detStretchTensorAtPts_du
MatrixDouble rotAxisAtPts
boost::shared_ptr< PhysicalEquations > physicsPtr
MatrixDouble facePiolaAtPts
MatrixDouble contactL2AtPts
virtual VolUserDataOperator * returnOpCalculateVarStretchFromStress(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
virtual VolUserDataOperator * returnOpCalculateEnergy(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< double > total_energy_ptr)
FTensor::Tensor3< double, 3, 3, 3 > DTensor3
PhysicalEquations()=delete
FTensor::Tensor3< FTensor::PackPtr< double *, 1 >, 3, 3, 3 > DTensor3Ptr
virtual VolUserDataOperator * returnOpSpatialPhysical(const std::string &field_name, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha_u)
virtual VolUserDataOperator * 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)
FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, 3, 3 > DTensor2Ptr
virtual VolUserDataOperator * returnOpCalculateStretchFromStress(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
FTensor::Tensor1< double, 3 > DTensor1
static DTensor3Ptr get_vecTensor3(std::vector< double > &v, const int nba)
FTensor::Tensor2< adouble, 3, 3 > ATensor2
FTensor::Tensor2< double, 3, 3 > DTensor2
PhysicalEquations(const int size_active, const int size_dependent)
virtual VolUserDataOperator * returnOpSetScale(boost::shared_ptr< double > scale_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
std::vector< double > dependentVariablesPiolaDirevatives
static DTensor2Ptr get_VecTensor2(std::vector< double > &v)
FTensor::Tensor1< adouble, 3 > ATensor1
FTensor::Tensor3< adouble, 3, 3, 3 > ATensor3
virtual MoFEMErrorCode recordTape(const int tag, DTensor2Ptr *t_h)=0
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > DTensor0Ptr
virtual ~PhysicalEquations()=default
virtual VolUserDataOperator * returnOpSpatialPhysical_du_du(std::string row_field, std::string col_field, boost::shared_ptr< DataAtIntegrationPts > data_ptr, const double alpha)
std::vector< double > activeVariables
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)
static DTensor0Ptr get_VecTensor0(std::vector< double > &v)
std::vector< double > dependentVariablesPiola
Data on single entity (This is passed as argument to DataOperator::doWork)