@@ -482,7 +482,7 @@ void Arkode::ArkodeCore()
482482
483483 if ((_zeroFound || state_selection)&& !isInterrupted ())
484484 {
485- // Write the values of (P2)
485+
486486 if (writeEventOutput)
487487 {
488488 _continuous_system->evaluateAll (IContinuous::CONTINUOUS);
@@ -498,7 +498,7 @@ void Arkode::ArkodeCore()
498498 _ark_rt = ARK_TSTOP_RETURN;
499499 }
500500
501- // Zähler für die Anzahl der ausgegebenen Schritte erhöhen
501+
502502 ++_outStps;
503503 _tLastSuccess = _tCurrent;
504504
@@ -627,141 +627,6 @@ int Arkode::ARK_ZerofCallback(double t, N_Vector y, double *zeroval, void *user_
627627 return (0 );
628628}
629629
630- /* int Arkode::CV_JCallback(long int N, double t, N_Vector y, N_Vector fy, DlsMat Jac,void *user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
631- {
632- return 0;
633- //return ((Cvode*) user_data)->calcJacobian(t,N, tmp1, tmp2, tmp3, NV_DATA_S(y), fy, Jac);
634-
635- }*/
636-
637- // int Arkode::calcJacobian(double t, long int N, N_Vector fHelp, N_Vector errorWeight, N_Vector jthCol, double* y, N_Vector fy, DlsMat Jac)
638- // {
639- /*
640- try
641- {
642- int l,g;
643- double fnorm, minInc, *f_data, *fHelp_data, *errorWeight_data, h, srur, delta_inv;
644-
645- f_data = NV_DATA_S(fy);
646- errorWeight_data = NV_DATA_S(errorWeight);
647- fHelp_data = NV_DATA_S(fHelp);
648-
649-
650- //Get relevant info
651- _idid = CVodeGetErrWeights(_cvodeMem, errorWeight);
652- if (_idid < 0)
653- {
654- _idid = -5;
655- throw ModelicaSimulationError(SOLVER,"Cvode::calcJacobian()");
656- }
657- _idid = CVodeGetCurrentStep(_cvodeMem, &h);
658- if (_idid < 0)
659- {
660- _idid = -5;
661- throw ModelicaSimulationError(SOLVER,"Cvode::calcJacobian()");
662- }
663-
664- srur = sqrt(UROUND);
665-
666- fnorm = N_VWrmsNorm(fy, errorWeight);
667- minInc = (fnorm != 0.0) ?
668- (1000.0 * abs(h) * UROUND * N * fnorm) : 1.0;
669-
670- for(int j=0;j<N;j++)
671- {
672- _delta[j] = max(srur*abs(y[j]), minInc/errorWeight_data[j]);
673- }
674-
675- for(int j=0;j<N;j++)
676- {
677- _deltaInv[j] = 1/_delta[j];
678- }
679-
680- if (_jacobianANonzeros != 0)
681- {
682- for(int color=1; color <= _maxColors; color++)
683- {
684- for(int k=0; k < _dimSys; k++)
685- {
686- if((_colorOfColumn[k] ) == color)
687- {
688- _ysave[k] = y[k];
689- y[k]+= _delta[k];
690- }
691- }
692-
693- calcFunction(t, y, fHelp_data);
694-
695- for (int k = 0; k < _dimSys; k++)
696- {
697- if((_colorOfColumn[k]) == color)
698- {
699- y[k] = _ysave[k];
700-
701- int startOfColumn = k * _dimSys;
702- for (int j = _jacobianALeadindex[k]; j < _jacobianALeadindex[k+1];j++)
703- {
704- l = _jacobianAIndex[j];
705- g = l + startOfColumn;
706- Jac->data[g] = (fHelp_data[l] - f_data[l]) * _deltaInv[k];
707- }
708- }
709- }
710- }
711- }
712-
713-
714-
715-
716-
717- }
718- */
719-
720-
721-
722-
723-
724- /*
725- //Calculation of J without colouring
726- for (j = 0; j < N; j++)
727- {
728-
729-
730- //N_VSetArrayPointer(DENSE_COL(Jac,j), jthCol);
731-
732- _ysave[j] = y[j];
733-
734- y[j] += _delta[j];
735-
736- calcFunction(t, y, fHelp_data);
737-
738- y[j] = _ysave[j];
739-
740- delta_inv = 1.0/_delta[j];
741- N_VLinearSum(delta_inv, fHelp, -delta_inv, fy, jthCol);
742-
743- for(int i=0; i<_dimSys; ++i)
744- {
745- Jac->data[i+j*_dimSys] = NV_Ith_S(jthCol,i);
746- }
747-
748- //DENSE_COL(Jac,j) = N_VGetArrayPointer(jthCol);
749- }
750- */
751-
752- // workaround until exception can be catch from c- libraries
753- /*
754- catch (std::exception & ex )
755- {
756-
757- cerr << "CVode integration error: " << ex.what();
758- return 1;
759- }
760- */
761-
762- // return 0;
763- // }
764-
765630int Arkode::reportErrorMessage (ostream& messageStream)
766631{
767632 if (_solverStatus == ISolver::SOLVERERROR)
@@ -786,76 +651,7 @@ int Arkode::reportErrorMessage(ostream& messageStream)
786651
787652void Arkode::writeSimulationInfo ()
788653{
789- #ifdef USE_BOOST_LOG
790- /*
791- src::logger lg;
792-
793- // Now, let's try logging with severity
794- src::severity_logger<cvodeseverity_level> slg;
795-
796- long int nst, nfe, nsetups, nni, ncfn, netf;
797- long int nfQe, netfQ;
798- long int nfSe, nfeS, nsetupsS, nniS, ncfnS, netfS;
799- long int nfQSe, netfQS;
800-
801- int qlast, qcur;
802- realtype h0u, hlast, hcur, tcur;
803-
804- int flag;
805-
806- flag = CVodeGetIntegratorStats(_cvodeMem, &nst, &nfe, &nsetups, &netf, &qlast, &qcur, &h0u, &hlast, &hcur, &tcur);
807-
808- flag = CVodeGetNonlinSolvStats(_cvodeMem, &nni, &ncfn);
809-
810- BOOST_LOG_SEV(slg, cvode_normal)<< " Number steps: " << nst;
811- BOOST_LOG_SEV(slg, cvode_normal)<< " Function evaluations " << "f: " << nfe;
812- BOOST_LOG_SEV(slg, cvode_normal)<< " Error test failures " << "netf: " << netfS;
813- BOOST_LOG_SEV(slg, cvode_normal)<< " Linear solver setups " << "nsetups: " << nsetups;
814- BOOST_LOG_SEV(slg, cvode_normal)<< " Nonlinear iterations " << "nni: " << nni;
815- BOOST_LOG_SEV(slg, cvode_normal)<< " Convergence failures " << "ncfn: " << ncfn;
816- */
817- #endif
818- // // Solver
819- // outputStream << "\nSolver: " << getName()
820- // << "\nVerfahren: ";
821- // if(_cvodesettings->iMethod == EulerSettings::EULERFORWARD)
822- // outputStream << " Expliziter Cvode\n\n";
823- // else if(_cvodesettings->iMethod == EulerSettings::EULERBACKWARD)
824- // outputStream << " Impliziter Cvode\n\n";
825-
826- // // System
827- // outputStream
828- // << "Dimension des Systems (ODE): " << (int)_dimSys << "\n";
829- // // Status, Anzahl Schritte, Nullstellenzeugs
830- // SolverDefaultImplementation::writeSimulationInfo(outputStream);
831-
832- // // Nullstellensuche
833- // if (_cvodesettings->iZeroSearchMethod == SolverSettings::NO_ZERO_SEARCH)
834- // {
835- // outputStream << "Nullstellensuche: Keine\n\n" << endl;
836- // }
837- // else
838- // {
839- // /*if (_cvodesettings->iZeroSearchMethod == SolverSettings::BISECTION)
840- // {
841- // outputStream << "Nullstellensuche: Bisektion\n" << endl;
842- // }
843- // else
844- // {*/
845- // outputStream << "Nullstellensuche: Lineare Interpolation\n" << endl;
846- // /*}*/
847-
848- // }
849-
850- // // Schritteweite
851- // outputStream
852- // << "ausgegebene Schritte: " << _outStps << "\n"
853- // << "Anfangsschrittweite: " << _cvodesettings->dH_init << "\n"
854- // << "Ausgabeschrittweite: " << dynamic_cast<ISolverSettings*>(_cvodesettings)->getGlobalSettings()->gethOutput() << "\n"
855- // << "Obere Grenze für Schrittweite: " << _hUpLim << "\n\n";
856- // // Status
857- // outputStream
858- // << "Solver-Status: " << _idid << "\n\n";
654+
859655}
860656
861657int Arkode::check_flag (void *flagvalue, const char *funcname, int opt)
0 commit comments