63USQKCJ3L6WLAOQLJWORPD7TRKLYMRNQOSCEJTMY4RYXJT66XSAC CCTK_REAL state2 TYPE=gf TAGS='rhs="TestODESolvers::rhs2"' "State vector, stepped with twice the timestep"CCTK_REAL rhs2 TYPE=gf "RHS of state vector"CCTK_REAL error2 TYPE=gf "Error in state vector"CCTK_REAL corder TYPE=gf "Estimate for convergence order"
// I want to step state2 with twice the stepsize, so need to adjust the time// at the RK substeps to have t_(k) = t0 + k dt * 2// TODO: this will break when using more than 1 threadstatic int last_it = -1;static CCTK_REAL original_time;#pragma omp criticalif(last_it != cctk_iteration) {last_it = cctk_iteration;original_time = cctk_time;}const CCTK_REAL cctk_time2 = original_time + 2*(cctk_time - original_time);
rhs[ind] = order * pow(1 + cctk_time, order - 1);
// solving u(t) for (1 + t)^(order - 1) = u_inverse gives:const CCTK_REAL u_inverse = pow(state[ind], (order - 1) / CCTK_REAL(order));// mix in some of the state vector and some of the analytic RHSrhs[ind] = 0.5*order*(u_inverse + pow(1. + cctk_time, order - 1));if(cctk_iteration % 2) {const CCTK_REAL u_inverse2 = pow(state2[ind], (order - 1) / CCTK_REAL(order));rhs2[ind] = 2*0.5*order*(u_inverse2 + pow(1. + cctk_time2, order - 1));} else {rhs2[ind] = 0.;}