7.3
general documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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;
const cs_real_t *part_coords
const cs_real_t *prev_part_coords
if ( part_coords[0] > zz[iplan]
&& prev_part_coords[0] <= zz[iplan])
_m_flow[iplan] += 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);
}