Introduction
Source terms modelling condensation inside the fluid domain on internal metal structures and at the boundaries can be set respectively through the subroutines cs_user_metal_structures_source_terms and cs_user_wall_condensation.
Source terms for condensation on internal metal structures
This model can be enabled in the cs_user_model function in the file cs_user_parameters.cpp as follows:
! Specific condensation modelling
! if = -1 module not activated
! if = 0 condensation source terms with metal
! structures activate
icondv = -1;
}
int cs_glob_physical_model_flag[CS_N_PHYSICAL_MODEL_TYPES]
Definition: cs_physical_model.cpp:104
@ CS_GAS_MIX
Definition: cs_physical_model.h:64
The setting of the condensation source terms is then done in the cs_user_wall_consensation function, in addition to the other settings.
The cells which are associated with the metal structures volume are defined on second call as follows:
if (iappel == 2) {
wall_cond->ncmast = z->
n_elts;
for (ieltcd = 0; ieltcd < z->
n_elts; ieltcd++)
wall_cond->ltmast[ieltcd] = z->
elt_ids[ieltcd];
}
const cs_zone_t * cs_volume_zone_by_name(const char *name)
Return a pointer to a volume zone based on its name if present.
Definition: cs_volume_zone.cpp:665
const cs_lnum_t * elt_ids
Definition: cs_zone.h:61
cs_lnum_t n_elts
Definition: cs_zone.h:60
Modelling of the metal side (wall thermal model and metal properties can then be specified as follows:
if (iappel == 2) {
if (wall_cond->icondb == 0) {
wall_cond->izcophc[iz] = 3;
wall_cond->izcophg[iz] = 3;
wall_cond->iztag1d[iz] = 1;
if (wall_cond->iztag1d[iz] == 1) {
wall_thermal->ztheta[iz] = 1.0;
wall_thermal->zdxmin[iz] = 0.0;
wall_thermal->znmur[iz] = 10;
wall_thermal->zepais[iz] = 0.024;
wall_thermal->ztpar0[iz] = 26.57;
}
}
}
Finally the source term type and values have to be set (in cs_user_wall_condensation.cpp) as follows:
const int nfbpcd = wall_cond->nfbpcd;
for (ieltcd = 0; ieltcd < nfbpcd; ieltcd++) {
tk = cvar_h[iel] / cpro_cp[iel];
wall_cond->itypcd[iu * nfbpcd + ieltcd] = 0;
wall_cond->itypcd[iv * nfbpcd + ieltcd] = 0;
wall_cond->itypcd[iw * nfbpcd + ieltcd] = 0;
wall_cond->spcond[iu * nfbpcd + ieltcd] = 0.0;
wall_cond->spcond[iv * nfbpcd + ieltcd] = 0.0;
wall_cond->spcond[iw * nfbpcd + ieltcd] = 0.0;
if (turb_mdl->itytur == 2) {
assert(ik != -1 && iep != -1);
wall_cond->itypcd[ik * nfbpcd + ieltcd] = 0;
wall_cond->itypcd[iep * nfbpcd + ieltcd] = 0;
wall_cond->spcond[ik * nfbpcd + ieltcd] = 0.0;
wall_cond->spcond[iep * nfbpcd + ieltcd] = 0.0;
}
for (int f_id = 0; f_id < n_fields; f_id++) {
int iscal = f->get_key_int( keysca);
if (iscal > 0) {
int ivar = f->get_key_int(var_id_key) - 1;
wall_cond->itypcd[ivar * nfbpcd + ieltcd] = 1;
wall_cond->spcond[ivar * nfbpcd + ieltcd] = hvap;
}
else {
wall_cond->spcond[ivar * nfbpcd + ieltcd]
= 0.0;
}
}
}
}
}
key_mix, &s_h2o_g);
for (int f_id = 0; f_id < n_fields; f_id++) {
continue;
int iscal = f->get_key_int(keysca);
if (iscal <= 0)
continue;
int ivar = f->get_key_int(var_id_key) - 1;
for (
cs_lnum_t icmst = 0; icmst < ncmast; icmst++) {
const cs_lnum_t c_id = wall_cond->ltmast[icmst];
wall_cond->svcond[ivar*ncmast + icmst] = 0.0;
if (f_id == h_f_id)
wall_cond->svcond[ivar*ncmast + icmst] = hvap;
}
}
int id
Definition: cs_field.h:281
int nt_cur
Definition: cs_time_step.h:72
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
cs_field_t * cs_field(int id)
Return a pointer to a field based on its id. This function requires that a field of the given id is d...
Definition: cs_field.cpp:4295
cs_field_t * cs_field_try(int id)
Return a pointer to a field based on its id. If no field of the given name is defined,...
Definition: cs_field.cpp:4371
const void * cs_field_get_key_struct(const cs_field_t *f, const int key_id, void *s)
Return a structure for a given key associated with a field.
Definition: cs_field.cpp:3433
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.cpp:2728
const cs_fluid_properties_t * cs_glob_fluid_properties
Definition: cs_physical_constants.cpp:462
cs_field_t * cs_thermal_model_field(void)
Definition: cs_thermal_model.cpp:180
const cs_time_step_t * cs_glob_time_step
#define CS_FIELD_VARIABLE
Definition: cs_field.h:66
elemental pure integer function ifabor(ifac)
index-number of the (unique) neighboring cell for each boundary face
Definition: mesh.f90:81
integer(c_int), pointer, save ntcabs
Current absolute time step number. In case of restart, this is equal to ntpabs + number of new iterat...
Definition: optcal.f90:52
double t0
Definition: cs_physical_constants.h:84
Definition: cs_gas_mix.h:83
double cp
Definition: cs_gas_mix.h:86
Boundary source terms for condensation
The condensation of steam on surfaces can be activated by adding the following lines in function cs_user_model of file cs_user_parameters.c :
wall_cond->icondb = 0;
wall_cond->natural_conv_model
= CS_WALL_COND_MODEL_DEHBI;
cs_wall_condensation_t * cs_get_glob_wall_condensation(void)
Provide writable access to _wall_cond structure.
Definition: cs_wall_condensation.cpp:768
The subroutine cs_user_wall_condensation is called three times.
The first call computes the number of boundary faces and the number of zones on which a boundary mass source term is imposed, based on the selection criteria prescribed by the user.
In this example, all faces with tag "60" in the mesh are gathered in a single condensation zone.
if (iappel == 1 || iappel == 2) {
if (iappel == 1) {
wall_cond->nfbpcd = zone->
n_elts;
wall_cond->nzones = izone;
}
else if (iappel == 2) {
for (ieltcd = 0; ieltcd < zone->
n_elts; ieltcd++) {
wall_cond->ifbpcd[ieltcd] = ifac;
wall_cond->izzftcd[ieltcd] = izone;
}
}
}
const cs_zone_t * cs_boundary_zone_by_name_try(const char *name)
Return a pointer to a boundary zone based on its name if present.
Definition: cs_boundary_zone.cpp:734
At the second call, connectivity tables are built between the global mesh numbering and the one dedicated to wall condensation (see snippet above). In addition, parameters related to the condensation model are set.
if (iappel == 2) {
if (wall_cond->icondb == 0) {
wall_cond->izcophc[iz] = 3;
wall_cond->izcophg[iz] = 3;
wall_cond->iztag1d[iz] = 1;
if (wall_cond->iztag1d[iz] == 1) {
wall_thermal->ztheta[iz] = 1.0;
wall_thermal->zdxmin[iz] = 0.0;
wall_thermal->znmur[iz] = 10;
wall_thermal->zepais[iz] = 0.024;
wall_thermal->ztpar0[iz] = 26.57;
}
}
}
At the third call, properties related to the solid wall are set.
if (wall_cond->icondb == 0) {
if (wall_cond->iztag1d[iz] == 1) {
wall_thermal->zhext[iz] = 1.e8;
wall_thermal->ztext[iz] = 26.57;
wall_thermal->zrob[iz] = 8000.0;
wall_thermal->zcondb[iz] = 12.8;
wall_thermal->zcpb[iz] = 500.0;
}
else {
wall_cond->ztpar[iz] = 26.57;
}
}
Finally, the source terms associated with the condensation phenomenon are defined.
const int nfbpcd = wall_cond->nfbpcd;
for (ieltcd = 0; ieltcd < nfbpcd; ieltcd++) {
tk = cvar_h[iel] / cpro_cp[iel];
wall_cond->itypcd[iu * nfbpcd + ieltcd] = 0;
wall_cond->itypcd[iv * nfbpcd + ieltcd] = 0;
wall_cond->itypcd[iw * nfbpcd + ieltcd] = 0;
wall_cond->spcond[iu * nfbpcd + ieltcd] = 0.0;
wall_cond->spcond[iv * nfbpcd + ieltcd] = 0.0;
wall_cond->spcond[iw * nfbpcd + ieltcd] = 0.0;
if (turb_mdl->itytur == 2) {
assert(ik != -1 && iep != -1);
wall_cond->itypcd[ik * nfbpcd + ieltcd] = 0;
wall_cond->itypcd[iep * nfbpcd + ieltcd] = 0;
wall_cond->spcond[ik * nfbpcd + ieltcd] = 0.0;
wall_cond->spcond[iep * nfbpcd + ieltcd] = 0.0;
}
for (int f_id = 0; f_id < n_fields; f_id++) {
int iscal = f->get_key_int( keysca);
if (iscal > 0) {
int ivar = f->get_key_int(var_id_key) - 1;
wall_cond->itypcd[ivar * nfbpcd + ieltcd] = 1;
wall_cond->spcond[ivar * nfbpcd + ieltcd] = hvap;
}
else {
wall_cond->spcond[ivar * nfbpcd + ieltcd]
= 0.0;
}
}
}
}
}
key_mix, &s_h2o_g);
for (int f_id = 0; f_id < n_fields; f_id++) {
continue;
int iscal = f->get_key_int(keysca);
if (iscal <= 0)
continue;
int ivar = f->get_key_int(var_id_key) - 1;
for (
cs_lnum_t icmst = 0; icmst < ncmast; icmst++) {
const cs_lnum_t c_id = wall_cond->ltmast[icmst];
wall_cond->svcond[ivar*ncmast + icmst] = 0.0;
if (f_id == h_f_id)
wall_cond->svcond[ivar*ncmast + icmst] = hvap;
}
}