8.1
general documentation
Settings of condensation mass source terms

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 subroutine usppmo in the file cs_user_parameters.f90 as follows:

if ( ippmod(igmix).ge.0 ) then
! Specific condensation modelling
! if = -1 module not activated
! if = 0 condensation source terms with metal
! structures activate
icondv = -1
endif

The setting of the condensation source terms is then done in the subroutine cs_user_metal_structures_source_terms as follows below.

The following variables need to be declared:

Necessary species physical properties can be retrieved as follows:

The zones on which the condensation mass source term will be imposed can be defined as follows:

Modelling of the metal side (wall thermal model and metal properties can then be specified as follows:

Finally the source term type and values have to be set (in cs_user_wallcondensation.c) as follows:

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 :

/* Activated wall condensation model for natural convection
* - CS_WALL_COND_MODEL_COPAIN: Legacy implementation of COPAIN
* correlation (default)
* - CS_WALL_COND_MODEL_COPAIN_BD: Update of COPAIN correlation from
* Benteboula and Dabbene
* - CS_WALL_COND_MODEL_UCHIDA: Uchida correlation
* - CS_WALL_COND_MODEL_DEHBI: Dehbi correlation
*/
wall_cond->icondb = 0; /* activate wall condensation */
wall_cond->natural_conv_model
= CS_WALL_COND_MODEL_DEHBI; /* choose correlation */
cs_wall_condensation_t * cs_get_glob_wall_condensation(void)
Provide writable access to _wall_cond structure.
Definition: cs_wall_condensation.c:914
@ CS_WALL_COND_MODEL_DEHBI
Definition: cs_wall_condensation.h:48
Definition: cs_wall_condensation.h:61
int icondb
Definition: cs_wall_condensation.h:63
cs_wall_cond_natural_conv_model_t natural_conv_model
Definition: cs_wall_condensation.h:67

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) {
const cs_zone_t *zone = cs_boundary_zone_by_name_try("cold_wall");
for (ieltcd = 0; ieltcd < zone->n_elts; ieltcd++) {
if (iappel == 2) {
cs_lnum_t ifac = zone->elt_ids[ieltcd];
wall_cond->ifbpcd[ieltcd] = ifac;
wall_cond->izzftcd[ieltcd] = izone;
}
}
}
if (iappel == 1) {
wall_cond->nfbpcd = ieltcd + 1;
wall_cond->nzones = izone + 1;
}
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.c:737
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
cs_lnum_t * izzftcd
Definition: cs_wall_condensation.h:77
cs_lnum_t nfbpcd
Definition: cs_wall_condensation.h:74
cs_lnum_t nzones
Definition: cs_wall_condensation.h:89
cs_lnum_t * ifbpcd
Definition: cs_wall_condensation.h:75
Definition: cs_zone.h:55
const cs_lnum_t * elt_ids
Definition: cs_zone.h:65
cs_lnum_t n_elts
Definition: cs_zone.h:64

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.

/*--------------------------------------------------------------------------
* Select the cells which are associated to the metal structures volume.
*--------------------------------------------------------------------------*/
if (iappel == 2) {
const cs_zone_t *z = cs_volume_zone_by_name("metallic_structures");
wall_cond->ncmast = z->n_elts;
for (ieltcd = 0; ieltcd < z->n_elts; ieltcd++)
wall_cond->ltmast[ieltcd] = z->elt_ids[ieltcd];
}
/*--------------------------------------------------------------------------
* Parameters of the 1-D thermal model and condensation model
* ----------------------------------------------------------
* Both models can be activated and coupled together or the condensation
* model can be used with a constant wall temperature specified by the user
* (at iappel=3 tpar=ztpar0(iz) in this case).
*--------------------------------------------------------------------------*/
if (iappel == 2) {
if (wall_cond->icondb == 0) {
/* izcophc: model for the mass transfer (condensation) coefficient
* ---------------------------------------------------------------
* 1: Turbulent wall law
* 2: Natural convection correlation
* 3: Maximum of the two previous (for mixed regime)
*/
wall_cond->izcophc[iz] = 3;
/* izcophg: model for the thermal exchange coefficient
* ---------------------------------------------------
* 1: Turbulent wall law
* 2: Natural convection correlation
* 3: Maximum of the two previous (for mixed regime)
*/
wall_cond->izcophg[iz] = 3;
/* iztag1d: on/off switch for 1D thermal module
* --------------------------------------------
* 0: Constant wall temperature (equal to ztpar0(iz))
* 1: Variable wall temperature computed with a 1D model
*/
wall_cond->iztag1d[iz] = 1;
if (wall_cond->iztag1d[iz] == 1) {
/* ztheta: proportion of implicitation in the space discretization scheme
* ----------------------------------------------------------------------
* Float in the range [0, 1].
* Special values:
* 0: explicit scheme
* 1: implicit scheme
*/
wall_thermal->ztheta[iz] = 1.0;
/* zdxmin: Wall cell size parameters
* ---------------------------------
* Special values:
* <=0: Constant cell size
* > 0: Variable cell size. In this case, the first cell size
* (fluid side) is set to zdxmin [meters].
*/
wall_thermal->zdxmin[iz] = 0.0;
/* znmur: Number of cell layers in the wall mesh
* ---------------------------------------------
*/
wall_thermal->znmur[iz] = 10;
/* zepais: Total thickness of the solid wall [meters]
* --------------------------------------------------
*/
wall_thermal->zepais[iz] = 0.024;
/* ztpar0: Initial temperature in the solid wall [celsius]
* -------------------------------------------------------
*/
wall_thermal->ztpar0[iz] = 26.57;
}
}
}
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.c:677
cs_lnum_t * iztag1d
Definition: cs_wall_condensation.h:92
cs_lnum_t ncmast
Definition: cs_wall_condensation.h:99
cs_lnum_t * izcophc
Definition: cs_wall_condensation.h:90
cs_lnum_t * ltmast
Definition: cs_wall_condensation.h:101
cs_lnum_t * izcophg
Definition: cs_wall_condensation.h:91

At the third call, properties related to the solid wall are set.

// Fill in parameters for wall thermal mode
// TODO : move to iappel == 2 ?
if (wall_cond->icondb == 0) {
if (wall_cond->iztag1d[iz] == 1) {
/* zhext: External exchange coefficient [watt.meter^(-2).kelvin^(-1)]
* ------------------------------------
*/
wall_thermal->zhext[iz] = 1.e8;
/* zhext: External temperature [celsius]
* ---------------------------
*/
wall_thermal->ztext[iz] = 26.57;
/* zrob: Solid wall density [kilogram.meter^(-3)]
* ------------------------
*/
wall_thermal->zrob[iz] = 8000.0;
/* zcondb: Solid wall thermal conductivity [watt.meter^(-1).celsius^(-1)]
* ---------------------------------------
*/
wall_thermal->zcondb[iz] = 12.8;
/* zcpb: Solid wall specific heat [joule.kilogram^(-1).celsius^(-1)]
* ------------------------------
*/
wall_thermal->zcpb[iz] = 500.0;
}
else {
/* ztpar: Constant wall temperature [celsius]
* --------------------------------
*/
wall_cond->ztpar[iz] = 26.57;
}
}
cs_real_t * ztpar
Definition: cs_wall_condensation.h:93

Finally, the source terms associated with the condensation phenomenon are defined.

const int nfbpcd = wall_cond->nfbpcd;
for (ieltcd = 0; ieltcd < nfbpcd; ieltcd++) {
// Enthalpy of steam
cs_lnum_t ifac = wall_cond->ifbpcd[ieltcd];
cs_lnum_t iel = ifabor[ifac];
if (ntcabs >= 1)
tk = cvar_h[iel] / cpro_cp[iel];
cs_real_t hvap = (cp_vap * tk);
// Source term for momentum
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;
// Source term for turbulence
// TODO generalize to all turbulence models
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;
}
// Source term for scalars
for (int f_id = 0; f_id < n_fields; f_id++) {
f = cs_field_by_id(f_id);
if (f->type & CS_FIELD_VARIABLE) {
int iscal = cs_field_get_key_int(f, keysca);
if (iscal > 0) {
int ivar = cs_field_get_key_int(f, var_id_key) - 1;
wall_cond->itypcd[ivar * nfbpcd + ieltcd] = 1;
if (f == cs_thermal_model_field()) {
wall_cond->spcond[ivar * nfbpcd + ieltcd] = hvap; // enthalpy
}
else {
wall_cond->spcond[ivar * nfbpcd + ieltcd]
= 0.0; // non-condensable species
}
}
}
}
}
/*------------------------------------------------------------------------
* The user can specify here the values of the following arrays used by
* the modelling of the metal structures condensation:
* svcond the scalar value to multiply by the sink term array
* of the metal structures condensation model.
* This array can be filled for each transported scalar.
*------------------------------------------------------------------------*/
const cs_lnum_t ncmast = wall_cond->ncmast;
const int key_mix = cs_field_key_id("gas_mix_species_prop");
key_mix, &s_h2o_g);
// Source term for scalars
for (int f_id = 0; f_id < n_fields; f_id++) {
f = cs_field_by_id(f_id);
if (!(f->type & CS_FIELD_VARIABLE))
continue;
int iscal = cs_field_get_key_int(f, keysca);
if (iscal <= 0)
continue;
int ivar = cs_field_get_key_int(f, var_id_key) - 1;
int h_f_id = cs_thermal_model_field()->id;
/* Loop over the cells associated to the metal structure
* source terms zone */
for (cs_lnum_t icmst = 0; icmst < ncmast; icmst++) {
const cs_lnum_t c_id = wall_cond->ltmast[icmst];
/* Compute the enthalpy value of vapor gas */
cs_real_t tk = cvar_h[c_id]/cpro_cp[c_id];
if (cs_get_glob_time_step()->nt_cur < 2)
const cs_real_t hvap = s_h2o_g.cp*tk;
// wall_cond->itypst[ivar*ncmast + icmst] = 1;
wall_cond->svcond[ivar*ncmast + icmst] = 0.0;
if (f_id == h_f_id)
wall_cond->svcond[ivar*ncmast + icmst] = hvap;
}
}
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition: cs_field.c:2320
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.c:3068
cs_field_t * cs_field_by_name_try(const char *name)
Return a pointer to a field based on its name if present.
Definition: cs_field.c:2370
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.c:2574
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.c:3491
const cs_fluid_properties_t * cs_glob_fluid_properties
Definition: cs_physical_constants.c:424
cs_field_t * cs_thermal_model_field(void)
Definition: cs_thermal_model.c:216
cs_time_step_t * cs_get_glob_time_step(void)
Provide read/write access to cs_glob_time_step.
Definition: cs_time_step.c:433
integer(c_int), pointer, save ncmast
number of the cells in which a condensation source terms is imposed. See lstmast list and the subrout...
Definition: cs_nz_condensation.f90:167
integer(c_int), pointer, save nfbpcd
number of faces in which a condensation source terms is imposed. See ifbpcd and the user subroutine c...
Definition: cs_nz_condensation.f90:55
#define CS_FIELD_VARIABLE
Definition: cs_field.h:63
integer, save ik
turbulent kinetic energy
Definition: numvar.f90:75
integer, save iep
turbulent dissipation
Definition: numvar.f90:79
integer, save iv
velocity component
Definition: numvar.f90:63
integer, save iu
velocity component
Definition: numvar.f90:59
integer, save iw
velocity component
Definition: numvar.f90:67
elemental pure integer function ifabor(ifac)
index-number of the (unique) neighboring cell for each boundary face
Definition: mesh.f90:208
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:196
int id
Definition: cs_field.h:135
double t0
Definition: cs_physical_constants.h:80
Definition: cs_gas_mix.h:81
double cp
Definition: cs_gas_mix.h:84
int nt_cur
Definition: cs_time_step.h:74
cs_lnum_t * itypcd
Definition: cs_wall_condensation.h:76
cs_real_t * spcond
Definition: cs_wall_condensation.h:78
cs_real_t * svcond
Definition: cs_wall_condensation.h:104