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:108
@ CS_GAS_MIX
Definition cs_physical_model.h:68
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];
}
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++) {
if (ntcabs >= 1)
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;
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++) {
if (iscal > 0) {
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;
if (iscal <= 0)
continue;
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;
}
}
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;
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;
}
}
}
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++) {
if (ntcabs >= 1)
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;
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++) {
if (iscal > 0) {
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;
if (iscal <= 0)
continue;
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;
}
}