The following sections illustrate subsets of a same example, combining high-level definitions (which are preferred), and lower-level setings where necessary.
This is assumed to be combined with the GUI or settings not specific to gas combustion, so wall and symmetry conditions are not shown here.
Definitions for the setup stage
Using a fixed mass-flow rate, the main inlet conditions can be defined in cs_user_boundary_conditions_setup, as follows for a zone named "inlet":
void cs_boundary_conditions_open_set_mass_flow_rate_by_value(const cs_zone_t *z, cs_real_t q)
Assign a constant mass flow rate to an inlet or outlet.
Definition: cs_boundary_conditions.cpp:3226
void cs_boundary_conditions_inlet_set_turbulence_hyd_diam(const cs_zone_t *zone, cs_real_t hd)
Base the inlet turbulence values on a a circular duct with smooth wall (see ref cs_turbulence_bc_ke_h...
Definition: cs_boundary_conditions.cpp:3568
const cs_zone_t * cs_boundary_zone_by_name(const char *name)
Return a pointer to a boundary zone based on its name if present.
Definition: cs_boundary_zone.cpp:711
cs_combustion_gas_model_t * cs_glob_combustion_gas_model
Definition: cs_combustion_gas.c:99
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
cs_real_t cs_notebook_parameter_value_by_name(const char *name)
Return a parameter value (real).
Definition: cs_notebook.cpp:410
double pcigas
Definition: cs_combustion_gas.h:157
Note that we have used a notebook variable here, allowing parametrization of the computation, but the mass flow should be fixed. For a variable mass flow rate, use cs_boundary_conditions_open_set_mass_flow_rate_by_func instead.
Definitions for the compute stage
Not all definitions can yet be handled at the setup stage, so additional settings are needed in cs_user_boundary_conditions.
Local variables to be added
The following aliases (for conciseness of the downstream code) and initializations are used here:
const cs_lnum_t *b_face_cells = domain->mesh->b_face_cells;
= (
const cs_real_3_t *)(domain->mesh_quantities->b_face_cog);
coefg[icg] = 0;
coefg[1] = 1;
#define CS_COMBUSTION_GAS_MAX_GLOBAL_SPECIES
Definition: cs_combustion_gas.h:50
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:359
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
int cs_field_get_key_int(const cs_field_t *f, int key_id)
Return a integer value for a given key associated with a field.
Definition: cs_field.cpp:3275
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition: cs_field.cpp:2465
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.cpp:2781
@ vel
Definition: cs_field_pointer.h:70
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:51
const cs_fluid_properties_t * cs_glob_fluid_properties
Definition: cs_physical_constants.cpp:465
const cs_physical_constants_t * cs_glob_physical_constants
Definition: cs_physical_constants.cpp:462
cs_real_t cs_gas_combustion_t_to_h(const cs_real_t x_sp[], cs_real_t t)
Convert a temperature to enthalpy value for gas combustion.
double precision, dimension(:,:), pointer cdgfbo
coordinates of the centers of the boundary faces
Definition: mesh.f90:96
integer, save kbmasf
Definition: numvar.f90:177
Definition: cs_combustion_gas.h:141
double hinoxy
Definition: cs_combustion_gas.h:198
double tinoxy
Definition: cs_combustion_gas.h:197
cs_real_t * val
Definition: cs_field.h:152
Fluid properties descriptor.
Definition: cs_physical_constants.h:61
double t0
Definition: cs_physical_constants.h:82
cs_real_t gravity[3]
Definition: cs_physical_constants.h:53
Inlet definitions
Based on the inlet defined at the setup stage, the following additional settings can be used. Note that the inlet temperature is global to the module, but matches an inlet, so we choose to (re)set it here. These settings will be handled in the setup stage in a future version.
{
}
cs_boundary_condition_pm_info_t * cs_glob_bc_pm_info
int ientfu[CS_MAX_BC_PM_ZONE_NUM+1]
Definition: cs_boundary_conditions.h:140
double tinfue
Definition: cs_combustion_gas.h:196
int id
Definition: cs_zone.h:59
Open boundary definition
Since it is not yet possible to handle open boundary conditions with backflow conditions with the high level API (i.e. at the setup stage), the following example illustrates have this can be managed, on an example zone named "open":
{
int *p_icodcl =
CS_F_(
p)->bc_coeffs->icodcl;
h_rcodcl1 =
CS_F_(
h)->bc_coeffs->rcodcl1;
}
gxyz);
p_icodcl[face_id] = 1;
p_rcodcl1[face_id] = pimp;
if (bmasfl[face_id] > 0)
continue;
const cs_lnum_t c_id = b_face_cells[face_id];
fm_rcodcl1[face_id] = 0;
fp2m_rcodcl1[face_id] = 0;
if (h_rcodcl1 != nullptr)
h_rcodcl1[face_id] = cm->
hinoxy;
CS_F_(
fsm)->bc_coeffs->rcodcl1[face_id] = 0;
CS_F_(
npm)->bc_coeffs->rcodcl1[face_id] = 0;
}
}
}
@ npm
Definition: cs_field_pointer.h:133
@ p
Definition: cs_field_pointer.h:67
@ fp2m
Definition: cs_field_pointer.h:130
@ h
Definition: cs_field_pointer.h:93
@ fsm
Definition: cs_field_pointer.h:132
@ rho_b
Definition: cs_field_pointer.h:100
@ fm
Definition: cs_field_pointer.h:129
static CS_F_HOST_DEVICE cs_real_t cs_math_3_distance_dot_product(const cs_real_t xa[3], const cs_real_t xb[3], const cs_real_t xc[3])
Compute .
Definition: cs_math.h:654
static CS_F_HOST_DEVICE cs_real_t cs_math_3_square_norm(const cs_real_t v[3])
Compute the square norm of a vector of 3 real values.
Definition: cs_math.h:781
const cs_real_t cs_math_epzero
static CS_F_HOST_DEVICE cs_real_t cs_math_fmax(cs_real_t x, cs_real_t y)
Compute the max value of two real values.
Definition: cs_math.h:503
@ CS_FREE_INLET
Definition: cs_parameters.h:102
const double cs_physical_constants_r
Definition: cs_physical_constants.cpp:441
int cs_glob_physical_model_flag[CS_N_PHYSICAL_MODEL_TYPES]
Definition: cs_physical_model.c:108
@ CS_COMBUSTION_3PT
Definition: cs_physical_model.h:58
void cs_turbulence_bc_inlet_turb_intensity(cs_lnum_t face_id, double uref2, double t_intensity, double dh)
Set inlet boundary condition values for turbulence variables based on a diameter ,...
Definition: cs_turbulence_bc.cpp:800
double wmolg[CS_COMBUSTION_GAS_MAX_GLOBAL_SPECIES]
Definition: cs_combustion_gas.h:204
int isoot
Definition: cs_combustion_gas.h:193
double ro0
Definition: cs_physical_constants.h:74
double xyzp0[3]
Definition: cs_physical_constants.h:80
double p0
Definition: cs_physical_constants.h:78
const cs_lnum_t * elt_ids
Definition: cs_zone.h:65
cs_lnum_t n_elts
Definition: cs_zone.h:64