MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
HopeSolver Class Reference

#include <stepsol.h>

Inheritance diagram for HopeSolver:
Collaboration diagram for HopeSolver:

Public Member Functions

 HopeSolver (const doublereal Tl, const doublereal dSolTol, const integer iMaxIt, const DriveCaller *pRho, const DriveCaller *pAlgRho, const bool bmod_res_test)
 
 ~HopeSolver (void)
 
- Public Member Functions inherited from Step2Integrator
 Step2Integrator (const integer MaxIt, const doublereal dT, const doublereal dSolutionTol, const bool bmod_res_test)
 
virtual ~Step2Integrator (void)
 
virtual doublereal Advance (Solver *pS, const doublereal TStep, const doublereal dAlph, const StepChange StType, std::deque< MyVectorHandler * > &qX, std::deque< MyVectorHandler * > &qXPrime, MyVectorHandler *const pX, MyVectorHandler *const pXPrime, integer &EffIter, doublereal &Err, doublereal &SolErr)
 
- Public Member Functions inherited from StepNIntegrator
 StepNIntegrator (const integer MaxIt, const doublereal dT, const doublereal dSolutionTol, const integer stp, const bool bmod_res_test)
 
virtual ~StepNIntegrator (void)
 
virtual void Residual (VectorHandler *pRes) const
 
virtual void Jacobian (MatrixHandler *pJac) const
 
virtual void Update (const VectorHandler *pSol) const
 
virtual doublereal TestScale (const NonlinearSolverTest *pTest, doublereal &dAlgebraicEqu) const
 
- Public Member Functions inherited from ImplicitStepIntegrator
 ImplicitStepIntegrator (const integer MaxIt, const doublereal dT, const doublereal dSolutionTol, const integer stp, const integer sts, const bool bmod_res_test)
 
virtual ~ImplicitStepIntegrator (void)
 
virtual void EvalProd (doublereal Tau, const VectorHandler &f0, const VectorHandler &w, VectorHandler &z) const
 
- Public Member Functions inherited from StepIntegrator
 StepIntegrator (const integer MaxIt, const doublereal dT, const doublereal dSolutionTol, const integer stp, const integer sts)
 
virtual ~StepIntegrator (void)
 
void SetDataManager (DataManager *pDatMan)
 
virtual integer GetIntegratorNumPreviousStates (void) const
 
virtual integer GetIntegratorNumUnknownStates (void) const
 
virtual integer GetIntegratorMaxIters (void) const
 
virtual doublereal GetIntegratorDTol (void) const
 
virtual doublereal GetIntegratorDSolTol (void) const
 
virtual void OutputTypes (const bool fpred)
 
- Public Member Functions inherited from NonlinearProblem
virtual ~NonlinearProblem (void)
 

Protected Member Functions

void SetCoef (doublereal dT, doublereal dAlpha, enum StepChange NewStep)
 
void SetDriveHandler (const DriveHandler *pDH)
 
doublereal dPredictDerivative (const doublereal &dXm1, const doublereal &dXm2, const doublereal &dXPm1, const doublereal &dXPm2, DofOrder::Order o=DofOrder::DIFFERENTIAL) const
 
doublereal dPredictState (const doublereal &dXm1, const doublereal &dXm2, const doublereal &dXP, const doublereal &dXPm1, const doublereal &dXPm2, DofOrder::Order o=DofOrder::DIFFERENTIAL) const
 
doublereal dPredDer (const doublereal &dXm1, const doublereal &dXm2, const doublereal &dXPm1, const doublereal &dXPm2) const
 
doublereal dPredState (const doublereal &dXm1, const doublereal &dXm2, const doublereal &dXP, const doublereal &dXPm1, const doublereal &dXPm2) const
 
doublereal dPredDerAlg (const doublereal &dXm1, const doublereal &dXPm1, const doublereal &dXPm2) const
 
doublereal dPredStateAlg (const doublereal &dXm1, const doublereal &dXP, const doublereal &dXPm1, const doublereal &dXPm2) const
 
- Protected Member Functions inherited from Step2Integrator
void PredictDof (const int DCount, const DofOrder::Order Order, const VectorHandler *const pSol=0) const
 
virtual void Predict (void)
 
- Protected Member Functions inherited from StepNIntegrator
void UpdateDof (const int DCount, const DofOrder::Order Order, const VectorHandler *const pSol=0) const
 
- Protected Member Functions inherited from StepIntegrator
template<class T >
void UpdateLoop (const T *const t, void(T::*pUpd)(const int DCount, const DofOrder::Order Order, const VectorHandler *const pSol) const, const VectorHandler *const pSol=0) const
 

Protected Attributes

DriveOwner Rho
 
DriveOwner AlgebraicRho
 
bool bStep
 
doublereal a [2][2]
 
doublereal b [2][2]
 
doublereal mp [2]
 
doublereal np [2]
 
- Protected Attributes inherited from Step2Integrator
VectorHandlerpXPrev
 
VectorHandlerpXPrev2
 
VectorHandlerpXPrimePrev
 
VectorHandlerpXPrimePrev2
 
- Protected Attributes inherited from ImplicitStepIntegrator
VectorHandlerpXCurr
 
VectorHandlerpXPrimeCurr
 
bool bModResTest
 
- Protected Attributes inherited from StepIntegrator
DataManagerpDM
 
const DataManager::DofVecTypepDofs
 
bool outputPred
 
integer MaxIters
 
doublereal dTol
 
doublereal dSolTol
 
integer steps
 
integer unkstates
 

Additional Inherited Members

- Public Types inherited from StepIntegrator
enum  { DIFFERENTIAL = 0, ALGEBRAIC = 1 }
 
enum  StepChange { NEWSTEP, REPEATSTEP }
 
- Public Attributes inherited from StepNIntegrator
doublereal db0Differential
 
doublereal db0Algebraic
 

Detailed Description

Definition at line 588 of file stepsol.h.

Constructor & Destructor Documentation

HopeSolver::HopeSolver ( const doublereal  Tl,
const doublereal  dSolTol,
const integer  iMaxIt,
const DriveCaller pRho,
const DriveCaller pAlgRho,
const bool  bmod_res_test 
)

Definition at line 1175 of file stepsol.cc.

References ASSERT.

1181 :Step2Integrator(iMaxIt, Tl, dSolTl, bmod_res_test),
1182 Rho(pRho), AlgebraicRho(pAlgRho), bStep(0)
1183 {
1184  ASSERT(pRho != NULL);
1185  ASSERT(pAlgRho != NULL);
1186 }
DriveOwner AlgebraicRho
Definition: stepsol.h:593
Step2Integrator(const integer MaxIt, const doublereal dT, const doublereal dSolutionTol, const bool bmod_res_test)
Definition: stepsol.cc:692
bool bStep
Definition: stepsol.h:595
#define ASSERT(expression)
Definition: colamd.c:977
DriveOwner Rho
Definition: stepsol.h:592
HopeSolver::~HopeSolver ( void  )

Definition at line 1188 of file stepsol.cc.

References NO_OP.

1189 {
1190  NO_OP;
1191 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

doublereal HopeSolver::dPredDer ( const doublereal dXm1,
const doublereal dXm2,
const doublereal dXPm1,
const doublereal dXPm2 
) const
protectedvirtual

Implements Step2Integrator.

Definition at line 1319 of file stepsol.cc.

References mp, and np.

1323 {
1324  return mp[0]*dXm1+mp[1]*dXm2+np[0]*dXPm1+np[1]*dXPm2;
1325 }
doublereal np[2]
Definition: stepsol.h:601
doublereal mp[2]
Definition: stepsol.h:600
doublereal HopeSolver::dPredDerAlg ( const doublereal dXm1,
const doublereal dXPm1,
const doublereal dXPm2 
) const
protectedvirtual

Implements Step2Integrator.

Definition at line 1344 of file stepsol.cc.

References mp, and np.

1347 {
1348  return np[0]*dXPm1+np[1]*dXPm2-mp[1]*dXm1;
1349 }
doublereal np[2]
Definition: stepsol.h:601
doublereal mp[2]
Definition: stepsol.h:600
doublereal HopeSolver::dPredictDerivative ( const doublereal dXm1,
const doublereal dXm2,
const doublereal dXPm1,
const doublereal dXPm2,
DofOrder::Order  o = DofOrder::DIFFERENTIAL 
) const
protectedvirtual

Implements Step2Integrator.

Definition at line 1281 of file stepsol.cc.

References DofOrder::ALGEBRAIC, mp, and np.

1286 {
1287  if (o == DofOrder::ALGEBRAIC) {
1288  return np[0]*dXPm1+np[1]*dXPm2-mp[1]*dXm1;
1289  } /* else if (o == DofOrder::DIFFERENTIAL) */
1290  return mp[0]*dXm1+mp[1]*dXm2+np[0]*dXPm1+np[1]*dXPm2;
1291 }
doublereal np[2]
Definition: stepsol.h:601
doublereal mp[2]
Definition: stepsol.h:600
doublereal HopeSolver::dPredictState ( const doublereal dXm1,
const doublereal dXm2,
const doublereal dXP,
const doublereal dXPm1,
const doublereal dXPm2,
DofOrder::Order  o = DofOrder::DIFFERENTIAL 
) const
protectedvirtual

Implements Step2Integrator.

Definition at line 1294 of file stepsol.cc.

References a, DofOrder::ALGEBRAIC, StepIntegrator::ALGEBRAIC, b, bStep, and StepIntegrator::DIFFERENTIAL.

1300 {
1301  if (bStep) {
1302  if (o == DofOrder::ALGEBRAIC) {
1303  return b[0][ALGEBRAIC]*(dXP+dXPm1);
1304  } /* else if (o == DofOrder::DIFFERENTIAL) */
1305  return dXm1+b[0][ALGEBRAIC]*(dXP+dXPm1);
1306 
1307  } else {
1308  if (o == DofOrder::ALGEBRAIC) {
1309  return b[0][ALGEBRAIC]*dXP+b[1][ALGEBRAIC]*dXPm1
1310  -a[1][ALGEBRAIC]*dXm1;
1311  } /* else if (o == DofOrder::DIFFERENTIAL) */
1312  return a[0][DIFFERENTIAL]*dXm1+a[1][DIFFERENTIAL]*dXm2
1313  +b[0][DIFFERENTIAL]*dXP+b[1][DIFFERENTIAL]*dXPm1;
1314  }
1315 }
doublereal a[2][2]
Definition: stepsol.h:597
doublereal b[2][2]
Definition: stepsol.h:598
bool bStep
Definition: stepsol.h:595
doublereal HopeSolver::dPredState ( const doublereal dXm1,
const doublereal dXm2,
const doublereal dXP,
const doublereal dXPm1,
const doublereal dXPm2 
) const
protectedvirtual

Implements Step2Integrator.

Definition at line 1328 of file stepsol.cc.

References a, StepIntegrator::ALGEBRAIC, b, bStep, and StepIntegrator::DIFFERENTIAL.

1333 {
1334  if (bStep) {
1335  return dXm1+b[0][ALGEBRAIC]*(dXP+dXPm1);
1336 
1337  } else {
1338  return a[0][DIFFERENTIAL]*dXm1+a[1][DIFFERENTIAL]*dXm2
1339  +b[0][DIFFERENTIAL]*dXP+b[1][DIFFERENTIAL]*dXPm1;
1340  }
1341 }
doublereal a[2][2]
Definition: stepsol.h:597
doublereal b[2][2]
Definition: stepsol.h:598
bool bStep
Definition: stepsol.h:595
doublereal HopeSolver::dPredStateAlg ( const doublereal dXm1,
const doublereal dXP,
const doublereal dXPm1,
const doublereal dXPm2 
) const
protectedvirtual

Implements Step2Integrator.

Definition at line 1352 of file stepsol.cc.

References a, StepIntegrator::ALGEBRAIC, b, and bStep.

1356 {
1357  if (bStep) {
1358  return b[0][ALGEBRAIC]*(dXP+dXPm1);
1359  } else {
1360  return b[0][ALGEBRAIC]*dXP+b[1][ALGEBRAIC]*dXPm1
1361  -a[1][ALGEBRAIC]*dXm1;
1362  }
1363 }
doublereal a[2][2]
Definition: stepsol.h:597
doublereal b[2][2]
Definition: stepsol.h:598
bool bStep
Definition: stepsol.h:595
void HopeSolver::SetCoef ( doublereal  dT,
doublereal  dAlpha,
enum StepChange  NewStep 
)
protectedvirtual

Implements Step2Integrator.

Definition at line 1201 of file stepsol.cc.

References a, StepIntegrator::ALGEBRAIC, AlgebraicRho, ASSERT, b, bStep, StepNIntegrator::db0Algebraic, StepNIntegrator::db0Differential, DEBUGCOUT, DriveOwner::dGet(), StepIntegrator::DIFFERENTIAL, mp, StepIntegrator::NEWSTEP, np, and Rho.

1204 {
1205 #if 0
1206  if (dAlpha != 1.) {
1207  cerr << "HOPE time step integrator is not implemented yet in variable step form" << std::endl;
1208  throw ErrNotImplementedYet();
1209  }
1210 #endif
1211 
1212  if (NewStep == NEWSTEP) {
1213  ASSERT(bStep == flag(0) || bStep == flag(1));
1214  bStep = 1-bStep; /* Commuta il valore di bStep */
1215  }
1216 
1217  doublereal dTMod = dT*dAlpha;
1218 
1219  /* Differential coefficients */
1220  mp[0] = -6.*dAlpha*(1.+dAlpha);
1221  mp[1] = -mp[0];
1222  np[0] = 1.+4.*dAlpha+3.*dAlpha*dAlpha;
1223  np[1] = dAlpha*(2.+3.*dAlpha);
1224 
1225  if (bStep) {
1226  b[0][DIFFERENTIAL] = b[1][DIFFERENTIAL]
1227  = b[0][ALGEBRAIC] = b[1][ALGEBRAIC]
1228  = db0Algebraic = db0Differential = dTMod/2.;// dT/4.;
1229 
1230  } else {
1231  doublereal dRho = Rho.dGet();
1232  doublereal dALPHA = 4.*dRho/(3.+dRho);
1233 
1234  a[0][DIFFERENTIAL] = (4.-dALPHA)/3.;
1235  a[1][DIFFERENTIAL] = (dALPHA-1.)/3.;
1236  b[0][DIFFERENTIAL] = dTMod*(4.-dALPHA)/6.;// dT*(4.-dALPHA)/12.;
1237  b[1][DIFFERENTIAL] = dTMod*dALPHA/2.;// dT*dALPHA/4.;
1238 
1239  DEBUGCOUT("Predict()" << std::endl
1240  << "Alpha = " << dAlpha << std::endl
1241  << "Differential coefficients:" << std::endl
1242  << "HOPE-Alpha = " << dALPHA << std::endl
1243  << "a1 = " << a[0][DIFFERENTIAL] << std::endl
1244  << "a2 = " << a[1][DIFFERENTIAL] << std::endl
1245  << "b0 = " << b[0][DIFFERENTIAL] << std::endl
1246  << "b1 = " << b[1][DIFFERENTIAL] << std::endl);
1247 
1248  /* Coefficienti del metodo - variabili algebriche */
1249  doublereal dAlgebraicRho = AlgebraicRho.dGet();
1250  doublereal dAlgebraicALPHA = 4.*dAlgebraicRho/(3.+dAlgebraicRho);
1251 
1252  if (dAlgebraicRho != dRho) {
1253  a[1][ALGEBRAIC] = (dAlgebraicALPHA-1.)/3.;
1254  b[0][ALGEBRAIC] = dTMod*(4.-dAlgebraicALPHA)/6.; // dT*(4.-dAlgebraicALPHA)/12.;
1255  b[1][ALGEBRAIC] = dTMod*dAlgebraicALPHA/2.; // dT*dAlgebraicALPHA/4.;
1256 
1257  } else {
1258  a[1][ALGEBRAIC] = a[1][DIFFERENTIAL];
1259  b[0][ALGEBRAIC] = b[0][DIFFERENTIAL];
1260  b[1][ALGEBRAIC] = b[1][DIFFERENTIAL];
1261  }
1262 
1263  DEBUGCOUT("Algebraic coefficients:" << std::endl
1264  << "HOPE-Alpha = " << dAlgebraicALPHA << std::endl
1265  << "a2 = " << a[1][ALGEBRAIC] << std::endl
1266  << "b0 = " << b[0][ALGEBRAIC] << std::endl
1267  << "b1 = " << b[1][ALGEBRAIC] << std::endl);
1268 
1269  /* valori di ritorno */
1270  db0Differential = b[0][DIFFERENTIAL];
1271  db0Algebraic = b[0][ALGEBRAIC];
1272  }
1273 
1274  /* Vengono modificati per la predizione, dopo che sono stati usati per
1275  * costruire gli altri coefficienti */
1276  mp[0] /= dT;
1277  mp[1] /= dT;
1278 }
doublereal np[2]
Definition: stepsol.h:601
long int flag
Definition: mbdyn.h:43
DriveOwner AlgebraicRho
Definition: stepsol.h:593
doublereal a[2][2]
Definition: stepsol.h:597
doublereal b[2][2]
Definition: stepsol.h:598
#define DEBUGCOUT(msg)
Definition: myassert.h:232
bool bStep
Definition: stepsol.h:595
#define ASSERT(expression)
Definition: colamd.c:977
doublereal db0Differential
Definition: stepsol.h:235
doublereal dGet(const doublereal &dVar) const
Definition: drive.cc:664
doublereal db0Algebraic
Definition: stepsol.h:236
DriveOwner Rho
Definition: stepsol.h:592
double doublereal
Definition: colamd.c:52
doublereal mp[2]
Definition: stepsol.h:600

Here is the call graph for this function:

void HopeSolver::SetDriveHandler ( const DriveHandler pDH)
protectedvirtual

Reimplemented from StepIntegrator.

Definition at line 1194 of file stepsol.cc.

References AlgebraicRho, DriveOwner::pGetDriveCaller(), Rho, and DriveCaller::SetDrvHdl().

1195 {
1196  Rho.pGetDriveCaller()->SetDrvHdl(pDH);
1198 }
DriveOwner AlgebraicRho
Definition: stepsol.h:593
virtual void SetDrvHdl(const DriveHandler *pDH)
Definition: drive.cc:487
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
DriveOwner Rho
Definition: stepsol.h:592

Here is the call graph for this function:

Member Data Documentation

doublereal HopeSolver::a[2][2]
protected

Definition at line 597 of file stepsol.h.

Referenced by dPredictState(), dPredState(), dPredStateAlg(), and SetCoef().

DriveOwner HopeSolver::AlgebraicRho
protected

Definition at line 593 of file stepsol.h.

Referenced by SetCoef(), and SetDriveHandler().

doublereal HopeSolver::b[2][2]
protected

Definition at line 598 of file stepsol.h.

Referenced by dPredictState(), dPredState(), dPredStateAlg(), and SetCoef().

bool HopeSolver::bStep
protected

Definition at line 595 of file stepsol.h.

Referenced by dPredictState(), dPredState(), dPredStateAlg(), and SetCoef().

doublereal HopeSolver::mp[2]
protected

Definition at line 600 of file stepsol.h.

Referenced by dPredDer(), dPredDerAlg(), dPredictDerivative(), and SetCoef().

doublereal HopeSolver::np[2]
protected

Definition at line 601 of file stepsol.h.

Referenced by dPredDer(), dPredDerAlg(), dPredictDerivative(), and SetCoef().

DriveOwner HopeSolver::Rho
protected

Definition at line 592 of file stepsol.h.

Referenced by SetCoef(), and SetDriveHandler().


The documentation for this class was generated from the following files: