114template<cs_lnum_t str
ide>
133 mass[i_elt] =
rho[i_elt]*vol[i_elt];
135 u_old[stride*i_elt +
k] = pvara[stride*i_elt +
k];
149template<cs_lnum_t str
ide>
155 assert(rk !=
nullptr);
157 const int n_elts = rk->
n_elts;
172 u_new[stride*i_elt +
k] = u0[stride*i_elt +
k];
174 for (
int j_stg = 0; j_stg <= i_stg; j_stg++) {
175 cs_real_t *rhs = rhs_stages + j_stg*stride*n_elts;
177 u_new[stride*i_elt +
k] +=
dt[i_elt]/mass[i_elt]*a[j_stg]
178 * rhs[i_elt*stride +
k];
182 pvar_stage[stride*i_elt +
k] = u_new[stride*i_elt +
k];
211 assert(rk !=
nullptr);
212 const int n_elts = rk->
n_elts;
219 rhs[stride*i_elt +
k] = rhs_pvar[stride*i_elt +
k];
381 assert(rk !=
nullptr);
382 const int n_elts = rk->
n_elts;
394 int df_limiter_id = -1;
402 const int ircflp = eqp->
ircflu;
410 (df_limiter_id > -1 || ircflb != 1));
414 var_t *val_ip = (var_t *)bc_coeffs_solve.val_ip;
415 var_t *val_f = (var_t *)bc_coeffs_solve.val_f;
416 var_t *flux = (var_t *)bc_coeffs_solve.flux;
417 var_t *flux_lim = (var_t *)bc_coeffs_solve.flux_lim;
431 cs_boundary_conditions_update_bc_coeff_face_values_strided<stride>
432 (ctx, f, bc_coeffs, inc, eqp, pvar,
433 val_ip, val_f, flux, flux_lim);
462 else if (stride == 6)
521 assert(rk !=
nullptr);
533 scaled_dt[i] =
dt[i] * scaling_factor;
auto parallel_for(cs_lnum_t n, F &&f, Args &&... args)
Definition: cs_dispatch.h:1570
void wait(void)
Wait (synchronize) until launched computations have finished.
Definition: cs_dispatch.h:1635
Definition: cs_dispatch.h:1711
void cs_balance_tensor(int idtvar, int f_id, int imasac, int inc, cs_equation_param_t *eqp, cs_real_6_t pvar[], const cs_real_6_t pvara[], const cs_field_bc_coeffs_t *bc_coeffs_ts, const cs_real_t val_f[][6], const cs_real_t flux[][6], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t viscel[], const cs_real_2_t weighf[], const cs_real_t weighb[], int icvflb, const int icvfli[], cs_real_6_t rhs[])
Wrapper to the function which adds the explicit part of the convection/diffusion terms of a transport...
Definition: cs_balance.cpp:917
void cs_balance_vector(int idtvar, int f_id, int imasac, int inc, int ivisep, cs_equation_param_t *eqp, cs_real_3_t pvar[], const cs_real_3_t pvara[], const cs_field_bc_coeffs_t *bc_coeffs_v, const cs_real_t val_f[][3], const cs_real_t flux[][3], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t secvif[], const cs_real_t secvib[], cs_real_6_t viscel[], const cs_real_2_t weighf[], const cs_real_t weighb[], int icvflb, const int icvfli[], cs_real_3_t i_pvar[], cs_real_3_t b_pvar[], cs_real_3_t smbr[])
Wrapper to the function which adds the explicit part of the convection/diffusion terms of a transport...
Definition: cs_balance.cpp:706
void cs_init_bc_coeffs_solve(cs_bc_coeffs_solve_t &c, cs_lnum_t n_b_faces, cs_lnum_t stride, cs_alloc_mode_t amode, bool limiter)
Initialize boundary condition coefficients solve arrays.
Definition: cs_boundary_conditions_set_coeffs.cpp:5172
void cs_clear_bc_coeffs_solve(cs_bc_coeffs_solve_t &c)
Free boundary condition coefficients solve arrays.
Definition: cs_boundary_conditions_set_coeffs.cpp:5204
#define CS_F_HOST_DEVICE
Definition: cs_defs.h:585
double cs_real_t
Floating-point value.
Definition: cs_defs.h:357
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:374
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:376
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:350
int cs_field_get_key_int(const cs_field_t *f, int key_id)
Return a integer value for a given key associated with a field.
Definition: cs_field.cpp:3157
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition: cs_field.cpp:2347
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.cpp:2663
@ k
Definition: cs_field_pointer.h:72
@ rho
Definition: cs_field_pointer.h:100
@ dt
Definition: cs_field_pointer.h:65
cs_alloc_mode_t
Definition: cs_mem.h:50
void cs_runge_kutta_staging(cs_dispatch_context &ctx, cs_runge_kutta_integrator_t *rk, cs_real_t *pvar_stage)
Perform one Runge-Kutta staging.
Definition: cs_runge_kutta_integrator.h:151
cs_real_t * cs_runge_kutta_get_projection_time_scale_by_stage(cs_dispatch_context &ctx, cs_runge_kutta_integrator_t *rk)
Get the scaling factor when conducting a projection per stage.
Definition: cs_runge_kutta_integrator.h:516
void cs_runge_kutta_stage_set_initial_rhs(cs_dispatch_context &ctx, cs_runge_kutta_integrator_t *rk, cs_real_t *rhs_pvar)
Set initial rhs per stage for Runge-Kutta integrator. Align with legacy equations' building sequence....
Definition: cs_runge_kutta_integrator.h:207
void cs_runge_kutta_integrators_initialize()
Create RK integrator structures.
Definition: cs_runge_kutta_integrator.cpp:248
void cs_runge_kutta_integrators_destroy()
Clean all Runge-Kutta integrators.
Definition: cs_runge_kutta_integrator.cpp:301
void cs_runge_kutta_init_state(cs_dispatch_context &ctx, cs_runge_kutta_integrator_t *rk, const cs_real_t *rho, const cs_real_t *vol, cs_real_t *pvara)
Initialize a RK integrator at the begining of a time step.
Definition: cs_runge_kutta_integrator.h:116
int cs_runge_kutta_integrator_create(cs_runge_kutta_scheme_t scheme, const char *name, const cs_real_t *dt, int dim, cs_lnum_t n_elts)
Create a RK integrator.
Definition: cs_runge_kutta_integrator.cpp:190
void cs_runge_kutta_stage_complete_rhs(cs_dispatch_context &ctx, cs_runge_kutta_integrator_t *rk, int idtvar, int f_id, int ivisep, cs_equation_param_t *eqp, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t i_secvis[], const cs_real_t b_secvis[], cs_real_t viscel[][6], const cs_real_t weighf[][2], const cs_real_t weighb[], int icvflb, const int icvfli[], cs_real_t pvar[][stride])
prepare and complete rhs per stage for Runge-Kutta integrator. Align with legacy equations' building ...
Definition: cs_runge_kutta_integrator.h:361
void cs_runge_kutta_stage_complete_scalar_rhs(cs_dispatch_context &ctx, cs_runge_kutta_integrator_t *rk, int idtvar, int f_id, int imucpp, cs_equation_param_t *eqp, cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t viscel[][6], const cs_real_t weighf[][2], const cs_real_t weighb[], int icvflb, const int icvfli[], cs_real_t pvar[], const cs_real_t xcpp[])
prepare and complete rhs per stage for Runge-Kutta integrator. Align with legacy equations' building ...
Definition: cs_runge_kutta_integrator.cpp:365
bool cs_runge_kutta_is_active(cs_runge_kutta_integrator_t *rk)
Indicate if Runge-Kutta integrator is activated.
Definition: cs_runge_kutta_integrator.h:498
cs_runge_kutta_integrator_t * cs_runge_kutta_integrator_by_id(int rk_id)
Return a Runge-Kutta integrator by id.
Definition: cs_runge_kutta_integrator.cpp:285
bool cs_runge_kutta_is_staging(cs_runge_kutta_integrator_t *rk)
indicate if the Runge-Kutta integrator is staging.
Definition: cs_runge_kutta_integrator.h:549
#define RK_HIGHEST_ORDER
Definition: cs_runge_kutta_integrator_priv.h:62
cs_runge_kutta_scheme_t
Definition: cs_runge_kutta_integrator_priv.h:71
@ CS_RK_NONE
Definition: cs_runge_kutta_integrator_priv.h:72
integer(c_int), pointer, save idtvar
option for a variable time step
Definition: optcal.f90:85
Definition: cs_field.h:105
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:194
int b_diff_flux_rc
Definition: cs_equation_param.h:514
int ircflu
Definition: cs_equation_param.h:498
double theta
Definition: cs_equation_param.h:501
Field boundary condition descriptor (for variables)
Definition: cs_field.h:120
Field descriptor.
Definition: cs_field.h:156
cs_lnum_t n_b_faces
Definition: cs_mesh.h:99
double * a
Definition: cs_runge_kutta_integrator_priv.h:84
double * c
Definition: cs_runge_kutta_integrator_priv.h:85
Definition: cs_runge_kutta_integrator_priv.h:102
int i_stage
Definition: cs_runge_kutta_integrator_priv.h:107
cs_real_t * scaled_dt
Definition: cs_runge_kutta_integrator_priv.h:110
cs_runge_kutta_coeff_t rk_coeff
Definition: cs_runge_kutta_integrator_priv.h:125
const cs_real_t * dt
Definition: cs_runge_kutta_integrator_priv.h:109
cs_lnum_t n_elts
Definition: cs_runge_kutta_integrator_priv.h:112
cs_real_t * rhs_stages
Definition: cs_runge_kutta_integrator_priv.h:118
cs_real_t * u_old
Definition: cs_runge_kutta_integrator_priv.h:115
cs_runge_kutta_scheme_t scheme
Definition: cs_runge_kutta_integrator_priv.h:104
int n_stages
Definition: cs_runge_kutta_integrator_priv.h:106
cs_real_t * u_new
Definition: cs_runge_kutta_integrator_priv.h:116
cs_real_t * mass
Definition: cs_runge_kutta_integrator_priv.h:121