45 template <
class T,
class Tder>
52 std::vector<const DifferentiableScalarFunction *>
FDEsc;
53 std::vector<const DifferentiableScalarFunction *>
FDEPrimesc;
60 const std::vector<const DifferentiableScalarFunction *>& fdesc,
61 const Tder& fdeprime0,
62 const std::vector<const DifferentiableScalarFunction *>& fdeprimesc)
91 virtual std::ostream&
Restart(std::ostream& out)
const {
92 silent_cerr(
"NLPViscoElasticConstitutiveLaw: Restart not implemented"
97 out <<
"nlp viscoelastic, ",
98 FDE0.Write(out,
", ");
100 for (
unsigned i = 0; i <
FDEsc.size(); i++) {
103 FDEsc[i]->Restart(out);
112 for (
unsigned i = 0; i <
FDEPrimesc.size(); i++) {
126 virtual void Update(
const T& Eps,
const T& EpsPrime = 0.) {
143 for (
unsigned i = 0; i <
FDEsc.size(); i++) {
161 if ((
CLType & ConstLawType::ELASTIC) &&
FDEsc[i]) {
165 fde += df1 + df1DE*dEps;
173 fde += df2DE*dEpsPrime;
190 std::vector<const DifferentiableScalarFunction *>
FDEsc;
191 std::vector<const DifferentiableScalarFunction *>
FDEPrimesc;
198 const std::vector<const DifferentiableScalarFunction *>& fdesc,
200 const std::vector<const DifferentiableScalarFunction *>& fdeprimesc)
229 virtual std::ostream&
Restart(std::ostream& out)
const {
230 silent_cerr(
"NLPViscoElasticConstitutiveLaw: Restart not implemented"
235 out <<
"nlp viscoelastic, ",
236 FDE0.Write(out,
", ");
238 for (
unsigned i = 0; i <
FDEsc.size(); i++) {
241 FDEsc[i]->Restart(out);
250 for (
unsigned i = 0; i <
FDEPrimesc.size(); i++) {
296 if ((
CLType & ConstLawType::ELASTIC) &&
FDEsc[0]) {
300 fde += df1 + df1DE*dEps;
307 fde += df2DE*dEpsPrime;
321 template <
class T,
class Tder, ConstLawType::Type Typ>
332 }
else if (
typeid(T) ==
typeid(
Vec3)) {
335 }
else if (
typeid(T) ==
typeid(
Vec6)) {
339 silent_cerr(
"Invalid dimensionality "
340 "for NLP viscoelastic constitutive law "
347 Tder FDE0(mb_zero<Tder>());
348 bool bElastic(
false);
349 std::vector<const DifferentiableScalarFunction *> FDEsc(dim);
350 for (
unsigned i = 0; i < dim; i++) {
358 bElastic = !IsNull<Tder>(FDE0);
359 for (
unsigned i = 0; i < dim; i++) {
365 silent_cerr(
"NLPViscoElasticCLR: "
366 "stiffness scalar function #" << i <<
" "
368 "must be differentiable" << std::endl);
377 Tder FDEPrime0(mb_zero<Tder>());
378 bool bViscous(
false);
379 std::vector<const DifferentiableScalarFunction *> FDEPrimesc(dim);
380 for (
unsigned i = 0; i < dim; i++) {
385 if ((Typ & ConstLawType::ELASTIC) && HP.
IsKeyWord(
"proportional")) {
388 FDEPrime0 = HP.
Get(FDEPrime0);
392 bViscous = !IsNull<Tder>(FDEPrime0);
393 for (
unsigned i = 0; i < dim; i++) {
398 if (FDEPrimesc[i] == 0) {
399 silent_cerr(
"NLPViscoElasticCLR: "
400 "damping scalar function #" << i <<
" "
402 "must be differentiable" << std::endl);
411 T PreStress(mb_zero<T>());
415 if (bElastic && bViscous) {
417 }
else if (bElastic) {
419 }
else if (bViscous) {
431 FDEPrime0, FDEPrimesc));
443 if (!
SetCL1D(
"nlp" "viscoelastic", rf1D)) {
446 silent_cerr(
"NLPViscoElasticConstitutiveLaw1D: "
447 "init failed" << std::endl);
454 if (!
SetCL1D(
"nlp" "elastic", rf1D)) {
457 silent_cerr(
"NLPElasticConstitutiveLaw1D: "
458 "init failed" << std::endl);
465 if (!
SetCL1D(
"nlp" "viscous", rf1D)) {
468 silent_cerr(
"NLPViscousConstitutiveLaw1D: "
469 "init failed" << std::endl);
477 if (!
SetCL3D(
"nlp" "viscoelastic", rf3D)) {
480 silent_cerr(
"NLPViscoElasticConstitutiveLaw3D: "
481 "init failed" << std::endl);
488 if (!
SetCL3D(
"nlp" "elastic", rf3D)) {
491 silent_cerr(
"NLPElasticConstitutiveLaw3D: "
492 "init failed" << std::endl);
499 if (!
SetCL3D(
"nlp" "viscous", rf3D)) {
502 silent_cerr(
"NLPViscousConstitutiveLaw3D: "
503 "init failed" << std::endl);
511 if (!
SetCL6D(
"nlp" "viscoelastic", rf6D)) {
514 silent_cerr(
"NLPViscoElasticConstitutiveLaw6D: "
515 "init failed" << std::endl);
522 if (!
SetCL6D(
"nlp" "elastic", rf6D)) {
525 silent_cerr(
"NLPElasticConstitutiveLaw6D: "
526 "init failed" << std::endl);
533 if (!
SetCL6D(
"nlp" "viscous", rf6D)) {
536 silent_cerr(
"NLPViscousConstitutiveLaw6D: "
537 "init failed" << std::endl);
virtual std::ostream & Restart(std::ostream &out) const
std::vector< const DifferentiableScalarFunction * > FDEPrimesc
virtual void Update(const T &Eps, const T &EpsPrime=0.)
#define MBDYN_EXCEPT_ARGS
ConstLawType::Type CLType
virtual ~NLPViscoElasticConstitutiveLaw(void)
ConstLawType::Type GetConstLawType(void) const
virtual std::ostream & Restart_int(std::ostream &out) const
std::vector< const DifferentiableScalarFunction * > FDEPrimesc
NLPViscoElasticConstitutiveLaw(const TplDriveCaller< T > *pDC, const T &PStress, const ConstLawType::Type &cltype, const Tder &fde0, const std::vector< const DifferentiableScalarFunction * > &fdesc, const Tder &fdeprime0, const std::vector< const DifferentiableScalarFunction * > &fdeprimesc)
NLPViscoElasticConstitutiveLaw< Vec6, Mat6x6 > NLPViscoElasticConstitutiveLaw6D
virtual void Update(const doublereal &Eps, const doublereal &EpsPrime=0.)
NLPViscoElasticConstitutiveLaw< doublereal, doublereal > NLPViscoElasticConstitutiveLaw1D
virtual bool IsKeyWord(const char *sKeyWord)
std::vector< const DifferentiableScalarFunction * > FDEsc
virtual ConstitutiveLaw< T, Tder > * Read(const DataManager *pDM, MBDynParser &HP, ConstLawType::Type &CLType)
ConstLawType::Type CLType
std::vector< const DifferentiableScalarFunction * > FDEsc
bool SetCL3D(const char *name, ConstitutiveLawRead< Vec3, Mat3x3 > *rf)
bool SetCL1D(const char *name, ConstitutiveLawRead< doublereal, doublereal > *rf)
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
virtual ConstitutiveLaw< T, Tder > * pCopy(void) const
void GetPreStress(MBDynParser &HP, T &PreStress)
bool SetCL6D(const char *name, ConstitutiveLawRead< Vec6, Mat6x6 > *rf)
virtual ~NLPViscoElasticConstitutiveLaw(void)
NLPViscoElasticConstitutiveLaw< Vec3, Mat3x3 > NLPViscoElasticConstitutiveLaw3D
virtual ConstitutiveLaw< doublereal, doublereal > * pCopy(void) const
NLPViscoElasticConstitutiveLaw(const TplDriveCaller< doublereal > *pDC, const doublereal &PStress, const ConstLawType::Type &cltype, const doublereal &fde0, const std::vector< const DifferentiableScalarFunction * > &fdesc, const doublereal &fdeprime0, const std::vector< const DifferentiableScalarFunction * > &fdeprimesc)
virtual doublereal Get(const doublereal &d)
ConstLawType::Type GetConstLawType(void) const
virtual std::ostream & Restart(std::ostream &out) const
virtual HighParser::ErrOut GetLineData(void) const
const BasicScalarFunction *const ParseScalarFunction(MBDynParser &HP, DataManager *const pDM)
virtual doublereal GetReal(const doublereal &dDefval=0.0)