#include "base/cs_defs.h"#include <assert.h>#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "alge/cs_balance.h"#include "alge/cs_blas.h"#include "base/cs_array.h"#include "base/cs_base_accel.h"#include "base/cs_boundary_conditions_set_coeffs.h"#include "base/cs_dispatch.h"#include "mesh/cs_mesh.h"#include "base/cs_runge_kutta_integrator_priv.h"
Include dependency graph for cs_runge_kutta_integrator.h:Go to the source code of this file.
Functions | |
| 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. More... | |
| void | cs_runge_kutta_integrators_initialize () |
| Create RK integrator structures. More... | |
| template<cs_lnum_t stride> | |
| 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. More... | |
| template<cs_lnum_t stride> | |
| 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. More... | |
| template<int stride> | |
| 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. 1) Collect initial rhs done in cs_solve_navier_stokes/cs_solve_equation_scalar 2) Complete rhs with adding explicit part of the convection/diffusion balance. More... | |
| 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 sequence. 1) Collect initial rhs done in cs_solve_navier_stokes/cs_solve_equation_scalar 2) Complete rhs with adding explicit part of the convection/diffusion balance More precisely, the right hand side | |
| template<int stride> | |
| 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 sequence. 1) Collect initial rhs done in cs_solve_navier_stokes/cs_solve_equation_scalar 2) Complete rhs with adding explicit part of the convection/diffusion balance More precisely, the right hand side | |
| bool | cs_runge_kutta_is_active (cs_runge_kutta_integrator_t *rk) |
| Indicate if Runge-Kutta integrator is activated. More... | |
| 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. More... | |
| bool | cs_runge_kutta_is_staging (cs_runge_kutta_integrator_t *rk) |
| indicate if the Runge-Kutta integrator is staging. More... | |
| cs_runge_kutta_integrator_t * | cs_runge_kutta_integrator_by_id (int rk_id) |
| Return a Runge-Kutta integrator by id. More... | |
| void | cs_runge_kutta_integrators_destroy () |
| Clean all Runge-Kutta integrators. More... | |
|
inline |
Get the scaling factor when conducting a projection per stage.
| [in] | rk | pointer to a Runge-Kutta integrator |
| 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.
| [in] | ctx | Reference to dispatch context |
| [in,out] | rk | pointer to a Runge-Kutta integrator |
| [in] | rho | mass density within the geometry support |
| [in] | vol | measure of the geometry support |
| [in] | pvara | high level variable array at the begining of a time step |
| cs_runge_kutta_integrator_t * cs_runge_kutta_integrator_by_id | ( | int | rk_id | ) |
Return a Runge-Kutta integrator by id.
| 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.
| [in] | scheme | RK scheme type (RK_NONE, RK1, RK2, RK3, RK4) |
| [in] | name | associated equation or field's name |
| [in] | dt | time step |
| [in] | dim | variable dimentsion |
| [in] | n_elts | number of computational elements |
return the RK integrator's id in the RK list
| void cs_runge_kutta_integrators_destroy | ( | ) |
Clean all Runge-Kutta integrators.
| void cs_runge_kutta_integrators_initialize | ( | ) |
Create RK integrator structures.
|
inline |
Indicate if Runge-Kutta integrator is activated.
| [in] | rk | pointer to a Runge-Kutta integrator |
|
inline |
indicate if the Runge-Kutta integrator is staging.
| [in] | rk | pointer to a runge-kutta integrator |
| 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 sequence. 1) Collect initial rhs done in cs_solve_navier_stokes/cs_solve_equation_scalar 2) Complete rhs with adding explicit part of the convection/diffusion balance More precisely, the right hand side
is updated as follows:
Remark: if ivisep = 1, then we also take
, where
is the secondary viscosity, i.e. usually
.
Warning:
| [in] | ctx | Reference to dispatch context |
| [in,out] | rk | pointer to a Runge-Kutta integrator |
| [in] | idtvar | indicator of the temporal scheme |
| [in] | f_id | field id (or -1) |
| [in] | ivisep | indicator to take
|
| [in] | eqp | pointer to a cs_equation_param_t structure which contains variable calculation options |
| [in] | bc_coeffs | boundary condition structure for the variable |
| [in] | i_massflux | mass flux at interior faces |
| [in] | b_massflux | mass flux at boundary faces |
| [in] | i_visc | |
| [in] | b_visc | |
| [in] | secvif | secondary viscosity at interior faces |
| [in] | secvib | secondary viscosity at boundary faces |
| [in] | viscel | symmetric cell tensor |
| [in] | weighf | internal face weight between cells i j in case of tensor diffusion |
| [in] | weighb | boundary face weight for cells i in case of tensor diffusion |
| [in] | icvflb | global indicator of boundary convection flux
|
| [in] | icvfli | boundary face indicator array of convection flux
|
| [in] | pvar | solved velocity (current time step) |
| [in] | rhs_pvar | pointer to high level rhs array |
| 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 sequence. 1) Collect initial rhs done in cs_solve_navier_stokes/cs_solve_equation_scalar 2) Complete rhs with adding explicit part of the convection/diffusion balance More precisely, the right hand side
is updated as follows:
Warning:
| [in] | ctx | Reference to dispatch context |
| [in,out] | rk | pointer to a Runge-Kutta integrator |
| [in] | idtvar | indicator of the temporal scheme |
| [in] | f_id | field id (or -1) |
| [in] | imucpp | indicator
|
| [in] | eqp | pointer to a cs_equation_param_t structure which contains variable calculation options |
| [in] | bc_coeffs | boundary condition structure for the variable |
| [in] | i_massflux | mass flux at interior faces |
| [in] | b_massflux | mass flux at boundary faces |
| [in] | i_visc | |
| [in] | b_visc | |
| [in] | viscel | symmetric cell tensor |
| [in] | weighf | internal face weight between cells i j in case of tensor diffusion |
| [in] | weighb | boundary face weight for cells i in case of tensor diffusion |
| [in] | icvflb | global indicator of boundary convection flux
|
| [in] | icvfli | boundary face indicator array of convection flux
|
| [in] | pvar | solved variable (current time step) |
| [in] | xcpp | array of specific heat (Cp) |
| 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. 1) Collect initial rhs done in cs_solve_navier_stokes/cs_solve_equation_scalar 2) Complete rhs with adding explicit part of the convection/diffusion balance.
| [in] | ctx | Reference to dispatch context |
| [in,out] | rk | pointer to a Runge-Kutta integrator |
| [in] | rhs_pvar | pointer to high level rhs array |
| 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.
| [in] | ctx | Reference to dispatch context |
| [in,out] | rk | pointer to a Runge-Kutta integrator |
| [in,out] | pvar_stage | high level variable array along stages |