Skip to content

Commit

Permalink
Unresolved issues and build test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
maggul committed Oct 8, 2024
1 parent 07ae3f7 commit c00540a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 38 deletions.
15 changes: 10 additions & 5 deletions doc/arkode/guide/source/Constants.rst
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,20 @@ contains the ARKODE output constants.
+-----------------------------------------------+------------------------------------------------------------+
| **LSRK method types** | |
+-----------------------------------------------+------------------------------------------------------------+
| :index:`ARKODE_LSRK_RKC_2` | 2nd order Runge-Kutta-Chebyshev (RKC) method. |
| :index:`ARKODE_LSRK_RKC_2` | 2nd order Runge-Kutta-Chebyshev (RKC) method |
| | :c:enumerator:`ARKODE_LSRK_RKC_2` |
+-----------------------------------------------+------------------------------------------------------------+
| :index:`ARKODE_LSRK_RKL_2` | 2nd order Runge-Kutta-Legendre (RKL) method. |
| :index:`ARKODE_LSRK_RKL_2` | 2nd order Runge-Kutta-Legendre (RKL) method |
| | :c:enumerator:`ARKODE_LSRK_RKL_2` |
+-----------------------------------------------+------------------------------------------------------------+
| :index:`ARKODE_LSRK_SSP_S_2` | Optimal 2nd order s-stage SSP RK method. |
| :index:`ARKODE_LSRK_SSP_S_2` | Optimal 2nd order s-stage SSP RK method |
| | :c:enumerator:`ARKODE_LSRK_SSP_S_2` |
+-----------------------------------------------+------------------------------------------------------------+
| :index:`ARKODE_LSRK_SSP_S_3` | Optimal 3rd order s-stage SSP RK method. |
| :index:`ARKODE_LSRK_SSP_S_3` | Optimal 3rd order s-stage SSP RK method |
| | :c:enumerator:`ARKODE_LSRK_SSP_S_3` |
+-----------------------------------------------+------------------------------------------------------------+
| :index:`ARKODE_LSRK_SSP_10_4` | Optimal 4th order 10-stage SSP RK method. |
| :index:`ARKODE_LSRK_SSP_10_4` | Optimal 4th order 10-stage SSP RK method |
| | :c:enumerator:`ARKODE_LSRK_SSP_10_4` |
+-----------------------------------------------+------------------------------------------------------------+
| | |
+-----------------------------------------------+------------------------------------------------------------+
Expand Down
24 changes: 12 additions & 12 deletions doc/arkode/guide/source/Usage/LSRKStep/User_callable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ Allowable Method Families
Sets the number of stages, ``s`` in ``SSP(s, p)`` methods. This input is only utilized by SSPRK methods. Thus,
this set routine must be called after calling LSRKStepSetMethod with an SSPRK method.

* ``ARKODE_LSRK_SSP_S_2`` -- ``num_of_stages`` must be greater than or equal to 2
* ``ARKODE_LSRK_SSP_S_3`` -- ``num_of_stages`` must be a perfect-square greater than or equal to 4
* ``ARKODE_LSRK_SSP_10_4`` -- ``num_of_stages`` cannot be modified from 10, so this function should not be called.
* :c:enumerator:`ARKODE_LSRK_SSP_S_2` -- ``num_of_stages`` must be greater than or equal to 2
* :c:enumerator:`ARKODE_LSRK_SSP_S_3` -- ``num_of_stages`` must be a perfect-square greater than or equal to 9
* :c:enumerator:`ARKODE_LSRK_SSP_10_4` -- ``num_of_stages`` cannot be modified from 10, so this function should not be called.

**Arguments:**
* *arkode_mem* -- pointer to the LSRKStep memory block.
Expand All @@ -232,9 +232,9 @@ Allowable Method Families
.. note:: If LSRKStepSetSSPStageNum routine is not called, then the default ``num_of_stages`` is
set. Calling this function with ``num_of_stages <= 0`` resets the default values:

* ``num_of_stages = 10`` for ``ARKODE_LSRK_SSP_S_2``
* ``num_of_stages = 9`` for ``ARKODE_LSRK_SSP_S_3``
* ``num_of_stages = 10`` for ``ARKODE_LSRK_SSP_10_4``
* ``num_of_stages = 10`` for :c:enumerator:`ARKODE_LSRK_SSP_S_2`
* ``num_of_stages = 9`` for :c:enumerator:`ARKODE_LSRK_SSP_S_3`
* ``num_of_stages = 10`` for :c:enumerator:`ARKODE_LSRK_SSP_10_4`

.. _ARKODE.Usage.LSRKStep.OptionalOutputs:

Expand Down Expand Up @@ -361,13 +361,13 @@ dependent variable vector.

**Return value:**
* *ARK_SUCCESS* if successful
* *ARK_MEM_NULL* if the LSRKStep memory was ``NULL``
* *ARK_MEM_FAIL* if memory allocation failed
* *ARK_NO_MALLOC* if memory allocation failed
* *ARK_CONTROLLER_ERR* if unable to reset error controller object
* *ARK_MEM_NULL* if the LSRKStep memory was ``NULL``
* *ARK_MEM_FAIL* if memory allocation failed
* *ARK_NO_MALLOC* if memory allocation failed
* *ARK_CONTROLLER_ERR* if unable to reset error controller object
* *ARK_ILL_INPUT* if an argument had an illegal value.

**Notes:**
.. note::
All previously set options are retained but may be updated by calling
the appropriate "Set" functions.

Expand Down
4 changes: 2 additions & 2 deletions examples/arkode/CXX_manyvector/ark_sod_lsrk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int main(int argc, char* argv[])
N_Vector vecs[NSPECIES];
for (int i = 0; i < NSPECIES; i++)
{
vecs[i] = N_VNew_Serial(udata.nx, ctx); // rho (density)
vecs[i] = N_VNew_Serial((sunindextype)udata.nx, ctx); // rho (density)
if (check_ptr(vecs[i], "N_VNew_Serial")) { return 1; }
}
N_Vector y = N_VNew_ManyVector(NSPECIES, vecs, ctx);
Expand Down Expand Up @@ -563,7 +563,7 @@ int SetIC(N_Vector y, EulerData& udata)

for (long int i = 0; i < udata.nx; i++)
{
sunrealtype xloc = (i + HALF) * udata.dx + udata.xl;
sunrealtype xloc = ((sunrealtype)i + HALF) * udata.dx + udata.xl;
if (xloc < HALF)
{
rho[i] = rhoL;
Expand Down
12 changes: 6 additions & 6 deletions examples/arkode/CXX_manyvector/ark_sod_lsrk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ static int ReadInputs(std::vector<std::string>& args, EulerData& udata,
find_arg(args, "--nout", uopts.nout);

// Recompute mesh spacing and [re]allocate flux array
udata.dx = (udata.xr - udata.xl) / (udata.nx);
udata.dx = (udata.xr - udata.xl) / ((sunrealtype)udata.nx);
if (udata.flux) { delete[] udata.flux; }
udata.flux = new sunrealtype[NSPECIES * (udata.nx + 1)];

Expand Down Expand Up @@ -476,11 +476,11 @@ static int WriteOutput(sunrealtype t, N_Vector y, EulerData& udata,
N_Vector my = N_VGetSubvector_ManyVector(y, 2);
N_Vector mz = N_VGetSubvector_ManyVector(y, 3);
N_Vector et = N_VGetSubvector_ManyVector(y, 4);
sunrealtype rhorms = sqrt(N_VDotProd(rho, rho) / udata.nx);
sunrealtype mxrms = sqrt(N_VDotProd(mx, mx) / udata.nx);
sunrealtype myrms = sqrt(N_VDotProd(my, my) / udata.nx);
sunrealtype mzrms = sqrt(N_VDotProd(mz, mz) / udata.nx);
sunrealtype etrms = sqrt(N_VDotProd(et, et) / udata.nx);
sunrealtype rhorms = sqrt(N_VDotProd(rho, rho) / (sunrealtype)udata.nx);
sunrealtype mxrms = sqrt(N_VDotProd(mx, mx) / (sunrealtype)udata.nx);
sunrealtype myrms = sqrt(N_VDotProd(my, my) / (sunrealtype)udata.nx);
sunrealtype mzrms = sqrt(N_VDotProd(mz, mz) / (sunrealtype)udata.nx);
sunrealtype etrms = sqrt(N_VDotProd(et, et) / (sunrealtype)udata.nx);
std::cout << std::setprecision(2) << " " << t << std::setprecision(5)
<< " " << rhorms << " " << mxrms << " " << myrms << " "
<< mzrms << " " << etrms << std::endl;
Expand Down
6 changes: 3 additions & 3 deletions include/sundials/sundials_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ extern "C" {
* -----------------------------------------------------------------
* Function : SUNIfloor
* -----------------------------------------------------------------
* Usage : sunrealtype floor_x;
* Usage : sunindextype floor_x;
* floor_x = SUNIfloor(x);
* -----------------------------------------------------------------
* SUNIfloor(x) returns the largest sunindextype value not greater than x.
Expand All @@ -347,10 +347,10 @@ extern "C" {
* -----------------------------------------------------------------
* Function : SUNIround
* -----------------------------------------------------------------
* Usage : sunrealtype round_x;
* Usage : sunindextype round_x;
* round_x = SUNIround(x);
* -----------------------------------------------------------------
* SUNIround(x) returns the nearest integer value to x (in floating-point format),
* SUNIround(x) returns the nearest sunindextype value to x,
* rounding halfway cases away from zero, regardless of the current rounding mode.
* -----------------------------------------------------------------
*/
Expand Down
16 changes: 6 additions & 10 deletions src/arkode/arkode_lsrkstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,11 @@ int lsrkStep_FullRHS(ARKodeMem ark_mem, sunrealtype t, N_Vector y, N_Vector f,
int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
{
int retval;
sunrealtype* cvals;
sunrealtype hmax, w0, w1, temp1, temp2, arg, bjm1, bjm2, mus, thjm1, thjm2,
zjm1, zjm2, dzjm1, dzjm2, d2zjm1, d2zjm2, zj, dzj, d2zj, bj, ajm1, mu, nu,
thj;
const sunrealtype onep54 = SUN_RCONST(1.54), c13 = SUN_RCONST(13.0),
p8 = SUN_RCONST(0.8), p4 = SUN_RCONST(0.4);
N_Vector* Xvecs;
ARKodeLSRKStepMem step_mem;

/* initialize algebraic solver convergence flag to success,
Expand All @@ -497,8 +495,8 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
retval = lsrkStep_AccessStepMem(ark_mem, __func__, &step_mem);
if (retval != ARK_SUCCESS) { return retval; }

cvals = step_mem->cvals;
Xvecs = step_mem->Xvecs;
sunrealtype* cvals = step_mem->cvals;
N_Vector* Xvecs = step_mem->Xvecs;

/* Compute dominant eigenvalue and update stats */
if (step_mem->dom_eig_update)
Expand All @@ -513,7 +511,7 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
SUNRsqrt(onep54 * SUNRabs(ark_mem->h) * step_mem->spectral_radius));
ss = SUNMAX(ss, 2);
step_mem->req_stages = SUNMIN(ss, step_mem->stage_max_limit);
if (step_mem->req_stages == step_mem->stage_max_limit)
if (step_mem->req_stages >= step_mem->stage_max_limit)
{
if (!ark_mem->fixedstep)
{
Expand Down Expand Up @@ -757,10 +755,8 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
{
int retval;
sunrealtype* cvals;
sunrealtype hmax, w1, bjm1, bjm2, mus, bj, ajm1, cjm1, temj, cj, mu, nu;
const sunrealtype p8 = SUN_RCONST(0.8), p4 = SUN_RCONST(0.4);
N_Vector* Xvecs;
ARKodeLSRKStepMem step_mem;

/* initialize algebraic solver convergence flag to success,
Expand All @@ -772,8 +768,8 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
retval = lsrkStep_AccessStepMem(ark_mem, __func__, &step_mem);
if (retval != ARK_SUCCESS) { return retval; }

cvals = step_mem->cvals;
Xvecs = step_mem->Xvecs;
sunrealtype* cvals = step_mem->cvals;
N_Vector* Xvecs = step_mem->Xvecs;

/* Compute dominant eigenvalue and update stats */
if (step_mem->dom_eig_update)
Expand All @@ -791,7 +787,7 @@ int lsrkStep_TakeStepRKL(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr)
ss = SUNMAX(ss, 2);
step_mem->req_stages = SUNMIN(ss, step_mem->stage_max_limit);

if (step_mem->req_stages == step_mem->stage_max_limit)
if (step_mem->req_stages >= step_mem->stage_max_limit)
{
if (!ark_mem->fixedstep)
{
Expand Down

0 comments on commit c00540a

Please sign in to comment.