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;
39 using CachePhi = boost::tuple<int, int, MatrixDouble>;
45 BaseFunctionUnknownInterface **iface)
const;
47 boost::shared_ptr<BaseFunctionCtx> ctx_ptr);
71using EntData = EntitiesFieldData::EntData;
75using EleOnSide = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::FaceSideEle;
80struct AnalyticalExprPython;
83 :
public boost::enable_shared_from_this<DataAtIntegrationPts> {
167 return boost::shared_ptr<double>(shared_from_this(), &
piolaScale);
171 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
175 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
approxPAtPts);
179 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
divPAtPts);
187 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wL2AtPts);
191 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wL2DotAtPts);
199 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
204 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
209 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
214 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
219 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
rotAxisAtPts);
227 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
232 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
237 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
GAtPts);
241 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
GAtPts);
245 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
matD);
249 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
matInvD);
253 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
matAxiatorD);
257 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
matDeviatorD);
261 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wH1AtPts);
265 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
XH1AtPts);
269 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
contactL2AtPts);
273 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
wGradH1AtPts);
277 return boost::shared_ptr<VectorDouble>(shared_from_this(), &
jacobianAtPts);
281 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
286 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varRotAxis);
294 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varPiola);
298 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varDivPiola);
302 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
varWL2);
306 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
311 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
facePiolaAtPts);
315 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
320 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &
eigenVals);
356 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
357 boost::shared_ptr<PhysicalEquations> physics_ptr);
361 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
362 const double alpha_u);
367 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
368 boost::shared_ptr<ExternalStrainVec> external_strain_vec_ptr,
369 std::map<std::string, boost::shared_ptr<ScalingMethod>> smv);
372 std::string row_field, std::string col_field,
373 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
const double alpha);
377 boost::shared_ptr<double> total_energy_ptr);
380 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
381 boost::shared_ptr<PhysicalEquations> physics_ptr);
384 boost::shared_ptr<DataAtIntegrationPts> data_ptr,
385 boost::shared_ptr<PhysicalEquations> physics_ptr);
389 boost::shared_ptr<PhysicalEquations> physics_ptr);
402 &
v[S + 5], &
v[S + 6], &
v[S + 7], &
v[S + 8]);
414 const int A00 = nba * 0 + S0;
415 const int A01 = nba * 1 + S0;
416 const int A02 = nba * 2 + S0;
417 const int A10 = nba * 3 + S0;
418 const int A11 = nba * 4 + S0;
419 const int A12 = nba * 5 + S0;
420 const int A20 = nba * 6 + S0;
421 const int A21 = nba * 7 + S0;
422 const int A22 = nba * 8 + S0;
426 &
v[A00 + 0], &
v[A00 + 1], &
v[A00 + 2], &
v[A01 + 0], &
v[A01 + 1],
427 &
v[A01 + 2], &
v[A02 + 0], &
v[A02 + 1], &
v[A02 + 2],
429 &
v[A10 + 0], &
v[A10 + 1], &
v[A10 + 2], &
v[A11 + 0], &
v[A11 + 1],
430 &
v[A11 + 2], &
v[A12 + 0], &
v[A12 + 1], &
v[A12 + 2],
432 &
v[A20 + 0], &
v[A20 + 1], &
v[A20 + 2], &
v[A21 + 0], &
v[A21 + 1],
433 &
v[A21 + 2], &
v[A22 + 0], &
v[A22 + 1], &
v[A22 + 2]
548 #ifdef ENABLE_PYTHON_BINDING
549struct AnalyticalExprPython {
550 AnalyticalExprPython() =
default;
551 virtual ~AnalyticalExprPython() =
default;
553 MoFEMErrorCode analyticalExprInit(
const std::string py_file);
554 MoFEMErrorCode evalAnalyticalDisp(
double delta_t,
double t, np::ndarray x,
555 np::ndarray y, np::ndarray z,
556 np::ndarray nx, np::ndarray ny,
558 const std::string &block_name,
559 np::ndarray &analytical_expr);
560 MoFEMErrorCode evalAnalyticalTraction(
double delta_t,
double t, np::ndarray x,
561 np::ndarray y, np::ndarray z,
562 np::ndarray nx, np::ndarray ny,
564 const std::string &block_name,
565 np::ndarray &analytical_expr);
567 template <
typename T>
568 inline std::vector<T>
569 py_list_to_std_vector(
const boost::python::object &iterable) {
570 return std::vector<T>(boost::python::stl_input_iterator<T>(iterable),
571 boost::python::stl_input_iterator<T>());
575 bp::object mainNamespace;
576 bp::object analyticalDispFun;
577 bp::object analyticalTractionFun;
580extern boost::weak_ptr<AnalyticalExprPython> AnalyticalExprPythonWeakPtr;
ForcesAndSourcesCore::UserDataOperator UserDataOperator
const double v
phase velocity of light in medium (cm/ns)
boost::shared_ptr< VectorDouble > VectorPtr
FaceElementForcesAndSourcesCore::UserDataOperator FaceUserDataOperator
std::vector< AnalyticalTractionBc > AnalyticalTractionBcVec
std::vector< BcDisp > BcDispVec
std::vector< NormalDisplacementBc > NormalDisplacementBcVec
std::vector< BcRot > BcRotVec
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::FaceSideEle EleOnSide
std::vector< ExternalStrain > ExternalStrainVec
std::vector< AnalyticalDisplacementBc > AnalyticalDisplacementBcVec
std::vector< Range > TractionFreeBc
std::vector< PressureBc > PressureBcVec
std::vector< TractionBc > TractionBcVec
boost::shared_ptr< MatrixDouble > MatrixPtr
constexpr double t
plate stiffness
constexpr auto field_name
AnalyticalDisplacementBc(std::string name, std::vector< double > attr, Range faces)
AnalyticalTractionBc(std::string name, std::vector< double > attr, Range faces)
BcDisp(std::string name, std::vector< double > attr, Range faces)
BcRot(std::string name, std::vector< double > attr, Range faces)
CGGUserPolynomialBase(boost::shared_ptr< CachePhi > cache_phi=nullptr)
MoFEMErrorCode getValueHdivForCGGBubble(MatrixDouble &pts)
MoFEMErrorCode getValue(MatrixDouble &pts, boost::shared_ptr< BaseFunctionCtx > ctx_ptr)
~CGGUserPolynomialBase()=default
boost::tuple< int, int, MatrixDouble > CachePhi
boost::shared_ptr< CachePhi > cachePhiPtr
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, BaseFunctionUnknownInterface **iface) const
MatrixDouble approxSigmaAtPts
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 getGradHybridDispAtPts()
MatrixPtr getMatAxiatorDPtr()
MatrixPtr getEigenValsAtPts()
MatrixDouble approxPAtPts
MatrixPtr getSmallWH1AtPts()
MatrixPtr getLogStretchDotTensorAtPts()
MatrixDouble divSigmaAtPts
MatrixPtr getContactL2AtPts()
MatrixPtr getApproxSigmaAtPts()
MatrixPtr getApproxPAtPts()
MatrixPtr getStretchTensorAtPts()
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
MatrixDouble gradLogStretchDotTensorAtPts
MatrixDouble wGradH1AtPts
MatrixDouble leviKirchhoffAtPts
MatrixDouble faceMaterialForceAtPts
MatrixDouble adjointPdUdOmegaAtPts
MatrixPtr getMatInvDPtr()
MatrixDouble detStretchTensorAtPts_du
MatrixDouble rotAxisAtPts
boost::shared_ptr< PhysicalEquations > physicsPtr
MatrixDouble facePiolaAtPts
MatrixDouble contactL2AtPts
ExternalStrain(std::string name, std::vector< double > attr, Range ents)
NormalDisplacementBc(std::string name, std::vector< double > attr, Range faces)
FTensor::Tensor1< adouble, 3 > ATensor1
FTensor::Tensor1< double, 3 > DTensor1
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)
PhysicalEquations()=delete
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)
virtual VolUserDataOperator * returnOpCalculateStretchFromStress(boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
static DTensor3Ptr get_vecTensor3(std::vector< double > &v, const int nba)
FTensor::Tensor2< adouble, 3, 3 > ATensor2
FTensor::Tensor3< FTensor::PackPtr< double *, 1 >, 3, 3, 3 > DTensor3Ptr
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::Tensor3< adouble, 3, 3, 3 > ATensor3
FTensor::Tensor2< FTensor::PackPtr< double *, 1 >, 3, 3 > DTensor2Ptr
FTensor::Tensor2< double, 3, 3 > DTensor2
FTensor::Tensor3< double, 3, 3, 3 > DTensor3
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > DTensor0Ptr
virtual MoFEMErrorCode recordTape(const int tag, DTensor2Ptr *t_h)=0
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
PressureBc(std::string name, std::vector< double > attr, Range faces)
TractionBc(std::string name, std::vector< double > attr, Range faces)
Data on single entity (This is passed as argument to DataOperator::doWork)