28
28
* the value of alpha determines the radius of the interval in which
29
29
* the stiffness parameter lies.
30
30
*
31
- * The value of " lambda - alpha*cos((10 - t)/10*pi)" should
31
+ * The value of lambda - alpha*cos((10 - t)/10*pi) should
32
32
* be negative to result in a well-posed ODE; for values with magnitude
33
33
* larger than 100 the problem becomes quite stiff.
34
34
*
@@ -97,8 +97,8 @@ int main(void)
97
97
sunindextype NEQ = 1 ; /* number of dependent vars. */
98
98
sunrealtype reltol = SUN_RCONST (1.0e-8 ); /* tolerances */
99
99
sunrealtype abstol = SUN_RCONST (1.0e-8 );
100
- sunrealtype lambda = SUN_RCONST (-1.0e+6 ); /* stiffness parameter 1*/
101
- sunrealtype alpha = SUN_RCONST (1.0e+2 ); /* stiffness parameter 2*/
100
+ sunrealtype lambda = SUN_RCONST (-1.0e+6 ); /* stiffness parameter 1 */
101
+ sunrealtype alpha = SUN_RCONST (1.0e+2 ); /* stiffness parameter 2 */
102
102
sunrealtype UserData [2 ];
103
103
UserData [0 ] = lambda ;
104
104
UserData [1 ] = alpha ;
@@ -237,9 +237,9 @@ static int f(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
237
237
238
238
/* fill in the RHS function: "N_VGetArrayPointer" accesses the 0th entry of ydot */
239
239
N_VGetArrayPointer (ydot )[0 ] =
240
- (lambda - alpha * COS ((10 - t ) / 10 * ACOS (-1 ))) * u +
240
+ (lambda - alpha * COS ((SUN_RCONST ( 10.0 ) - t ) / SUN_RCONST ( 10.0 ) * ACOS (SUN_RCONST ( -1.0 ) ))) * u +
241
241
SUN_RCONST (1.0 ) / (SUN_RCONST (1.0 ) + t * t ) -
242
- (lambda - alpha * COS ((10 - t ) / 10 * ACOS (-1 ))) * ATAN (t );
242
+ (lambda - alpha * COS ((SUN_RCONST ( 10.0 ) - t ) / SUN_RCONST ( 10.0 ) * ACOS (SUN_RCONST ( -1.0 ) ))) * ATAN (t );
243
243
244
244
return 0 ; /* return with success */
245
245
}
@@ -252,8 +252,8 @@ static int dom_eig(sunrealtype t, N_Vector y, N_Vector fn, sunrealtype* lambdaR,
252
252
sunrealtype * rdata = (sunrealtype * )user_data ; /* cast user_data to sunrealtype */
253
253
sunrealtype lambda = rdata [0 ]; /* set shortcut for stiffness parameter 1 */
254
254
sunrealtype alpha = rdata [1 ]; /* set shortcut for stiffness parameter 2 */
255
- * lambdaR = (lambda - alpha * COS ((10 - t ) / 10 *
256
- ACOS (-1 ))); /* access current solution value */
255
+ * lambdaR = (lambda - alpha * COS ((SUN_RCONST ( 10.0 ) - t ) / SUN_RCONST ( 10.0 ) *
256
+ ACOS (SUN_RCONST ( -1.0 ) ))); /* access current solution value */
257
257
* lambdaI = SUN_RCONST (0.0 );
258
258
259
259
return 0 ; /* return with success */
0 commit comments