47 #include <Xyce_config.h>
56 #include <N_ERH_ErrorMgr.h>
57 #include <N_LAS_BlockVector.h>
58 #include <N_LAS_Matrix.h>
59 #include <N_LAS_System.h>
60 #include <N_LAS_Vector.h>
61 #include <N_PDS_Comm.h>
62 #include <N_PDS_Manager.h>
67 #include <N_UTL_MachDepParams.h>
68 #include <N_UTL_Diagnostic.h>
69 #include <N_UTL_FeatureTest.h>
85 TimeIntegrationMethod *
128 return pow(stepadjust, 1.0 / 3.0);
190 if (DEBUG_TIME && isActive(Diag::TIME_PREDICTOR))
192 Xyce::dout().width(21);
193 Xyce::dout().precision(13);
194 Xyce::dout().setf(std::ios::scientific);
195 Xyce::dout() << std::endl;
196 Xyce::dout() << Xyce::section_divider << std::endl;
197 Xyce::dout() <<
" BackwardDifferentiation15::obtainPredictor" << std::endl;
199 Xyce::dout() <<
"\n sec.nscsco_: " <<
sec.
nscsco_ << std::endl;
201 Xyce::dout() <<
"\n sec.beta_[" << i <<
"] = " <<
sec.
beta_[i] <<
"\n" << std::endl;
204 Xyce::dout() <<
"\n xHistory["<< i <<
"]: \n" << std::endl;
205 (
ds.
xHistory[i])->printPetraObject(Xyce::dout());
206 Xyce::dout() << std::endl;
210 Xyce::dout() <<
"\n qHistory["<< i <<
"]: \n" << std::endl;
211 (
ds.
qHistory[i])->printPetraObject(Xyce::dout());
212 Xyce::dout() << std::endl;
216 Xyce::dout() <<
"\n sHistory["<< i <<
"]: \n" << std::endl;
217 (
ds.
sHistory[i])->printPetraObject(Xyce::dout());
218 Xyce::dout() << std::endl;
220 Xyce::dout() <<
"\n xn0: \n" << std::endl;
221 ds.
xn0Ptr->printPetraObject(Xyce::dout());
222 Xyce::dout() << std::endl;
223 Xyce::dout() <<
"\n qn0: \n" << std::endl;
224 ds.
qn0Ptr->printPetraObject(Xyce::dout());
225 Xyce::dout() << std::endl;
226 Xyce::dout() <<
"\n qpn0: \n" << std::endl;
227 ds.
qpn0Ptr->printPetraObject(Xyce::dout());
228 Xyce::dout() << std::endl;
229 Xyce::dout() <<
"\n sn0: \n" << std::endl;
230 ds.
sn0Ptr->printPetraObject(Xyce::dout());
231 Xyce::dout() << std::endl;
232 Xyce::dout() <<
"\n spn0: \n" << std::endl;
233 ds.
spn0Ptr->printPetraObject(Xyce::dout());
234 Xyce::dout() << std::endl;
235 Xyce::dout() <<
"\n stoQn0Ptr: \n" << std::endl;
237 Xyce::dout() << std::endl;
238 Xyce::dout() <<
"\n stoQpn0Ptr: \n" << std::endl;
240 Xyce::dout() << std::endl;
241 Xyce::dout() << Xyce::section_divider << std::endl;
266 if (DEBUG_TIME && isActive(Diag::TIME_RESIDUAL))
268 Xyce::dout() << std::endl;
269 Xyce::dout() << Xyce::section_divider << std::endl;
270 Xyce::dout() <<
" BackwardDifferentiation15::obtainResidual" << std::endl;
271 Xyce::dout() <<
"\n t = " <<
sec.
nextTime <<
"\n" << std::endl;
272 Xyce::dout() <<
"\n solution: \n" << std::endl;
274 Xyce::dout() <<
"\n daeQVector: \n" << std::endl;
276 Xyce::dout() <<
"\n qn0: \n" << std::endl;
277 ds.
qn0Ptr->printPetraObject(Xyce::dout());
278 Xyce::dout() <<
"\n qpn0: \n" << std::endl;
279 ds.
qpn0Ptr->printPetraObject(Xyce::dout());
281 Xyce::dout() <<
"\n daeFVector: \n" << std::endl;
284 Xyce::dout() <<
"\n dQdt-vector: \n" << std::endl;
286 Xyce::dout() << std::endl;
307 if (DEBUG_TIME && isActive(Diag::TIME_RESIDUAL))
309 Xyce::dout() <<
"\n Residual-vector: \n" << std::endl;
310 Xyce::dout() <<
"-(qpn0-(sec.alpha_s/h)*(Q-qn0)+F-B) \n" << std::endl;
312 Xyce::dout() << Xyce::section_divider << std::endl;
313 Xyce::dout() << std::endl;
339 if (DEBUG_TIME && isActive(Diag::TIME_JACOBIAN))
341 Xyce::dout() << std::endl;
342 Xyce::dout() << Xyce::section_divider << std::endl;
343 Xyce::dout() <<
" BackwardDifferentiation15::obtainJacobian" << std::endl;
360 Jac.linearCombo( qscalar, dQdx, 1.0, dFdx );
362 if (DEBUG_TIME && isActive(Diag::TIME_JACOBIAN))
364 Xyce::dout() <<
"\n dFdx:" <<std::endl;
365 dFdx.printPetraObject(Xyce::dout());
366 Xyce::dout() <<
"\n Total Jacobian:" <<std::endl;
367 Jac.printPetraObject(Xyce::dout());
373 Xyce::dout() << Xyce::section_divider << std::endl;
374 Xyce::dout() << std::endl;
391 Linear::Vector * tmpSolVectorPtr, std::vector<Linear::Vector*> & historyVec)
411 double uround = Util::MachineDependentParams::MachinePrecision();
413 tfuzz = 100 * uround * (tn + hh);
414 tp = tn - hused - tfuzz;
416 if ( (timepoint - tp)*hh < 0.0 )
419 *tmpSolVectorPtr = *(historyVec[0]);
421 if ( (kused == 0) || (timepoint == tn) )
424 delt = timepoint - tn;
426 for (
int j=1 ; j <= kord ; ++j)
430 tmpSolVectorPtr->linearCombo(1.0,*tmpSolVectorPtr,c,*(historyVec[j]));
453 Linear::Vector * tmpSolVectorPtr)
455 Linear::BlockVector * blockTempSolVectorPtr =
456 dynamic_cast<Linear::BlockVector*
>(tmpSolVectorPtr);
457 if (blockTempSolVectorPtr == NULL)
459 std::string msg =
"BackwardDifferentiation15::interpolateMPDESolution: ";
460 msg +=
"Linear::Vector tmpSolVectorPtr is not of type Linear::BlockVector";
461 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
467 int numblocks = timepoint.size();
468 int blockCount = blockTempSolVectorPtr->blockCount();
469 if (numblocks > blockCount)
471 std::string msg =
"BackwardDifferentiation15::interpolateMPDESolution: ";
472 msg +=
"Number of time points requested is greater than number of fast time points in MPDE block vector";
473 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
486 tfuzz = 100 * uround * (tn + hh);
487 tp = tn - hused - tfuzz;
488 for (
int i=0; i<numblocks ; ++i)
490 if ( (timepoint[i] - tp)*hh < 0.0 )
496 Linear::Vector * solVectorPtr;
497 Linear::Vector * xHistoryVectorPtr;
499 for (
int i=0; i < numblocks ; ++i)
501 if ((kused == 0) || (timepoint[i] == tn)) { kord = 1; }
502 else { kord = kused; }
503 solVectorPtr = &(blockTempSolVectorPtr->block(i));
505 delt = timepoint[i] - tn;
507 for (
int j=1 ; j <= kord ; ++j)
511 Linear::BlockVector * blockXHistoryVectorPtr =
512 dynamic_cast<Linear::BlockVector*>(
ds.
xHistory[j]);
513 if (blockXHistoryVectorPtr == NULL)
515 Xyce::Report::DevelFatal0().in(
"BackwardDifferentiation15::interpolateMPDESolution") <<
"Linear::Vector ds.xHistory[j] is not of type Linear::BlockVector\n j = " << j;
518 xHistoryVectorPtr = &(blockXHistoryVectorPtr->block(i));
519 solVectorPtr->linearCombo(1.0,*solVectorPtr,c,*xHistoryVectorPtr);
536 Linear::Vector * solnVecPtr,
537 const std::vector<double> & fastTimes )
539 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
541 Xyce::dout() << std::endl;
542 Xyce::dout() << Xyce::section_divider << std::endl;
543 Xyce::dout() <<
" BackwardDifferentiation15::printMPDEOutputSolution" << std::endl;
550 double beg_of_output_time_interval = lasttime;
551 double end_of_output_time_interval = tn;
552 double start_time = std::max(lasttime,beg_of_output_time_interval);
553 double stop_time = std::min(tn,end_of_output_time_interval);
554 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
556 Xyce::dout() <<
"timestep = " << timestep << std::endl;
557 Xyce::dout() <<
"lasttime = " << lasttime << std::endl;
558 Xyce::dout() <<
"tn = " << tn << std::endl;
559 Xyce::dout() <<
"beg_of_output_time_interval = " << beg_of_output_time_interval << std::endl;
560 Xyce::dout() <<
"end_of_output_time_interval = " << end_of_output_time_interval << std::endl;
561 Xyce::dout() <<
"start_time = " << start_time << std::endl;
562 Xyce::dout() <<
"stop_time = " << stop_time << std::endl;
565 Linear::BlockVector * blockTmpSolVectorPtr =
568 if (blockTmpSolVectorPtr == NULL)
570 std::string msg =
"BackwardDifferentiation15::printMPDEOutputSolution: ";
571 msg +=
"Linear::Vector ds.tmpSolVectorPtr is not of type Linear::BlockVector";
572 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
575 int blockCount = blockTmpSolVectorPtr->blockCount();
578 double T2 = fastTimes.back();
580 double charcross = fmod(start_time,T2);
584 for (
int i=0 ; i<=blockCount ; ++i)
586 if (fastTimes[i] >= charcross)
594 std::string msg =
"BackwardDifferentiation15::printMPDEOutputSolution: ";
595 msg +=
"Cannot find where characteristic curve crosses fast time slice at start_time";
596 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
599 std::vector<double> h2(blockCount,0);
600 for (
int j=0 ; j < blockCount ; ++j)
602 h2[j] = fastTimes[j+1] - fastTimes[j];
604 std::vector<double> ti;
606 double first_interp = start_time - charcross + fastTimes[s_ind_0];
607 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
609 Xyce::dout() <<
"first_interp = " << first_interp << std::endl;
612 if (s_ind_0 == blockCount) { s_ind_0 = 0; };
614 double eps = fabs(start_time)*1.0e-6;
615 if ( fabs(first_interp-
timept_) <= eps )
617 first_interp += h2[s_ind_0];
619 if (s_ind_0 == blockCount) { s_ind_0 = 0; };
620 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
622 Xyce::dout() <<
"Moving first_interp forward to avoid duplicate outputs: " << first_interp << std::endl;
626 double t = first_interp;
627 while (t <= stop_time)
632 if (sn >= blockCount) { sn = 0; }
634 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
636 Xyce::dout() <<
"T2 = " << T2 << std::endl;
637 Xyce::dout() <<
"charcross = " << charcross << std::endl;
638 Xyce::dout() <<
"s_ind_0 = " << s_ind_0 << std::endl;
639 Xyce::dout() <<
"Expecting to interpolate the following points:" << std::endl;
640 unsigned int numinterp = ti.size();
641 for (
unsigned int i=0 ; i < numinterp ; ++i)
643 Xyce::dout() << ti[i] << std::endl;
645 Xyce::dout() <<
"Total of " << numinterp <<
" points" << std::endl;
649 unsigned int tinum = ti.size();
650 int total_interp = 0;
651 std::vector<double> timepoint_vec(blockCount,stop_time);
652 int num_interp_this_cycle = 0;
654 for (
unsigned int i=0; i < tinum ; ++i)
656 timepoint_vec[s_ind] = ti[i];
657 num_interp_this_cycle++;
659 if (s_ind >= blockCount) { s_ind = 0; };
661 if ((s_ind == s_ind_0) || (i == tinum-1))
666 for (
int j=0 ; j < num_interp_this_cycle ; ++j)
670 timept_, blockTmpSolVectorPtr->block(s),
676 if (s >= blockCount) { s = 0; }
677 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
678 Xyce::dout() <<
"Interpolated to t = " <<
timept_ << std::endl;
680 num_interp_this_cycle = 0;
683 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
684 Xyce::dout() <<
"Total of " << total_interp <<
" points" << std::endl;
687 eps = fabs(stop_time)*1.0e-8;
689 if (fabs(
timept_ - stop_time) >= eps)
691 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
693 Xyce::dout() <<
"Previous timept = " <<
timept_ << std::endl;
694 Xyce::dout() <<
"Expecting to interpolate the following point: " << stop_time << std::endl;
697 Linear::Vector* tmpSolnVecPtr = solnVecPtr;
704 Linear::BlockVector * blockTmpSolnVecPtr =
705 dynamic_cast<Linear::BlockVector*
>(tmpSolnVecPtr);
706 Linear::BlockVector * blockTmpVecPtr =
707 dynamic_cast<Linear::BlockVector*
>(tmpVecPtr);
708 if (blockTmpSolnVecPtr == NULL)
710 std::string msg =
"BackwardDifferentiation15::printMPDEOutputSolution: ";
711 msg +=
"Linear::Vector tmpSolnVecPtr is not of type Linear::BlockVector";
712 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
715 if (blockTmpVecPtr == NULL)
717 std::string msg =
"BackwardDifferentiation15::printMPDEOutputSolution: ";
718 msg +=
"Linear::Vector tmpVecPtr is not of type Linear::BlockVector";
719 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
724 charcross = fmod(stop_time,T2);
727 if( charcross < fastTimes[0] )
730 s_ind_1 = blockCount-1;
734 for (
int i=blockCount-1 ; i>=0 ; --i)
736 if (fastTimes[i] <= charcross)
745 std::string msg =
"BackwardDifferentiation15::printMPDEOutputSolution: ";
746 msg +=
"Cannot find where characteristic curve crosses fast time slice at stop_time";
747 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
752 double coeff_sm = fastTimes[sp]-charcross;
753 double coeff_sp = charcross-fastTimes[sm];
754 if (sp == blockCount) { sp = 0; }
755 double dt = h2[s_ind_1];
757 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
759 Xyce::dout() <<
"charcross = " << charcross << std::endl;
760 Xyce::dout() <<
"s_ind_1 = " << s_ind_1 << std::endl;
761 Xyce::dout() <<
"sp = " << sp << std::endl;
762 Xyce::dout() <<
"sm = " << sm << std::endl;
763 Xyce::dout() <<
"dt = " << dt << std::endl;
764 Xyce::dout() <<
"timept = " <<
timept_ << std::endl;
765 Xyce::dout() <<
"coeff_sm = " << coeff_sm << std::endl;
766 Xyce::dout() <<
"coeff_sp = " << coeff_sp << std::endl;
769 blockTmpVecPtr->block(0).linearCombo(
770 coeff_sm/dt, blockTmpSolnVecPtr->block(sm),
771 coeff_sp/dt, blockTmpSolnVecPtr->block(sp)
774 timept_, blockTmpVecPtr->block(0),
779 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
780 Xyce::dout() <<
"Interpolated to t = " <<
timept_ << std::endl;
783 else if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
785 Xyce::dout() <<
"No further interpolation required." << std::endl;
788 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
789 Xyce::dout() << Xyce::section_divider << std::endl;
806 Linear::Vector * solnVecPtr,
807 const std::vector<double> & fastTimes,
810 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
812 Xyce::dout() << std::endl;
813 Xyce::dout() << Xyce::section_divider << std::endl;
814 Xyce::dout() <<
" BackwardDifferentiation15::printWaMPDEOutputSolution" << std::endl;
821 double beg_of_output_time_interval = lasttime;
822 double end_of_output_time_interval = tn;
823 double start_time = std::max(lasttime,beg_of_output_time_interval);
824 double stop_time = std::min(tn,end_of_output_time_interval);
826 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
828 Xyce::dout() <<
"start_time = " << start_time << std::endl;
829 Xyce::dout() <<
"stop_time = " << stop_time << std::endl;
854 Linear::BlockVector * blockTmpSolVectorPtr =
856 Linear::BlockVector * blockTmpXn0APtr =
858 Linear::BlockVector * blockTmpXn0BPtr =
860 if (blockTmpSolVectorPtr == NULL)
862 std::string msg =
"BackwardDifferentiation15::printWaMPDEOutputSolution: ";
863 msg +=
"Linear::Vector ds.tmpSolVectorPtr is not of type Linear::BlockVector";
864 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
867 if (blockTmpXn0APtr == NULL)
869 std::string msg =
"BackwardDifferentiation15::printWaMPDEOutputSolution: ";
870 msg +=
"Linear::Vector ds.tmpXn0APtr is not of type Linear::BlockVector";
871 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
874 if (blockTmpXn0BPtr == NULL)
876 std::string msg =
"BackwardDifferentiation15::printWaMPDEOutputSolution: ";
877 msg +=
"Linear::Vector ds.tmpXn0BPtr is not of type Linear::BlockVector";
878 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
881 int phiLID = blockTmpSolVectorPtr->pmap()->globalToLocalIndex(phiGID);
885 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
887 Xyce::dout() <<
" sec.usedOrder_ = " <<
sec.
usedOrder_ << std::endl;
888 Xyce::dout() <<
" sec.currentTime_ = " <<
sec.
currentTime << std::endl;
889 Xyce::dout() <<
" lasttime = " << lasttime << std::endl;
897 timeA = lasttime + hh*i;
901 std::string msg =
"interpolateSolution returned false!";
902 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0,msg);
911 timeB = lasttime + hh*(i+1);
913 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
915 Xyce::dout() <<
"Interpolating in [ " << timeA <<
", " << timeB <<
" ]" << std::endl;
916 Xyce::dout() <<
"timeA = " << timeA << std::endl;
917 Xyce::dout() <<
"timeB = " << timeB << std::endl;
921 std::vector<double> t1vals;
922 double T2 = fastTimes.back();
923 int blockCount = blockTmpSolVectorPtr->blockCount();
924 double h2 = T2/blockCount;
925 double tval = timeA+h2;
926 while (tval <= timeB)
928 t1vals.push_back(tval);
932 double eps = fabs(timeB)*1.0e-8;
933 if ( (t1vals.size() == 0) || (fabs(t1vals.back() - timeB) >= eps) )
935 t1vals.push_back(timeB);
937 std::vector<double> t2vals, phiAB(2);
938 std::vector<double> tmpPhiAB(2, 0.0);
944 blockTmpSolVectorPtr->pmap()->pdsComm().sumAll( &tmpPhiAB[0], &phiAB[0], 2 );
946 double phiA = phiAB[0], phiB = phiAB[1];
947 for (
unsigned int j=0 ; j<t1vals.size() ; ++j)
949 double phi = (1/(timeB-timeA))*(phiA*(timeB-t1vals[j])+phiB*(t1vals[j]-timeA));
950 t2vals.push_back(fmod(phi,T2));
952 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
954 Xyce::dout() <<
"t1vals = " << std::endl;
955 for (
unsigned int j=0 ; j < t1vals.size() ; ++j)
957 Xyce::dout() << t1vals[j] << std::endl;
959 Xyce::dout() <<
"phi(" << timeA <<
") = " << phiA << std::endl;
960 Xyce::dout() <<
"phi(" << timeB <<
") = " << phiB << std::endl;
961 Xyce::dout() <<
"t2vals = " << std::endl;
962 for (
unsigned int j=0 ; j< t2vals.size() ; ++j)
964 Xyce::dout() << t2vals[j] << std::endl;
972 double t = t1vals[0];
973 double s = t2vals[0];
977 for (
int j=0 ; j < blockCount ; ++j)
979 if ((fastTimes[j] <= s) && (s < fastTimes[j+1]))
985 if (b2 == blockCount)
989 double s1 = fastTimes[b1];
990 double s2 = fastTimes[b1+1];
991 if ((s < s1) || (s > s2))
993 std::string msg =
"BackwardDifferentiation15::printWaMPDEOutputSolution: ";
994 msg +=
" Interpolator cannot find a fast time block containing the first point ";
995 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
997 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
999 Xyce::dout() <<
"Found s = " << s <<
" in block " << b1;
1000 Xyce::dout() <<
" with boundary = [" << s1 <<
"," << s2 <<
"]" << std::endl;
1003 for (
unsigned int j=0 ; j < t1vals.size() ; ++j)
1009 if ( (s < s1) || (s > s2) )
1011 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1012 Xyce::dout() <<
"Incrementing fast time block for next interpolation." << std::endl;
1015 if (b1 == blockCount)
1020 if (b2 == blockCount)
1025 s2 = fastTimes[b1+1];
1028 if ((s < s1) || (s > s2))
1030 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1031 Xyce::dout() <<
"Searching for fast time block for next interpolation." << std::endl;
1034 for (
int j2=0 ; j2 < blockCount ; ++j2)
1036 if ((fastTimes[j2] <= s) && (s < fastTimes[j2+1]))
1042 if (b2 == blockCount)
1047 s2 = fastTimes[b1+1];
1050 if ((s < s1) || (s > s2))
1052 std::string msg =
"BackwardDifferentiation15::printWaMPDEOutputSolution: ";
1053 msg +=
" Interpolator moved fast time block but new point is not in this block ";
1054 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL_0, msg);
1065 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1067 Xyce::dout() <<
"Interpolating in the block:" << std::endl;
1068 Xyce::dout() <<
"(t1,t2) = (" << t1 <<
"," << t2 <<
")" << std::endl;
1069 Xyce::dout() <<
"(s1,s2) = (" << s1 <<
"," << s2 <<
")" << std::endl;
1072 double denom = (t2-t1)*(s2-s1);
1073 double coeff0 = (t2-t)*(s2-s)/denom;
1074 double coeff1 = (t2-t)*(s-s1)/denom;
1075 double coeff2 = (t-t1)*(s2-s)/denom;
1076 double coeff3 = (t-t1)*(s-s1)/denom;
1077 (blockTmpSolVectorPtr->block(b1)).linearCombo(
1078 coeff0, blockTmpXn0APtr->block(b1),
1079 coeff1, blockTmpXn0APtr->block(b2),
1080 coeff2, blockTmpXn0BPtr->block(b1) );
1081 (blockTmpSolVectorPtr->block(b1)).update(
1082 coeff3, blockTmpXn0BPtr->block(b2), 1.0 );
1088 t, blockTmpSolVectorPtr->block(b1),
1093 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1094 Xyce::dout() <<
"Interpolated to (t,phi(t)) = (" << t <<
"," << s <<
")" << std::endl;
1099 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1100 Xyce::dout() << Xyce::section_divider << std::endl;
1119 Linear::Vector * solnVecPtr,
1120 const bool doNotInterpolate,
1121 const std::vector<double> & outputInterpolationTimes,
1122 bool skipPrintLineOutput)
1124 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1126 Xyce::dout() << std::endl;
1127 Xyce::dout() << Xyce::section_divider << std::endl;
1128 Xyce::dout() <<
" BackwardDifferentiation15::printOutputSolution" << std::endl;
1129 Xyce::dout() <<
"usedOrder_ = " <<
sec.
usedOrder_ << std::endl;
1134 bool dointerp =
true;
1146 if (doNotInterpolate)
1151 if (dointerp && !outputInterpolationTimes.empty())
1153 for (
unsigned int i=0;i<outputInterpolationTimes.size();++i)
1164 skipPrintLineOutput);
1171 double timept = lasttime + hh*i;
1181 skipPrintLineOutput);
1183 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1184 Xyce::dout() <<
"Interpolated to t = " << timept << std::endl;
1191 if (outputInterpolationTimes.empty() || doNotInterpolate)
1196 skipPrintLineOutput);
1198 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1199 Xyce::dout() << Xyce::section_divider << std::endl;
1217 Linear::Vector * solnVecPtr,
1218 const double saveTime,
1219 const bool doNotInterpolate)
1221 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1223 Xyce::dout() << std::endl;
1224 Xyce::dout() << Xyce::section_divider << std::endl;
1225 Xyce::dout() <<
" BackwardDifferentiation15::saveOutputSolution" << std::endl;
1230 bool dointerp =
true;
1242 if (doNotInterpolate)
1254 outputManagerAdapter.
outputDCOP( *(solnVecPtr) );
1257 if (DEBUG_TIME && isActive(Diag::TIME_OUTPUT))
1258 Xyce::dout() << Xyce::section_divider << std::endl;
1339 if (DEBUG_TIME && isActive(Diag::TIME_HISTORY))
1341 Xyce::dout() << std::endl;
1342 Xyce::dout() << Xyce::section_divider << std::endl;
1344 " BackwardDifferentiation15::updateHistory" << std::endl;
1345 Xyce::dout() <<
"\n Before updates \n" << std::endl;
1348 Xyce::dout() <<
"\n xHistory["<< i <<
"]: \n" << std::endl;
1349 (
ds.
xHistory[i])->printPetraObject(Xyce::dout());
1350 Xyce::dout() << std::endl;
1354 Xyce::dout() <<
"\n qHistory["<< i <<
"]: \n" << std::endl;
1355 (
ds.
qHistory[i])->printPetraObject(Xyce::dout());
1356 Xyce::dout() << std::endl;
1360 Xyce::dout() <<
"\n sHistory["<< i <<
"]: \n" << std::endl;
1361 (
ds.
sHistory[i])->printPetraObject(Xyce::dout());
1362 Xyce::dout() << std::endl;
1364 Xyce::dout() << Xyce::section_divider << std::endl;
1424 if (DEBUG_TIME && isActive(Diag::TIME_HISTORY))
1426 Xyce::dout() <<
"\n After updates \n" << std::endl;
1427 Xyce::dout() <<
"\n newtonCorrectionPtr: " << std::endl;
1429 Xyce::dout() <<
"\n qnewtonCorrectionPtr: " << std::endl;
1433 Xyce::dout() <<
"\n xHistory["<< i <<
"]: \n" << std::endl;
1434 (
ds.
xHistory[i])->printPetraObject(Xyce::dout());
1435 Xyce::dout() << std::endl;
1439 Xyce::dout() <<
"\n qHistory["<< i <<
"]: \n" << std::endl;
1440 (
ds.
qHistory[i])->printPetraObject(Xyce::dout());
1441 Xyce::dout() << std::endl;
1443 Xyce::dout() <<
"\n sNewtonCorrectionPtr: " << std::endl;
1445 Xyce::dout() << std::endl;
1446 Xyce::dout() <<
"\n nextStatePtr: " << std::endl;
1448 Xyce::dout() << std::endl;
1451 Xyce::dout() <<
"\n sHistory["<< i <<
"]: \n" << std::endl;
1452 (
ds.
sHistory[i])->printPetraObject(Xyce::dout());
1453 Xyce::dout() << std::endl;
1455 Xyce::dout() << Xyce::section_divider << std::endl;
1483 if (DEBUG_TIME && isActive(Diag::TIME_HISTORY))
1485 Xyce::dout() << std::endl;
1486 Xyce::dout() << Xyce::section_divider << std::endl;
1488 " BackwardDifferentiation15::restoreHistory" << std::endl;
1490 Xyce::dout() <<
"\n sec.psi_[i] = " <<
sec.
psi_[i] << std::endl;
1493 Xyce::dout() <<
"\n xHistory["<< i <<
"]: \n" << std::endl;
1494 (
ds.
xHistory[i])->printPetraObject(Xyce::dout());
1495 Xyce::dout() << std::endl;
1499 Xyce::dout() <<
"\n qHistory["<< i <<
"]: \n" << std::endl;
1500 (
ds.
qHistory[i])->printPetraObject(Xyce::dout());
1501 Xyce::dout() << std::endl;
1505 Xyce::dout() <<
"\n sHistory["<< i <<
"]: \n" << std::endl;
1506 (
ds.
sHistory[i])->printPetraObject(Xyce::dout());
1507 Xyce::dout() << std::endl;
1509 Xyce::dout() << Xyce::section_divider << std::endl;
1525 if (DEBUG_TIME && isActive(Diag::TIME_COEFFICIENTS))
1527 Xyce::dout() << std::endl;
1528 Xyce::dout() << Xyce::section_divider << std::endl;
1529 Xyce::dout() <<
" BackwardDifferentiation15::updateCoeffs" << std::endl;
1533 Xyce::dout() <<
" nscsco_ = " <<
sec.
nscsco_ << std::endl;
1534 Xyce::dout() <<
" psi_[0] = " <<
sec.
psi_[0] << std::endl;
1574 if (DEBUG_TIME && isActive(Diag::TIME_COEFFICIENTS))
1576 Xyce::dout() <<
" nscsco_ = " <<
sec.
nscsco_ << std::endl;
1577 Xyce::dout() <<
" beta_[0] = " <<
sec.
beta_[0] << std::endl;
1578 Xyce::dout() <<
" beta_[1] = " <<
sec.
beta_[1] << std::endl;
1579 Xyce::dout() <<
" beta_[2] = " <<
sec.
beta_[2] << std::endl;
1580 Xyce::dout() <<
" beta_[3] = " <<
sec.
beta_[3] << std::endl;
1581 Xyce::dout() <<
" beta_[4] = " <<
sec.
beta_[4] << std::endl;
1582 Xyce::dout() <<
" alpha_[0] = " <<
sec.
alpha_[0] << std::endl;
1583 Xyce::dout() <<
" alpha_[1] = " <<
sec.
alpha_[1] << std::endl;
1584 Xyce::dout() <<
" alpha_[2] = " <<
sec.
alpha_[2] << std::endl;
1585 Xyce::dout() <<
" alpha_[3] = " <<
sec.
alpha_[3] << std::endl;
1586 Xyce::dout() <<
" alpha_[4] = " <<
sec.
alpha_[4] << std::endl;
1587 Xyce::dout() <<
" alphas_ = " <<
sec.
alphas_ << std::endl;
1588 Xyce::dout() <<
" alpha0_ = " <<
sec.
alpha0_ << std::endl;
1589 Xyce::dout() <<
" gamma_[0] = " <<
sec.
gamma_[0] << std::endl;
1590 Xyce::dout() <<
" gamma_[1] = " <<
sec.
gamma_[1] << std::endl;
1591 Xyce::dout() <<
" gamma_[2] = " <<
sec.
gamma_[2] << std::endl;
1592 Xyce::dout() <<
" gamma_[3] = " <<
sec.
gamma_[3] << std::endl;
1593 Xyce::dout() <<
" gamma_[4] = " <<
sec.
gamma_[4] << std::endl;
1594 Xyce::dout() <<
" psi_[0] = " <<
sec.
psi_[0] << std::endl;
1595 Xyce::dout() <<
" psi_[1] = " <<
sec.
psi_[1] << std::endl;
1596 Xyce::dout() <<
" psi_[2] = " <<
sec.
psi_[2] << std::endl;
1597 Xyce::dout() <<
" psi_[3] = " <<
sec.
psi_[3] << std::endl;
1598 Xyce::dout() <<
" psi_[4] = " <<
sec.
psi_[4] << std::endl;
1599 Xyce::dout() <<
" sigma_[0] = " <<
sec.
sigma_[0] << std::endl;
1600 Xyce::dout() <<
" sigma_[1] = " <<
sec.
sigma_[1] << std::endl;
1601 Xyce::dout() <<
" sigma_[2] = " <<
sec.
sigma_[2] << std::endl;
1602 Xyce::dout() <<
" sigma_[3] = " <<
sec.
sigma_[3] << std::endl;
1603 Xyce::dout() <<
" sigma_[4] = " <<
sec.
sigma_[4] << std::endl;
1604 Xyce::dout() <<
" ck_ = " <<
sec.
ck_ << std::endl;
1605 Xyce::dout() << Xyce::section_divider << std::endl;
1634 double currentTimeStep;
1637 currentTimeStep = 0.1 * time_to_stop;
1645 #ifdef Xyce_INCOMPLETE_2LEVEL_NORMS
1646 double dnorm_q = 0.0;
1664 if (rh>1.0) currentTimeStep = currentTimeStep/rh;
1731 if (DEBUG_TIME &&isActive(Diag::TIME_HISTORY))
1733 Xyce::dout() << std::endl;
1734 Xyce::dout() << Xyce::section_divider << std::endl;
1735 Xyce::dout() <<
" BackwardDifferentiation15::initialize" << std::endl;
1736 Xyce::dout() <<
"\n xHistory: \n" << std::endl;
1737 (
ds.
xHistory[0])->printPetraObject(Xyce::dout());
1738 Xyce::dout() << std::endl;
1739 (
ds.
xHistory[1])->printPetraObject(Xyce::dout());
1740 Xyce::dout() << std::endl;
1741 Xyce::dout() <<
"\n qHistory: \n" << std::endl;
1742 (
ds.
qHistory[0])->printPetraObject(Xyce::dout());
1743 Xyce::dout() << std::endl;
1744 (
ds.
qHistory[1])->printPetraObject(Xyce::dout());
1745 Xyce::dout() << std::endl;
1746 Xyce::dout() <<
"\n sHistory: \n" << std::endl;
1747 (
ds.
sHistory[0])->printPetraObject(Xyce::dout());
1748 Xyce::dout() << std::endl;
1749 (
ds.
sHistory[1])->printPetraObject(Xyce::dout());
1750 Xyce::dout() << std::endl;
1751 Xyce::dout() <<
"\n" <<
"currentTimeStep = " << currentTimeStep <<
"\n" << std::endl;
1752 Xyce::dout() <<
"\n" <<
"time_to_stop = " << time_to_stop <<
"\n" << std::endl;
1753 Xyce::dout() << Xyce::section_divider << std::endl;
1769 double time_to_stop = sec.stopTime - sec.currentTime;
1773 *(ds.xHistory[0]) = *(ds.currSolutionPtr);
1774 (ds.xHistory[1])->putScalar(0.0);
1777 *(ds.qHistory[0]) = *(ds.daeQVectorPtr);
1778 *(ds.qHistory[1]) = *(ds.daeFVectorPtr);
1779 (ds.qHistory[1])->scale(-sec.currentTimeStep);
1782 *(ds.sHistory[0]) = *(ds.nextStatePtr);
1783 (ds.sHistory[1])->putScalar(0.0);
1786 *(ds.stoHistory[0]) = *(ds.nextStatePtr);
1787 (ds.stoHistory[1])->putScalar(0.0);
1790 *(ds.stoLeadCurrQHistory[0]) = *(ds.nextStoreLeadCurrQPtr);
1791 (ds.stoLeadCurrQHistory[1])->putScalar(0.0);
1794 *(ds.leadCurrentHistory[0]) = *(ds.currLeadCurrentPtr);
1795 (ds.leadCurrentHistory[1])->putScalar(0.0);
1797 *(ds.leadCurrentQHistory[0]) = *(ds.currLeadCurrentQPtr);
1798 (ds.leadCurrentQHistory[1])->putScalar(0.0);
1800 *(ds.leadDeltaVHistory[0]) = *(ds.currLeadDeltaVPtr);
1801 (ds.leadDeltaVHistory[1])->putScalar(0.0);
1804 sec.numberOfSteps_ = 0;
1806 sec.psi_[0] = sec.currentTimeStep;
1807 sec.cj_ = 1/sec.psi_[0];
1834 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
1836 Xyce::dout() << std::endl;
1837 Xyce::dout() << Xyce::section_divider << std::endl;
1838 Xyce::dout() <<
" BackwardDifferentiation15::checkReduceOrder" << std::endl;
1846 #ifndef Xyce_USE_Q_NORM
1852 double dnorm = dnorm_x;
1854 double dnorm_x = 0.0, dnorm_q = 0.0;
1857 double dnorm = sqrt(0.5*dnorm_x*dnorm_x+0.5*dnorm_q*dnorm_q);
1864 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
1866 Xyce::dout() <<
" Est_= " <<
sec.
Est_ << std::endl;
1867 Xyce::dout() <<
" Ek_= " <<
sec.
Ek_ << std::endl;
1868 Xyce::dout() <<
" dnorm = " << dnorm << std::endl;
1870 Xyce::dout() <<
" Tk_= " <<
sec.
Tk_ << std::endl;
1876 #ifndef Xyce_USE_Q_NORM
1878 #ifdef Xyce_INCOMPLETE_2LEVEL_NORMS
1890 dnorm = sqrt(0.5*dnorm_x*dnorm_x+0.5*dnorm_q*dnorm_q);
1895 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
1897 Xyce::dout() <<
" Ekm1_= " <<
sec.
Ekm1_ << std::endl;
1898 Xyce::dout() <<
" Tkm1_= " <<
sec.
Tkm1_ << std::endl;
1903 #ifndef Xyce_USE_Q_NORM
1905 #ifdef Xyce_INCOMPLETE_2LEVEL_NORMS
1917 dnorm = sqrt(0.5*dnorm_x*dnorm_x+0.5*dnorm_q*dnorm_q);
1930 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
1933 Xyce::dout() <<
" Tkm1_= " <<
sec.
Tkm1_ << std::endl;
1934 Xyce::dout() <<
" Tk_= " <<
sec.
Tk_ << std::endl;
1942 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
1944 Xyce::dout() <<
" newOrder = " <<
sec.
newOrder_ << std::endl;
1945 Xyce::dout() << Xyce::section_divider << std::endl;
1976 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
1978 Xyce::dout() << std::endl;
1979 Xyce::dout() << Xyce::section_divider << std::endl;
1980 Xyce::dout() <<
" BackwardDifferentiation15::rejectStep" << std::endl;
2004 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2005 Xyce::dout() <<
"rejectStep 1" << std::endl;
2014 #ifndef Xyce_USE_Q_NORM
2022 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2023 Xyce::dout() <<
"rejectStep 2" << std::endl;
2029 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2030 Xyce::dout() <<
"rejectStep 3" << std::endl;
2037 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2038 Xyce::dout() <<
"rejectStep 4" << std::endl;
2044 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2045 Xyce::dout() <<
"rejectStep 5" << std::endl;
2052 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2053 Xyce::dout() <<
"rejectStep 6" << std::endl;
2055 if (DEBUG_TIME && isActive(Diag::TIME_STEP) && isActive(Diag::TIME_COEFFICIENTS))
2060 Xyce::dout() <<
" nscsco_ = " <<
sec.
nscsco_ << std::endl;
2061 Xyce::dout() <<
" alpha_[0] = " <<
sec.
alpha_[0] << std::endl;
2062 Xyce::dout() <<
" alpha_[1] = " <<
sec.
alpha_[1] << std::endl;
2063 Xyce::dout() <<
" alpha_[2] = " <<
sec.
alpha_[2] << std::endl;
2064 Xyce::dout() <<
" alpha_[3] = " <<
sec.
alpha_[3] << std::endl;
2065 Xyce::dout() <<
" alpha_[4] = " <<
sec.
alpha_[4] << std::endl;
2066 Xyce::dout() <<
" psi_[0] = " <<
sec.
psi_[0] << std::endl;
2067 Xyce::dout() <<
" psi_[1] = " <<
sec.
psi_[1] << std::endl;
2068 Xyce::dout() <<
" psi_[2] = " <<
sec.
psi_[2] << std::endl;
2069 Xyce::dout() <<
" psi_[3] = " <<
sec.
psi_[3] << std::endl;
2070 Xyce::dout() <<
" psi_[4] = " <<
sec.
psi_[4] << std::endl;
2071 Xyce::dout() <<
" sigma_[0] = " <<
sec.
sigma_[0] << std::endl;
2072 Xyce::dout() <<
" sigma_[1] = " <<
sec.
sigma_[1] << std::endl;
2073 Xyce::dout() <<
" sigma_[2] = " <<
sec.
sigma_[2] << std::endl;
2074 Xyce::dout() <<
" sigma_[3] = " <<
sec.
sigma_[3] << std::endl;
2075 Xyce::dout() <<
" sigma_[4] = " <<
sec.
sigma_[4] << std::endl;
2076 Xyce::dout() <<
" rr = " << rr << std::endl;
2077 Xyce::dout() <<
" r_factor_ = " <<
sec.
r_factor_ << std::endl;
2078 Xyce::dout() <<
" r_safety_ = " <<
sec.
r_safety_ << std::endl;
2079 Xyce::dout() <<
" Est_ = " <<
sec.
Est_ << std::endl;
2080 Xyce::dout() <<
" r_fudge_ = " <<
sec.
r_fudge_ << std::endl;
2081 Xyce::dout() <<
" newOrder_ = " <<
sec.
newOrder_ << std::endl;
2083 Xyce::dout() <<
" newTimeStep_ = " << newTimeStep_ << std::endl;
2088 std::string tmp =
" BackwardDifferentiation15:rejectStep: Warning: Local error test failed with constant step-size.\n";
2089 Xyce::dout() << tmp << std::endl;
2111 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2113 Xyce::dout() <<
" newTimeStep_ = " << newTimeStep_ << std::endl;
2114 Xyce::dout() <<
" nextTime = " <<
sec.
nextTime << std::endl;
2134 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2136 Xyce::dout() << Xyce::section_divider << std::endl;
2164 enum {TIAAction_UNSET, TIAAction_LOWER, TIAAction_MAINTAIN, TIAAction_RAISE};
2173 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2175 Xyce::dout() << std::endl;
2176 Xyce::dout() << Xyce::section_divider << std::endl;
2177 Xyce::dout() <<
" BackwardDifferentiation15::completeStep" << std::endl;
2209 int action = TIAAction_UNSET;
2211 action = TIAAction_LOWER;
2213 action = TIAAction_MAINTAIN;
2218 action = TIAAction_MAINTAIN;
2222 #ifndef Xyce_USE_Q_NORM
2224 #ifdef Xyce_INCOMPLETE_2LEVEL_NORMS
2225 double dnorm_x = 0.0;
2231 double dnorm = dnorm_x;
2235 double dnorm_x = 0.0, dnorm_q = 0.0;
2238 double dnorm = sqrt(0.5*dnorm_x*dnorm_x+0.5*dnorm_q*dnorm_q);
2246 action = TIAAction_MAINTAIN;
2248 action = TIAAction_RAISE;
2253 action = TIAAction_LOWER;
2255 action = TIAAction_MAINTAIN;
2257 action = TIAAction_RAISE;
2262 action = TIAAction_RAISE;
2266 action = TIAAction_MAINTAIN;
2268 if (action == TIAAction_RAISE)
2273 else if (action == TIAAction_LOWER)
2291 #ifndef Xyce_USE_Q_NORM
2297 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2300 Xyce::dout() <<
" r_safety = " <<
sec.
r_safety_ << std::endl;
2301 Xyce::dout() <<
" r_fudge_ = " <<
sec.
r_fudge_ << std::endl;
2302 Xyce::dout() <<
" r_hincr_ = " <<
sec.
r_hincr_ << std::endl;
2304 Xyce::dout() <<
" Est = " <<
sec.
Est_ << std::endl;
2305 Xyce::dout() <<
" Ekp1_ = " <<
sec.
Ekp1_ << std::endl;
2306 Xyce::dout() <<
" Ekm1_ = " <<
sec.
Ekm1_ << std::endl;
2307 Xyce::dout() <<
" Tkp1_ = " <<
sec.
Tkp1_ << std::endl;
2308 Xyce::dout() <<
" raw rr = " << rr << std::endl;
2323 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2326 Xyce::dout() <<
" rr = " << rr << std::endl;
2328 Xyce::dout() <<
" currentTime = " <<
sec.
currentTime << std::endl;
2329 Xyce::dout() <<
" nextTime = " <<
sec.
nextTime << std::endl;
2330 Xyce::dout() <<
" newTimeStep_ = " << newTimeStep_ << std::endl;
2331 Xyce::dout() <<
" minTimeStep = " <<
sec.
minTimeStep << std::endl;
2332 Xyce::dout() <<
" maxTimeStep = " <<
sec.
maxTimeStep << std::endl;
2366 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2368 Xyce::dout() <<
" nextTime = " <<
sec.
nextTime << std::endl;
2369 Xyce::dout() <<
" newTimeStep_ = " << newTimeStep_ << std::endl;
2390 if (DEBUG_TIME && isActive(Diag::TIME_STEP))
2392 Xyce::dout() << Xyce::section_divider << std::endl;
2486 if (DEBUG_TIME && isActive(Diag::TIME_ERROR))
2487 Xyce::dout() << tle;
2502 Xyce::Report::UserWarning() <<
"Excessively small current time step, incorrectly returning with large value";
Linear::Vector * sNewtonCorrectionPtr
BackwardDifferentiation15(const TIAParams &tia_params, StepErrorControl &step_error_control, DataStore &data_store)
Linear::Vector * nextLeadCurrentQPtr
Linear::Vector * leadCurrentQn0Ptr
double delta_x_errorNorm_p1()
int newtonConvergenceStatus
void completeStep(const TIAParams &tia_params)
double partialErrorNormSum()
Linear::Vector * tmpLeadDeltaVPtr
std::vector< double > sigma_
void setTwoLevelTimeInfo(const TimeIntInfo &tiInfo)
Linear::Vector * stoNewtonCorrectionPtr
Linear::Vector * qErrWtVecPtr
Pure virtual class to augment a linear system.
std::vector< double > dOdpVec_
std::vector< double > scaled_dOdpVec_
void updateLeadCurrentVec()
StepErrorControl & sec
Reference to step-error control object.
void getInitialQnorm(TwoLevelError &tle) const
Linear::Vector * tmpStaVectorPtr
Linear::Vector * currStorePtr
std::vector< double > scaled_dOdpAdjVec_
std::vector< Linear::Vector * > leadDeltaVHistory
Linear::Vector * tmpSolVectorPtr
ScalarT Xycemax(ScalarT f1, ScalarT f2)
double delta_x_errorNorm_m1()
Linear::Vector * leadCurrentpn0Ptr
Linear::Vector * leadCurrentNewtonCorrectionPtr
double partialSum_m2(int currentOrder)
int errorAnalysisOption
Error analysis option.
bool interpolateSolution(double timepoint, Linear::Vector *tmpSolVectorPtr, std::vector< Linear::Vector * > &historyVec)
Linear::Vector * ston0Ptr
Linear::Vector * tmpStoVectorPtr
double computeExpoStepAdjust(double stepadjust)
std::vector< Linear::Vector * > qHistory
Linear::Vector * currStatePtr
std::vector< double > objectiveVec_
double lastAttemptedTimeStep
std::vector< Linear::Vector * > leadCurrentHistory
bool constantTimeStepFlag
Constant time step integration flag.
void obtainSensitivityResiduals()
Linear::Vector * leadDeltaVn0Ptr
Linear::Vector * leadCurrentn0Ptr
Linear::Vector * daeQVectorPtr
Linear::Vector * tmpLeadCurrentVectorPtr
bool printWaMPDEOutputSolution(Analysis::OutputMgrAdapter &outputManagerAdapter, const double time, Linear::Vector *solnVecPtr, const std::vector< double > &fastTimes, const int phiGID)
void getTwoLevelError(TwoLevelError &tle) const
double partialSum_p1(int currentOrder, int maxOrder)
void initialize(const TIAParams &tia_params)
Linear::Vector * stopn0Ptr
Linear::Vector * leadCurrentQpn0Ptr
void setTimeStep(double newTimeStep)
double currentTimeStepRatio
Linear::Vector * daeFVectorPtr
double leadingCoeff
Time-integration method leading coefficient value.
Linear::Vector * qNewtonCorrectionPtr
Linear::Vector * currLeadCurrentQPtr
Linear::Vector * nextStoreLeadCurrQDerivPtr
bool saveOutputSolution(Analysis::OutputMgrAdapter &outputManagerAdapter, const TIAParams &tia_params, Linear::Vector *solnVecPtr, const double saveTime, const bool doNotInterpolate)
Linear::Vector * leadCurrentQNewtonCorrectionPtr
Linear::Vector * errWtVecPtr
Linear::Matrix * dFdxMatrixPtr
Linear::Matrix * JMatrixPtr
static TimeIntegrationMethod * factory(const TIAParams &tia_params, StepErrorControl &step_error_control, DataStore &data_store)
Linear::Vector * nextStatePtr
std::vector< Linear::Vector * > leadCurrentQHistory
void tranOutput(double time, Linear::Vector &currSolutionPtr, Linear::Vector &stateVecPtr, Linear::Vector &storeVecPtr, Linear::Vector &lead_current_vector, Linear::Vector &junction_voltage_vector, std::vector< double > &objectiveVec_, std::vector< double > &dOdpVec_, std::vector< double > &dOdpAdjVec_, std::vector< double > &scaled_dOdpVec_, std::vector< double > &scaled_dOdpAdjVec_, bool skipPrintLineOutput=false)
bool printMPDEOutputSolution(Analysis::OutputMgrAdapter &outputManagerAdapter, const double time, Linear::Vector *solnVecPtr, const std::vector< double > &fastTimes)
Linear::Vector * dFdxdVpVectorPtr
Linear::Vector * currLeadDeltaVPtr
std::vector< double > beta_
double delta_x_errorNorm_q1()
Linear::Vector * currStoreLeadCurrQPtr
int numberSuccessiveFailures
Linear::Vector * stoLeadCurrQNewtonCorrectionPtr
bool interpolateMPDESolution(std::vector< double > &timepoint, Linear::Vector *tmpSolVectorPtr)
Linear::Vector * nextSolutionPtr
Linear::Vector * RHSVectorPtr
double delta_x_errorNorm_m2()
Linear::Vector * tmpXn0BPtr
Linear::Vector * nextStorePtr
Linear::Vector * stoQn0Ptr
void rejectStep(const TIAParams &tia_params)
std::vector< double > psi_
double timept_
Keep track of last interpolation point in printMPDEOutputSolution.
Linear::Vector * dQdxdVpVectorPtr
double partialTimeDeriv() const
double currentTimeStepSum
bool printOutputSolution(Analysis::OutputMgrAdapter &outputManagerAdapter, const TIAParams &tia_params, const double time, Linear::Vector *solnVecPtr, const bool doNotInterpolate, const std::vector< double > &outputInterpolationTimes, bool skipPrintLineOutput)
Linear::Vector * currLeadCurrentPtr
std::vector< double > dOdpAdjVec_
Linear::Vector * nextLeadCurrentQDerivPtr
Linear::Vector * newtonCorrectionPtr
Linear::Vector * tmpXn0APtr
Linear::Vector * currSolutionPtr
std::vector< Linear::Vector * > stoHistory
Linear::Vector * stoQpn0Ptr
Linear::Vector * nextStoreLeadCurrQPtr
Linear::Vector * nextStateDerivPtr
std::vector< Linear::Vector * > xHistory
void outputDCOP(const Linear::Vector &solution)
std::vector< double > alpha_
Linear::Matrix * dQdxMatrixPtr
double partialSum_m1(int currentOrder)
ScalarT Xycemin(ScalarT f1, ScalarT f2)
Linear::Vector * daeBVectorPtr
Linear::Vector * leadDeltaVpn0Ptr
void rejectStepForHabanero()
Linear::Vector * leadDeltaVNewtonCorrectionPtr
std::vector< Linear::Vector * > stoLeadCurrQHistory
double partialQErrorNormSum()
std::vector< double > gamma_
DataStore & ds
Reference to the TIA data-store object.
Linear::Vector * nextLeadCurrentPtr
std::vector< Linear::Vector * > sHistory