Introduction
User integration of the SDE for the user-defined variables.
The variables are constant by default. The SDE must be of the form:
T: particle attribute representing the variable
Tca: characteristic time for the sde to be prescribed in the array auxl1
PIP: coefficient of the SDE (pseudo RHS) to be prescribed in the array auxl2.
If the chosen scheme is first order (nordre=1) then, at the first and only call pip is expressed as a function of the quantities of the previous time step (contained in the particle data).
If the chosen scheme is second order (nordre=2) then, at the first call (nor=1) pip is expressed as a function of the quantities of the previous time step, and at the second passage (nor=2) pip is expressed as a function of the quantities of the current time step.
Example
Example of the integration of the SDE (Stochastic Differential Equation).
void
(
[[maybe_unused]] const int nor
)
{
for (int i = 0;
i++) {
= cs_lagr_particle_attr_n_get_ptr<cs_real_t>(part, p_am, 0,
CS_LAGR_USER);
= cs_lagr_particle_attr_n_get_ptr<cs_real_t>(part, p_am, 1,
CS_LAGR_USER);
tcarac = 1.0;
if (nor == 1)
pip = prev_usr_var[i];
else
pip = usr_var[i];
}
}
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_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:373
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:350
@ dt
Definition: cs_field_pointer.h:65
cs_lagr_model_t * cs_glob_lagr_model
cs_lagr_particle_set_t * cs_lagr_get_particle_set(void)
Return pointer to the main cs_lagr_particle_set_t structure.
Definition: cs_lagr_particle.cpp:1191
@ CS_LAGR_USER
Definition: cs_lagr_particle.h:181
void cs_user_lagr_sde(const cs_real_t dt, const cs_lnum_t p_id, const cs_real_t *taup, const cs_real_3_t *tlag, const cs_real_2_t tempct, const int nor)
User integration of the SDE for the user-defined variables.
Definition: cs_user_lagr_particle.cpp:365
void cs_lagr_sde_attr(cs_lagr_attribute_t attr, const cs_lnum_t p_id, int nor, const cs_real_t dt_part, cs_real_t tcarac, cs_real_t pip)
Integration of a stochastic differential equation (SDE) for a user particle variable (attribute).
Definition: cs_lagr_sde.cpp:3189
Definition: cs_lagr_particle.h:192
size_t extents
Definition: cs_lagr_particle.h:194
int n_user_variables
Definition: cs_lagr.h:356
Definition: cs_lagr_particle.h:226
unsigned char * p_buffer
Definition: cs_lagr_particle.h:250
const cs_lagr_attribute_map_t * p_am
Definition: cs_lagr_particle.h:248