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_boundary_mass_source_terms.
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
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:
integer icmst
integer ifac, iel, iscal
integer ivarh
integer izone
integer f_id
double precision hvap, tk
type(gas_mix_species_prop) s_h2o_g
double precision, dimension(:), pointer :: cpro_cp
double precision, dimension(:), pointer :: cvar_h
Necessary species physical properties can be retrieved as follows:
call field_get_id_try("y_h2o_g", f_id)
if (f_id.ne.-1) &
call field_get_key_struct_gas_mix_species_prop(f_id, s_h2o_g)
The zones on which the condensation mass source term will be imposed can be defined as follows:
izone = 0
met_znb = 1
do izmet = 1 , met_znb
if (izmet.eq.1) then
call getcel(
'z > -7.0d0 and z < 53.d0', ncmast, ltmast)
izone = izone + 1
do icmst = 1, ncmast
iel = ltmast(icmst)
izmast(iel) = izone
enddo
endif
enddo
Modelling of the metal side (wall thermal model and metal properties can then be specified as follows:
if (icondv.eq.0) then
itagms = 1
if(itagms.eq.1) then
xem = 0.024d0
tmet0 = 92.d0
xro_m = 8000.d0
xcond_m = 12.8d0
xcp_m = 500.0d0
else
tmet = 92.d0
endif
endif
Finally the source term type and values have to be set as follows:
if (icp.ge.0) call field_get_val_s(icp, cpro_cp)
ivarh = isca(iscalt)
call field_get_val_s(ivarfl(ivarh), cvar_h)
do icmst = 1, ncmast
iel = ltmast(icmst)
if (ntcabs.le.1) then
tk = t0
else
tk = cvar_h(iel)/cpro_cp(iel)
endif
hvap = s_h2o_g%cp*tk
if (nscal.gt.0) then
do iscal = 1, nscal
if (iscal.eq.iscalt) then
itypst(iel,isca(iscalt)) = 1
svcond(iel,isca(iscalt)) = hvap
else
itypst(iel,isca(iscal)) = 1
svcond(iel,isca(iscal)) = 0.d0
endif
enddo
endif
enddo
Boundary source terms for condensation
The following variables need to be declared:
integer ieltcd, ii, iz
integer ifac, iel, iscal
integer ivarh
integer ilelt, nlelt
integer izone
integer f_id
double precision hvap, tk
type(gas_mix_species_prop) s_h2o_g
integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: cpro_cp
double precision, dimension(:), pointer :: cvar_h
Necessary species physical properties can be retrieved as follows:
allocate(lstelt(nfabor))
call field_get_id_try("y_h2o_g", f_id)
if (f_id.ne.-1) &
call field_get_key_struct_gas_mix_species_prop(f_id, s_h2o_g)
The subroutine cs_user_boundary_mass_source_terms is called three times.
At the first call the number of boundary faces and number of zones on which a boundary mass source term is imposed is computed according to the selection criteria prescribed by the user.
if (iappel.eq.1.or.iappel.eq.2) then
izone = 0
ieltcd = 0
call getfbr(
'60 and box[-0.03,0.0,0.5,0.03,0.6,1.22]',nlelt,lstelt)
izone = izone + 1
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
iel = ifabor(ifac)
ieltcd = ieltcd + 1
if (iappel.eq.2) then
ifbpcd(ieltcd) = ifac
izzftcd(ieltcd) = izone
endif
enddo
if (irangp.le.0.and.iappel.eq.2.and.ieltcd.gt.0) then
write(*,*) "izzftcd(",izone,")= ", izzftcd(ieltcd)
endif
call getfbr(
'60 and box[-0.03,0.0,1.22,0.03,0.6,2.55]', nlelt, lstelt)
izone = izone + 1
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
iel = ifabor(ifac)
ieltcd = ieltcd + 1
if (iappel.eq.2) then
ifbpcd(ieltcd) = ifac
izzftcd(ieltcd) = izone
endif
enddo
if (irangp.le.0.and.iappel.eq.2.and.ieltcd.gt.0) then
write(*,*) "izzftcd(",izone,")= ", izzftcd(ieltcd)
endif
endif
if (iappel.eq.1) then
nfbpcd = ieltcd
nzones = izone
endif
The above part of the subroutine is also executed at the second call. In addition, at the second call, condensation models are chosen.
if (iappel.eq.2) then
do ii = 1, nfbpcd
iz = izzftcd(ii)
if (iz.eq.1.and.icondb.eq.0) then
izcophc(iz) = 3
izcophg(iz) = 3
iztag1d(iz) = 1
if (iztag1d(iz).eq.1) then
ztheta(iz) = 1.d0
zdxmin(iz) = 0.d0
znmur(iz) = 10
zepais(iz) = 0.024d0
ztpar0(iz) = 26.57d0
endif
endif
enddo
if (irangp.ge.0) then
call parimx(nzones, izcophc)
call parimx(nzones, izcophg)
call parimx(nzones, iztag1d)
call parrmx(nzones, ztheta)
call parrmx(nzones, zdxmin)
call parimx(nzones, znmur )
call parrmx(nzones, zepais)
call parrmx(nzones, ztpar0)
endif
Finally at the third call, the source term types and values have to be set.
elseif (iappel.eq.3) then
if (icp.ge.0) call field_get_val_s(icp, cpro_cp)
ivarh = isca(iscalt)
call field_get_val_s(ivarfl(ivarh), cvar_h)
do ii = 1, nfbpcd
ifac = ifbpcd(ii)
iel = ifabor(ifac)
iz = izzftcd(ii)
if (icondb.eq.0) then
if (iztag1d(iz).eq.1) then
zhext(iz) = 1.d+8 ; ztext(iz) = 26.57d0
zrob(iz) = 8000.d0
zcondb(iz) = 12.8d0
zcpb(iz) = 500.0d0
else
ztpar(iz) = 26.57d0
endif
elseif (iz.eq.2.and.icondb.eq.0) then
if (iztag1d(iz).eq.1) then
zhext(iz) = 1.d+8 ; ztext(iz) = 26.57d0
zrob(iz) = 8000.d0
zcondb(iz) = 12.8d0
zcpb(iz) = 500.0d0
else
ztpar(iz) = 26.57d0
endif
endif
if (ntcabs.le.1) then
tk = t0
else
tk = cvar_h(iel)/cpro_cp(iel)
endif
hvap = s_h2o_g%cp*tk
itypcd(ii,iu) = 0
spcond(ii,iu) = 0.d0
itypcd(ii,iv) = 0
spcond(ii,iv) = 0.d0
itypcd(ii,iw) = 0
spcond(ii,iw) = 0.d0
if (itytur.eq.2) then
itypcd(ii,ik ) = 0
spcond(ii,ik ) = 0.d0
itypcd(ii,iep) = 0
spcond(ii,iep) = 0.d0
endif
if (nscal.gt.0) then
do iscal = 1, nscal
if (iscal.eq.iscalt) then
itypcd(ii,isca(iscalt)) = 1
spcond(ii,isca(iscalt)) = hvap
else
itypcd(ii,isca(iscal)) = 1
spcond(ii,isca(iscal)) = 0.d0
endif
enddo
endif
enddo
if (irangp.ge.0) then
call parrmx(nzones, zhext)
call parrmx(nzones, ztext)
call parrmx(nzones, zrob )
call parrmx(nzones, zcondb)
call parrmx(nzones, zcpb )
call parrmx(nzones, ztpar)
endif
endif
Boundary source terms for condensation
The following variables need to be declared:
integer ieltcd
integer ifac, iel, iscal
integer ivarh
integer ilelt, nlelt
integer izone
integer f_id
double precision hvap, tk
type(gas_mix_species_prop) s_h2o_g
integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: cpro_cp
double precision, dimension(:), pointer :: cvar_h
Necessary species physical properties can be retrieved as follows:
allocate(lstelt(nfabor))
call field_get_id_try("y_h2o_g", f_id)
if (f_id.ne.-1) &
call field_get_key_struct_gas_mix_species_prop(f_id, s_h2o_g)
The subroutine cs_user_boundary_mass_source_terms is called three times.
At the first call the number of boundary faces and number of zones on which a boundary mass source term is imposed is computed according to the selection criteria prescribed by the user.
if (iappel.eq.1.or.iappel.eq.2) then
izone = 0
ieltcd = 0
call getfbr(
'60',nlelt,lstelt)
izone = izone + 1
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
iel = ifabor(ifac)
izftcd(iel) = izone
ieltcd = ieltcd + 1
if (iappel.eq.2) ifbpcd(ieltcd) = ifac
enddo
endif
if (iappel.eq.1) then
nfbpcd = ieltcd
endif
The above part of the subroutine is also executed at the second call. In addition, at the second call, condensation models are chosen.
if (iappel.eq.2) then
if (icondb.eq.0) then
icophc = 3
icophg = 3
itag1d = 1
if(itag1d.eq.1) then
theta = 1.d0
dxmin = 0.d0
nmur = 10
epais = 0.024d0
tpar0 = 26.57d0
endif
endif
Finally at the third call, the source term types and values have to be set.
elseif (iappel.eq.3) then
if (icp.ge.0) call field_get_val_s(icp, cpro_cp)
ivarh = isca(iscalt)
call field_get_val_s(ivarfl(ivarh), cvar_h)
if (icondb.eq.0) then
if(itag1d.eq.1) then
hext = 1.d+8 ; text = 26.57d0
rob = 8000.d0
condb = 12.8d0
cpb = 500.0d0
else
tpar = 26.57d0
endif
endif
do ieltcd = 1, nfbpcd
ifac = ifbpcd(ieltcd)
iel = ifabor(ifac)
if (ntcabs.le.1) then
tk = t0
else
tk = cvar_h(iel)/cpro_cp(iel)
endif
hvap = s_h2o_g%cp*tk
itypcd(ieltcd,iu) = 0
spcond(ieltcd,iu) = 0.d0
itypcd(ieltcd,iv) = 0
spcond(ieltcd,iv) = 0.d0
itypcd(ieltcd,iw) = 0
spcond(ieltcd,iw) = 0.d0
if (itytur.eq.2) then
itypcd(ieltcd,ik ) = 0
spcond(ieltcd,ik ) = 0.d0
itypcd(ieltcd,iep) = 0
spcond(ieltcd,iep) = 0.d0
endif
if (nscal.gt.0) then
do iscal = 1, nscal
if (iscal.eq.iscalt) then
itypcd(ieltcd,isca(iscalt)) = 1
spcond(ieltcd,isca(iscalt)) = hvap
else
itypcd(ieltcd,isca(iscal)) = 1
spcond(ieltcd,isca(iscal)) = 0.d0
endif
enddo
endif
enddo
endif