6.3
general documentation
User extra operations for the Lagrangian module

Introduction

This page provides an example that may be used or adapted to perform extra or advanced extra-operations within the Lagrangian module.

Example

First we initialize some variables:

In the next example we compute the particle mass flow rate on 4 planes

{
cs_real_t zz[4] = {0.1e0, 0.15e0, 0.20e0, 0.25e0};
/* If we are in an unsteady case, or if the beginning of the steady stats
* is not reached yet, all statistics are reset to zero at each time
step before entering this function.*/
for (cs_lnum_t iplan = 0; iplan < 4; iplan++)
_m_flow[iplan] = 0.0;
}
for (cs_lnum_t iplan = 0; iplan < 4; iplan++) {
for (cs_lnum_t npt = 0; p_set->n_particles; npt++) {
unsigned char *part = p_set->p_buffer + p_am->extents * npt;
cs_lnum_t iel = cs_lagr_particle_get_lnum(part, p_am, CS_LAGR_CELL_ID);
const cs_real_t *part_coords
= cs_lagr_particle_attr_const(part, p_am, CS_LAGR_COORDS);
const cs_real_t *prev_part_coords
= cs_lagr_particle_attr_n_const(part, p_am, 1, CS_LAGR_COORDS);
if ( part_coords[0] > zz[iplan]
&& prev_part_coords[0] <= zz[iplan])
_m_flow[iplan] += cs_lagr_particle_get_real(part, p_am,
* cs_lagr_particle_get_real(part, p_am,
}
}
for (int iplan = 0; iplan < 4; iplan++)
bft_printf(" Particle mass flow at Z(%d): %e14.5)",
iplan,
_m_flow[iplan]/stat_age);
}
cs_lagr_particle_set_t::p_am
const cs_lagr_attribute_map_t * p_am
Definition: cs_lagr_particle.h:244
cs_lagr_attribute_map_t
Definition: cs_lagr_particle.h:188
cs_lagr_stat_get_age
cs_real_t cs_lagr_stat_get_age(void)
Return global volume statistics age.
Definition: cs_lagr_stat.c:5775
cs_lagr_particle_set_t
Definition: cs_lagr_particle.h:222
cs_time_step_t::nt_cur
int nt_cur
Definition: cs_time_step.h:74
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:304
cs_lagr_particle_set_t::n_particles
cs_lnum_t n_particles
Definition: cs_lagr_particle.h:224
cs_lagr_stat_options_t::nstist
int nstist
Definition: cs_lagr_stat.h:213
CS_LAGR_CELL_ID
@ CS_LAGR_CELL_ID
Definition: cs_lagr_particle.h:83
CS_LAGR_MASS
@ CS_LAGR_MASS
Definition: cs_lagr_particle.h:92
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_lagr_attribute_map_t::extents
size_t extents
Definition: cs_lagr_particle.h:190
cs_lagr_particle_set_t::p_buffer
unsigned char * p_buffer
Definition: cs_lagr_particle.h:246
CS_LAGR_COORDS
@ CS_LAGR_COORDS
Definition: cs_lagr_particle.h:95
CS_LAGR_STAT_WEIGHT
@ CS_LAGR_STAT_WEIGHT
Definition: cs_lagr_particle.h:90
cs_lagr_time_scheme_t::isttio
int isttio
Definition: cs_lagr.h:210
cs_glob_time_step
const cs_time_step_t * cs_glob_time_step
cs_glob_lagr_stat_options
cs_lagr_stat_options_t * cs_glob_lagr_stat_options
Definition: cs_lagr_stat.c:311
cs_lagr_get_particle_set
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.c:1153
bft_printf
int bft_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition: bft_printf.c:140
cs_glob_lagr_time_scheme
cs_lagr_time_scheme_t * cs_glob_lagr_time_scheme