8.1
general documentation
Electric arcs initialization example

Electric arcs example

Local variables to be added

The following local variables need to be defined for the examples in this section:

const cs_lnum_t n_cells = domain->mesh-> n_cells;
const cs_real_3_t *cell_cen
= (const cs_real_3_t *)domain->mesh_quantities->cell_cen;
const cs_real_t hhot = 0.4075;
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:334
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313

Allocation

Before user initialization, work arrays lstelt must be allocated, like in basic example.

Initialization

Classical initialization:

/* Apply only at the true computation start, not on restarts */
if (domain->time_step->nt_prev > 0)
return;
/* Mass fraction = 1 for first gas, 0 for others */
int n_gasses = cs_glob_elec_properties->ngaz;
if (n_gasses > 1) {
cs_array_real_set_scalar(n_cells, 1.0, CS_FI_(ycoel, 0)->val);
for (int sp_id = 1; sp_id < n_gasses-1; sp_id++)
cs_array_real_fill_zero(n_cells, CS_FI_(ycoel, sp_id)->val);
}
/* Enthalpy = H(T0) or 0
For electric arc,
for the whole compution domain enthalpy is set to H(T) using
the model conversion function.
For Joule jeating by direct conduction,
enthalpy is set to zero, and the user will enter his H(T) function
tabulation.
*/
/* Enthaly reinitialization */
cs_real_t *cpro_t = CS_F_(t)->val;
cs_real_t *cvar_h = CS_F_(h)->val;
}
else {
false,
cpro_t,
cvar_h);
}
/* Enthalpy modification in given area */
for (cs_lnum_t i = 0; i < n_cells; i++) {
cs_real_t rayo = sqrt( cell_cen[i][0]*cell_cen[i][0]
+ cell_cen[i][1]*cell_cen[i][1]);
if (rayo <= 0.8e-3)
cvar_h[i] = hhot;
}
/* Set electric potential to 0 (real component and imaginary component -- for
Joule heating by direct conduction) */
if (CS_F_(poti) != NULL)
/* Vector potential (electric arcs, 3d) */
if (CS_F_(potva) != NULL)
cs_array_real_fill_zero(3*n_cells, CS_F_(potva)->val);
void cs_array_real_fill_zero(cs_lnum_t size, cs_real_t a[])
Assign zero to all elements of an array.
Definition: cs_array.c:879
void cs_array_real_set_scalar(cs_lnum_t n_elts, cs_real_t ref_val, cs_real_t a[restrict])
Assign a constant scalar value to an array.
Definition: cs_array.c:581
void cs_elec_convert_t_to_h_cells(const cs_real_t t[], cs_real_t h[])
Convert temperature to enthalpy at all cells.
Definition: cs_elec_model.c:2395
const cs_data_elec_t * cs_glob_elec_properties
@ t
Definition: cs_field_pointer.h:92
@ potva
Definition: cs_field_pointer.h:160
@ ycoel
Definition: cs_field_pointer.h:161
@ poti
Definition: cs_field_pointer.h:159
@ h
Definition: cs_field_pointer.h:91
@ potr
Definition: cs_field_pointer.h:158
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:51
#define CS_FI_(e, i)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:53
int cs_glob_physical_model_flag[CS_N_PHYSICAL_MODEL_TYPES]
Definition: cs_physical_model.c:108
@ CS_ELECTRIC_ARCS
Definition: cs_physical_model.h:64
void cs_user_physical_properties_t_to_h(cs_domain_t *domain, const cs_zone_t *z, bool z_local, const cs_real_t t[restrict], cs_real_t h[restrict])
User definition of temperature to enthalpy conversion.
const cs_zone_t * cs_volume_zone_by_id(int id)
Return a pointer to a volume zone based on its id.
Definition: cs_volume_zone.c:653
int ngaz
Definition: cs_elec_model.h:58