diff --git a/benchmarks/diffusion_2D/main_arkode.cpp b/benchmarks/diffusion_2D/main_arkode.cpp index 9820f653a2..0675a34cc9 100644 --- a/benchmarks/diffusion_2D/main_arkode.cpp +++ b/benchmarks/diffusion_2D/main_arkode.cpp @@ -52,10 +52,9 @@ struct UserOptions // LSRKStep-specific dominant eigenvalue function prototype // ----------------------------------------------------------------------------- -static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, - sunrealtype* lambdaR, sunrealtype* lambdaI, - void* user_data, - N_Vector temp1, N_Vector temp2, N_Vector temp3); +static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3); // ----------------------------------------------------------------------------- // Main Program @@ -469,10 +468,9 @@ int main(int argc, char* argv[]) // Dominant eigenvalue estimation function // ----------------------------------------------------------------------------- -static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, - sunrealtype* lambdaR, sunrealtype* lambdaI, - void* user_data, - N_Vector temp1, N_Vector temp2, N_Vector temp3) +static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3) { // Access problem data UserData* udata = (UserData*)user_data; diff --git a/examples/arkode/CXX_manyvector/ark_sod_lsrk.cpp b/examples/arkode/CXX_manyvector/ark_sod_lsrk.cpp index dcad2f9fa2..975e7d558b 100644 --- a/examples/arkode/CXX_manyvector/ark_sod_lsrk.cpp +++ b/examples/arkode/CXX_manyvector/ark_sod_lsrk.cpp @@ -320,7 +320,7 @@ void face_flux(sunrealtype (&w1d)[STSIZE][NSPECIES], sunrealtype* f_face, int i, j; sunrealtype rhosqrL, rhosqrR, rhosqrbar, u, v, w, H, qsq, csnd, cinv, gamm, alpha, beta1, beta2, beta3, w1, w2, w3, f1, f2, f3; - sunrealtype RV[5][5], LV[5][5], p[STSIZE], flux[STSIZE][NSPECIES], + sunrealtype RV[5][5], LV[5][5], p[STSIZE], flux[STSIZE][NSPECIES], fproj[5][NSPECIES], fs[5][NSPECIES], ff[NSPECIES]; const sunrealtype bc = SUN_RCONST(1.083333333333333333333333333333333333333); // 13/12 @@ -416,7 +416,7 @@ void face_flux(sunrealtype (&w1d)[STSIZE][NSPECIES], sunrealtype* f_face, flux[j][2] = u * w1d[j][2]; // f_my = rho*v*u = my*u flux[j][3] = u * w1d[j][3]; // f_mz = rho*w*u = mz*u flux[j][4] = u * (w1d[j][4] + p[j]); // f_et = u*(et + p) - csnd = sqrt(udata.gamma * p[j] / w1d[j][0]); // csnd = sqrt(gamma*p/rho) + csnd = sqrt(udata.gamma * p[j] / w1d[j][0]); // csnd = sqrt(gamma*p/rho) alpha = max(alpha, abs(u) + csnd); } diff --git a/examples/arkode/CXX_manyvector/ark_sod_lsrk.hpp b/examples/arkode/CXX_manyvector/ark_sod_lsrk.hpp index b560f55e18..68778def97 100644 --- a/examples/arkode/CXX_manyvector/ark_sod_lsrk.hpp +++ b/examples/arkode/CXX_manyvector/ark_sod_lsrk.hpp @@ -47,11 +47,10 @@ #define FOURTH SUN_RCONST(0.25) #define NSPECIES 5 -#define STSIZE 6 +#define STSIZE 6 #define WIDTH (10 + std::numeric_limits::digits10) - // ----------------------------------------------------------------------------- // Problem options // ----------------------------------------------------------------------------- @@ -78,8 +77,8 @@ class ARKODEParameters int maxsteps; // Output-related information - int output; // 0 = none, 1 = stats, 2 = disk, 3 = disk with tstop - int nout; // number of output times + int output; // 0 = none, 1 = stats, 2 = disk, 3 = disk with tstop + int nout; // number of output times std::ofstream uout; // output file stream // constructor (with default values) @@ -257,11 +256,11 @@ static void InputHelp() { std::cout << std::endl; std::cout << "Command line options:" << std::endl; - std::cout - << " --integrator : method (ARKODE_LSRK_SSP_S_2, ARKODE_LSRK_SSP_S_3, " - "ARKODE_LSRK_SSP_10_4, or any valid ARKODE_ERKTableID)\n"; + std::cout << " --integrator : method (ARKODE_LSRK_SSP_S_2, " + "ARKODE_LSRK_SSP_S_3, " + "ARKODE_LSRK_SSP_10_4, or any valid ARKODE_ERKTableID)\n"; std::cout << " --stages : number of stages (ignored for " - "ARKODE_LSRK_SSP_10_4 and ERK)\n"; + "ARKODE_LSRK_SSP_10_4 and ERK)\n"; std::cout << " --tf : final time\n"; std::cout << " --xl : domain lower boundary\n"; std::cout << " --xr : domain upper boundary\n"; @@ -276,7 +275,8 @@ static void InputHelp() std::cout << " --help : print options and exit\n"; } -inline void find_arg(std::vector& args, const std::string key, sunrealtype& dest) +inline void find_arg(std::vector& args, const std::string key, + sunrealtype& dest) { auto it = find(args.begin(), args.end(), key); if (it != args.end()) @@ -292,7 +292,8 @@ inline void find_arg(std::vector& args, const std::string key, sunr } } -inline void find_arg(std::vector& args, const std::string key, long int& dest) +inline void find_arg(std::vector& args, const std::string key, + long int& dest) { auto it = find(args.begin(), args.end(), key); if (it != args.end()) @@ -302,7 +303,8 @@ inline void find_arg(std::vector& args, const std::string key, long } } -inline void find_arg(std::vector& args, const std::string key, int& dest) +inline void find_arg(std::vector& args, const std::string key, + int& dest) { auto it = find(args.begin(), args.end(), key); if (it != args.end()) @@ -312,7 +314,8 @@ inline void find_arg(std::vector& args, const std::string key, int& } } -inline void find_arg(std::vector& args, const std::string key, std::string& dest) +inline void find_arg(std::vector& args, const std::string key, + std::string& dest) { auto it = find(args.begin(), args.end(), key); if (it != args.end()) @@ -322,8 +325,8 @@ inline void find_arg(std::vector& args, const std::string key, std: } } -inline void find_arg(std::vector& args, const std::string key, bool& dest, - bool store = true) +inline void find_arg(std::vector& args, const std::string key, + bool& dest, bool store = true) { auto it = find(args.begin(), args.end(), key); if (it != args.end()) @@ -387,7 +390,10 @@ static int PrintSetup(EulerData& udata, ARKODEParameters& uopts) std::cout << " dx = " << udata.dx << std::endl; std::cout << " --------------------------------- " << std::endl; std::cout << " integrator = " << uopts.integrator << std::endl; - if (uopts.stages > 0) { std::cout << " stages = " << uopts.stages << std::endl; } + if (uopts.stages > 0) + { + std::cout << " stages = " << uopts.stages << std::endl; + } std::cout << " rtol = " << uopts.rtol << std::endl; std::cout << " atol = " << uopts.atol << std::endl; std::cout << " fixed h = " << uopts.fixed_h << std::endl; @@ -408,14 +414,15 @@ static int OpenOutput(EulerData& udata, ARKODEParameters& uopts) std::cout << std::scientific; std::cout << std::setprecision(std::numeric_limits::digits10); std::cout << " t " - << " ||rho|| " - << " ||mx|| " - << " ||my|| " - << " ||mz|| " - << " ||et||" << std::endl; - std::cout << " -----------------------------------------------------------------" - "---------" - << std::endl; + << " ||rho|| " + << " ||mx|| " + << " ||my|| " + << " ||mz|| " + << " ||et||" << std::endl; + std::cout + << " -----------------------------------------------------------------" + "---------" + << std::endl; } // Open output stream and output problem information @@ -457,9 +464,9 @@ static int WriteOutput(sunrealtype t, N_Vector y, EulerData& udata, 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); - std::cout << std::setprecision(2) << " " << t << std::setprecision(5) << " " << rhorms - << " " << mxrms << " " << myrms << " " << mzrms << " " << etrms - << std::endl; + std::cout << std::setprecision(2) << " " << t << std::setprecision(5) + << " " << rhorms << " " << mxrms << " " << myrms << " " + << mzrms << " " << etrms << std::endl; // Write solution to disk if (uopts.output >= 2) @@ -497,9 +504,10 @@ static int CloseOutput(ARKODEParameters& uopts) // Footer for status output if (uopts.output) { - std::cout << " -----------------------------------------------------------------" - "---------" - << std::endl; + std::cout + << " -----------------------------------------------------------------" + "---------" + << std::endl; std::cout << std::endl; } diff --git a/examples/arkode/CXX_serial/ark_heat2D_lsrk.cpp b/examples/arkode/CXX_serial/ark_heat2D_lsrk.cpp index 7766fe57ea..1dbba93ee1 100644 --- a/examples/arkode/CXX_serial/ark_heat2D_lsrk.cpp +++ b/examples/arkode/CXX_serial/ark_heat2D_lsrk.cpp @@ -140,10 +140,9 @@ struct UserData static int f(sunrealtype t, N_Vector u, N_Vector f, void* user_data); // Spectral radius estimation routine -static int eig(sunrealtype t, N_Vector y, N_Vector fn, - sunrealtype* lambdaR, sunrealtype* lambdaI, - void* user_data, - N_Vector temp1, N_Vector temp2, N_Vector temp3); +static int eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3); // ----------------------------------------------------------------------------- // UserData and input functions @@ -499,10 +498,9 @@ static int f(sunrealtype t, N_Vector u, N_Vector f, void* user_data) } // Spectral radius estimation routine -static int eig(sunrealtype t, N_Vector y, N_Vector fn, - sunrealtype* lambdaR, sunrealtype* lambdaI, - void* user_data, - N_Vector temp1, N_Vector temp2, N_Vector temp3) +static int eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3) { // Access problem data UserData* udata = (UserData*)user_data; diff --git a/examples/arkode/C_serial/lsrk_analytic.c b/examples/arkode/C_serial/lsrk_analytic.c index 5e1e8dbaa7..98bfadfc4b 100644 --- a/examples/arkode/C_serial/lsrk_analytic.c +++ b/examples/arkode/C_serial/lsrk_analytic.c @@ -47,21 +47,20 @@ #endif #if defined(SUNDIALS_DOUBLE_PRECISION) -#define ATAN(x) (atan((x))) +#define ATAN(x) (atan((x))) #elif defined(SUNDIALS_SINGLE_PRECISION) -#define ATAN(x) (atanf((x))) +#define ATAN(x) (atanf((x))) #elif defined(SUNDIALS_EXTENDED_PRECISION) -#define ATAN(x) (atanl((x))) +#define ATAN(x) (atanl((x))) #endif /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); /* User-supplied Dominated Eigenvalue Called by the Solver */ -static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, - sunrealtype* lambdaR, sunrealtype* lambdaI, - void* user_data, - N_Vector temp1, N_Vector temp2, N_Vector temp3); +static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3); /* Private function to check function return values */ static int check_flag(void* flagvalue, const char* funcname, int opt); @@ -222,10 +221,9 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) } /* dom_eig routine to estimate the dominated eigenvalue */ -static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, - sunrealtype* lambdaR, sunrealtype* lambdaI, - void* user_data, - N_Vector temp1, N_Vector temp2, N_Vector temp3) +static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter */ diff --git a/examples/arkode/C_serial/lsrk_analytic_varjac.c b/examples/arkode/C_serial/lsrk_analytic_varjac.c index a9939cd15b..712de34943 100644 --- a/examples/arkode/C_serial/lsrk_analytic_varjac.c +++ b/examples/arkode/C_serial/lsrk_analytic_varjac.c @@ -48,27 +48,26 @@ #endif #if defined(SUNDIALS_DOUBLE_PRECISION) -#define ATAN(x) (atan((x))) -#define ACOS(x) (acos((x))) -#define COS(x) (cos((x))) +#define ATAN(x) (atan((x))) +#define ACOS(x) (acos((x))) +#define COS(x) (cos((x))) #elif defined(SUNDIALS_SINGLE_PRECISION) -#define ATAN(x) (atanf((x))) -#define ACOS(x) (acosf((x))) -#define COS(x) (cosf((x))) +#define ATAN(x) (atanf((x))) +#define ACOS(x) (acosf((x))) +#define COS(x) (cosf((x))) #elif defined(SUNDIALS_EXTENDED_PRECISION) -#define ATAN(x) (atanl((x))) -#define ACOS(x) (acosl((x))) -#define COS(x) (cosl((x))) +#define ATAN(x) (atanl((x))) +#define ACOS(x) (acosl((x))) +#define COS(x) (cosl((x))) #endif /* User-supplied Functions Called by the Solver */ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); /* User-supplied Dominated Eigenvalue Called by the Solver */ -static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, - sunrealtype* lambdaR, sunrealtype* lambdaI, - void* user_data, - N_Vector temp1, N_Vector temp2, N_Vector temp3); +static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3); /* Private function to check function return values */ static int check_flag(void* flagvalue, const char* funcname, int opt); @@ -237,8 +236,9 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) } /* dom_eig routine to estimate the dominated eigenvalue */ -static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, sunrealtype* lambdaI, - void* user_data, N_Vector temp1, N_Vector temp2, N_Vector temp3) +static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, + sunrealtype* lambdaI, void* user_data, N_Vector temp1, + N_Vector temp2, N_Vector temp3) { sunrealtype* rdata = (sunrealtype*)user_data; /* cast user_data to sunrealtype */ sunrealtype lambda = rdata[0]; /* set shortcut for stiffness parameter 1 */ diff --git a/examples/arkode/C_serial/lsrk_ssp_analytic.c b/examples/arkode/C_serial/lsrk_ssp_analytic.c index 89ebe29329..e4104d173a 100644 --- a/examples/arkode/C_serial/lsrk_ssp_analytic.c +++ b/examples/arkode/C_serial/lsrk_ssp_analytic.c @@ -47,11 +47,11 @@ #endif #if defined(SUNDIALS_DOUBLE_PRECISION) -#define ATAN(x) (atan((x))) +#define ATAN(x) (atan((x))) #elif defined(SUNDIALS_SINGLE_PRECISION) -#define ATAN(x) (atanf((x))) +#define ATAN(x) (atanf((x))) #elif defined(SUNDIALS_EXTENDED_PRECISION) -#define ATAN(x) (atanl((x))) +#define ATAN(x) (atanl((x))) #endif /* User-supplied Functions Called by the Solver */ diff --git a/include/arkode/arkode_lsrkstep.h b/include/arkode/arkode_lsrkstep.h index d8b45dac7b..093da4ee57 100644 --- a/include/arkode/arkode_lsrkstep.h +++ b/include/arkode/arkode_lsrkstep.h @@ -23,7 +23,10 @@ extern "C" { #endif -typedef int (*ARKDomEigFn)(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR, sunrealtype* lambdaI, void* user_data, N_Vector temp1, N_Vector temp2, N_Vector temp3); +typedef int (*ARKDomEigFn)(sunrealtype t, N_Vector y, N_Vector fn, + sunrealtype* lambdaR, sunrealtype* lambdaI, + void* user_data, N_Vector temp1, N_Vector temp2, + N_Vector temp3); /* ------------------ * LSRKStep Constants diff --git a/src/arkode/arkode_lsrkstep.c b/src/arkode/arkode_lsrkstep.c index 85ca672745..a86d082c6d 100644 --- a/src/arkode/arkode_lsrkstep.c +++ b/src/arkode/arkode_lsrkstep.c @@ -566,8 +566,8 @@ 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, + 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); @@ -612,8 +612,6 @@ int lsrkStep_TakeStepRKC(ARKodeMem ark_mem, sunrealtype* dsmPtr, int* nflagPtr) } } - - step_mem->stagemax = SUNMAX(step_mem->reqstages, step_mem->stagemax); /* Call the full RHS if needed. If this is the first step then we may need to @@ -1439,9 +1437,10 @@ int lsrkStep_ComputeNewDomEig(ARKodeMem ark_mem, ARKodeLSRKStepMem step_mem) if ((step_mem->isextDomEig)) { - retval = step_mem->extDomEig(ark_mem->tn, ark_mem->ycur, ark_mem->fn, &step_mem->lambdaR, - &step_mem->lambdaI, ark_mem->user_data, - ark_mem->tempv1, ark_mem->tempv2, ark_mem->tempv3); + retval = step_mem->extDomEig(ark_mem->tn, ark_mem->ycur, ark_mem->fn, + &step_mem->lambdaR, &step_mem->lambdaI, + ark_mem->user_data, ark_mem->tempv1, + ark_mem->tempv2, ark_mem->tempv3); if (retval != ARK_SUCCESS) { arkProcessError(ark_mem, ARK_DOMEIG_FAIL, __LINE__, __func__, __FILE__,