MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / CVHandleNFlag

Function CVHandleNFlag

externalpackages/PVODE/source/cvode.cpp:2060–2090  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2058*********************************************************************/
2059
2060static int CVHandleNFlag(CVodeMem cv_mem, int *nflagPtr, real saved_t,
2061 int *ncfPtr)
2062{
2063 int nflag;
2064
2065 nflag = *nflagPtr;
2066
2067 if (nflag == SOLVED) return(DO_ERROR_TEST);
2068
2069 /* The nonlinear soln. failed; increment ncfn and restore zn */
2070 ncfn++;
2071 CVRestore(cv_mem, saved_t);
2072
2073 /* Return if lsetup or lsolve failed unrecoverably */
2074 if (nflag == SETUP_FAIL_UNREC) return(SETUP_FAILED);
2075 if (nflag == SOLVE_FAIL_UNREC) return(SOLVE_FAILED);
2076
2077 /* At this point, nflag == CONV_FAIL; increment ncf */
2078
2079 (*ncfPtr)++;
2080 etamax = ONE;
2081 /* If we had MXNCF failures or |h| = hmin, return REP_CONV_FAIL */
2082 if ((ABS(h) <= hmin*ONEPSM) || (*ncfPtr == MXNCF))
2083 return(REP_CONV_FAIL);
2084
2085 /* Reduce step size; return to reattempt the step */
2086 eta = MAX(ETACF, hmin / ABS(h));
2087 *nflagPtr = PREV_CONV_FAIL;
2088 CVRescale(cv_mem);
2089 return(PREDICT_AGAIN);
2090}
2091
2092/********************** CVRestore ************************************
2093

Callers 1

CVStepFunction · 0.85

Calls 2

CVRestoreFunction · 0.85
CVRescaleFunction · 0.85

Tested by

no test coverage detected