My Project
programmer's documentation
Functions
cs_lagr_injection.c File Reference
#include "cs_defs.h"
#include <limits.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <float.h>
#include <assert.h>
#include "bft_printf.h"
#include "bft_error.h"
#include "bft_mem.h"
#include "cs_base.h"
#include "cs_math.h"
#include "cs_boundary_zone.h"
#include "cs_volume_zone.h"
#include "cs_mesh.h"
#include "cs_mesh_quantities.h"
#include "cs_parall.h"
#include "cs_thermal_model.h"
#include "cs_parameters.h"
#include "cs_physical_model.h"
#include "cs_physical_constants.h"
#include "cs_prototypes.h"
#include "cs_time_step.h"
#include "cs_field.h"
#include "cs_field_pointer.h"
#include "cs_random.h"
#include "cs_lagr.h"
#include "cs_lagr_tracking.h"
#include "cs_lagr_new.h"
#include "cs_lagr_precipitation_model.h"
#include "cs_lagr_prototypes.h"
#include "cs_lagr_injection.h"
Include dependency graph for cs_lagr_injection.c:

Functions

static cs_lnum_t _segment_binary_search (cs_lnum_t n, double x, const double a[])
 Binary search for a given local id in a given array of ordered values. More...
 
static cs_lnum_t _distribute_particles (cs_gnum_t n_g_particles, cs_lnum_t n_elts, const cs_lnum_t elt_id[], const cs_real_t elt_weight[], const cs_real_t *elt_profile, cs_lnum_t elt_particle_idx[])
 Distribute new particles in a given region. More...
 
static void _injection_check (const cs_lagr_injection_set_t *zis)
 Check injection parameters are valid. More...
 
static cs_lnum_t_get_particle_face_ids (cs_lnum_t n_faces, const cs_lnum_t face_ids[], const cs_lnum_t face_particle_idx[])
 Build particle injection face ids array for a given boundary zone and set. More...
 
static void _init_particles (cs_lagr_particle_set_t *p_set, const cs_lagr_injection_set_t *zis, int time_id, cs_lnum_t n_elts, const cs_lnum_t *face_ids, const cs_lnum_t elt_particle_idx[])
 Initialize particle values. More...
 
static void _check_particles (cs_lagr_particle_set_t *p_set, const cs_lagr_injection_set_t *zis, cs_lnum_t n_elts, const cs_lnum_t elt_particle_idx[])
 Check injected particle values. More...
 
void cs_lagr_injection (int time_id, const int itypfb[], cs_real_t vislen[])
 Inject particles in the computational domain. More...
 

Function Documentation

◆ _check_particles()

static void _check_particles ( cs_lagr_particle_set_t p_set,
const cs_lagr_injection_set_t zis,
cs_lnum_t  n_elts,
const cs_lnum_t  elt_particle_idx[] 
)
static

Check injected particle values.

Parameters
[in,out]p_setparticle set
[in]zisinjection data for this zone and set
[in]n_eltsnumber of elements in zone
[in]elt_particle_idxstarting id of new particles for a given element (size: n_elts+1)

◆ _distribute_particles()

static cs_lnum_t _distribute_particles ( cs_gnum_t  n_g_particles,
cs_lnum_t  n_elts,
const cs_lnum_t  elt_id[],
const cs_real_t  elt_weight[],
const cs_real_t elt_profile,
cs_lnum_t  elt_particle_idx[] 
)
static

Distribute new particles in a given region.

Parameters
[in]n_g_particlesglobal number of particles to inject
[in]n_eltsnumber of elements in region
[in]elt_idelement ids (or NULL)
[in]elt_weightparent element weights (i.e. all local surfaces or volumes)
[in]elt_profileoptional profile values for elements (or NULL)
[out]elt_particle_idxstart index of added particles for each element (size: n_elts + 1)
Returns
number of particles added on local rank

◆ _get_particle_face_ids()

static cs_lnum_t* _get_particle_face_ids ( cs_lnum_t  n_faces,
const cs_lnum_t  face_ids[],
const cs_lnum_t  face_particle_idx[] 
)
static

Build particle injection face ids array for a given boundary zone and set.

The caller is responsible for freeing the returned array.

Parameters
[in]n_facesnumber of elements in zone
[in]face_idsmatching face ids
[in]face_particle_idxstarting id of new particles for a given face (size: n_faces+1)
Returns
array of ids of faces for injected particles (size: face_particle_idx[n_faces])

◆ _init_particles()

static void _init_particles ( cs_lagr_particle_set_t p_set,
const cs_lagr_injection_set_t zis,
int  time_id,
cs_lnum_t  n_elts,
const cs_lnum_t face_ids,
const cs_lnum_t  elt_particle_idx[] 
)
static

Initialize particle values.

Parameters
[in,out]p_setparticle set
[in]zisinjection data this zone and set
[in]time_idtime step indicator for fields 0: use fields at current time step 1: use fields at previous time step
[in]n_eltsnumber of elements in zone
[in]face_idsmatching face ids if zone is a boundary
[in]elt_particle_idxstarting id of new particles for a given element (size: n_elts+1)

◆ _injection_check()

static void _injection_check ( const cs_lagr_injection_set_t zis)
static

Check injection parameters are valid.

Parameters
[in]zispointer to injection data for a given zone and set

◆ _segment_binary_search()

static cs_lnum_t _segment_binary_search ( cs_lnum_t  n,
double  x,
const double  a[] 
)
inlinestatic

Binary search for a given local id in a given array of ordered values.

We assume the id is present in the array.

Parameters
[in]nnumber of values
[in]xvalue to locate
[in]aarray of ordered values (size n)
Returns
index of x in array (smallest i such that a[i] >= x)

◆ cs_lagr_injection()

void cs_lagr_injection ( int  time_id,
const int  itypfb[],
cs_real_t  vislen[] 
)

Inject particles in the computational domain.

Parameters
[in]time_idtime step indicator for fields 0: use fields at current time step 1: use fields at previous time step
[in]itypfbboundary face types