Local variables to be added
integer ifac, ii, iel
integer idim
integer izone,iesp
integer ilelt, nlelt
double precision uref2, d2s3
double precision rhomoy, dhy, ustar2
double precision xkent, xeent
double precision z1 , z2
integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: bfpro_rom
double precision, dimension(:), pointer :: cvara_potva
Initialization and finalization
Initialization and finalization is similar to that of the base examples
Example 1
For boundary faces of color 1 assign an inlet and assign a cathode for "electric" variables.
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = ientre
izone = 1
izfppp(ifac) = izone
rcodcl(ifac,iu,1) = 0.d0
rcodcl(ifac,iv,1) = 0.d0
rcodcl(ifac,iw,1) = 0.d0
if (itytur.eq.2 .or. itytur.eq.3 &
.or. iturb.eq.50 .or. iturb.eq.60 &
.or. iturb.eq.70) then
uref2 = rcodcl(ifac,iu,1)**2 &
+rcodcl(ifac,iv,1)**2 &
+rcodcl(ifac,iw,1)**2
uref2 = max(uref2,1.d-12)
dhy = 0.075d0
rhomoy = bfpro_rom(ifac)
ustar2 = 0.d0
xkent = epzero
xeent = epzero
( uref2, dhy, rhomoy, viscl0, cmu, xkappa, &
ustar2, xkent, xeent)
if (itytur.eq.2) then
rcodcl(ifac,ik,1) = xkent
rcodcl(ifac,iep,1) = xeent
elseif (itytur.eq.3) then
rcodcl(ifac,ir11,1) = d2s3*xkent
rcodcl(ifac,ir22,1) = d2s3*xkent
rcodcl(ifac,ir33,1) = d2s3*xkent
rcodcl(ifac,ir12,1) = 0.d0
rcodcl(ifac,ir13,1) = 0.d0
rcodcl(ifac,ir23,1) = 0.d0
rcodcl(ifac,iep,1) = xeent
elseif (iturb.eq.50) then
rcodcl(ifac,ik,1) = xkent
rcodcl(ifac,iep,1) = xeent
rcodcl(ifac,iphi,1) = d2s3
rcodcl(ifac,ifb,1) = 0.d0
elseif (iturb.eq.60) then
rcodcl(ifac,ik,1) = xkent
rcodcl(ifac,iomg,1) = xeent/cmu/xkent
elseif (iturb.eq.70) then
rcodcl(ifac,inusa,1) = cmu*xkent**2/xeent
endif
endif
ii = iscalt
icodcl(ifac,isca(ii)) = 1
rcodcl(ifac,isca(ii),1) = 1.d6
ii = ipotr
icodcl(ifac,isca(ii)) = 1
rcodcl(ifac,isca(ii),1) = 0.d0
if (ngazg .gt. 1) then
do iesp=1,ngazg-1
ii = iycoel(iesp)
icodcl(ifac,isca(ii)) = 1
rcodcl(ifac,isca(ii),1) = 0.d0
enddo
endif
if (ippmod(ieljou).ge. 2) then
ii = ipoti
icodcl(ifac,isca(ii)) = 1
rcodcl(ifac,isca(ii),1) = 0.d0
endif
if (ippmod(ielarc).ge.2) then
do idim= 1,ndimve
ii = ipotva(idim)
icodcl(ifac,isca(ii)) = 3
rcodcl(ifac,isca(ii),3) = 0.d0
enddo
endif
enddo
Example 2
For boundary faces of color 5 assign an free outlet and example of electrode for Joule Effect by direct conduction.
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = isolib
izone = 2
izfppp(ifac) = izone
if (ippmod(ieljou).ge. 1) then
ii = ipotr
icodcl(ifac,isca(ii)) = 1
if (ielcor.eq.1) then
rcodcl(ifac,isca(ii),1) = 500.d0*coejou
else
rcodcl(ifac,isca(ii),1) = 500.d0
endif
endif
if (ippmod(ieljou).ge. 2) then
ii = ipoti
icodcl(ifac,isca(ii)) = 1
if (ielcor.eq.1) then
rcodcl(ifac,isca(ii),1) = sqrt(3.d0)*500.d0*coejou
else
rcodcl(ifac,isca(ii),1) = sqrt(3.d0)*500.d0
endif
endif
enddo
Example 3
For boundary faces of color 2 assign a free outlet and example of anode for electric arc.
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = isolib
izone = 3
izfppp(ifac) = izone
ii = ipotr
icodcl(ifac,isca(ii)) = 1
if (ippmod(ielarc).ge.1 .and. ielcor .eq.1) then
rcodcl(ifac,isca(ii),1) = dpot
else
rcodcl(ifac,isca(ii),1) = 1000.d0
endif
enddo
Example 4
For boundary faces of color 3 assign a wall and example of potential vector Dirichlet condition
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = iparoi
izone = 4
izfppp(ifac) = izone
if (ippmod(ielarc).ge.2) then
if (cdgfbo(1,ifac) .le. 2.249d-2 .or. &
cdgfbo(1,ifac) .ge. 2.249d-2 .or. &
cdgfbo(3,ifac) .le. -2.249d-2 .or. &
cdgfbo(3,ifac) .ge. 2.249d-2 ) then
iel = ifabor(ifac)
do idim = 1, ndimve
ii = ipotva(idim)
call field_get_val_prev_s(ivarfl(isca(ii)), cvara_potva)
icodcl(ifac,isca(ii)) = 1
rcodcl(ifac,isca(ii),1) = cvara_potva(iel)
enddo
endif
endif
enddo
Example 5
For boundary faces of color 51 assign a wall and restriking model for electric arc (anode boundaray condition).
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = iparoi
izone = 5
izfppp(ifac) = izone
ii=iscalt
icodcl(ifac,isca(ii)) = 1
rcodcl(ifac,isca(ii),1) = 2.d4
rcodcl(ifac,isca(ii),2) = 1.d5
ii = ipotr
icodcl(ifac,isca(ii)) = 1
if (ippmod(ielarc).ge.1 .and. ielcor .eq.1) then
rcodcl(ifac,isca(ii),1) = dpot
else
rcodcl(ifac,isca(ii),1) = 100.d0
endif
if (ippmod(ielarc).ge.1 .and. ielcor .eq.1) then
if (iclaq.eq.1 .and. ntcabs.le.ntdcla+30) then
z1 = zclaq - 2.d-4
if (z1.le.0.d0) z1 = 0.d0
z2 = zclaq + 2.d-4
if (z2.ge.2.d-2) z2 = 2.d-2
if (cdgfbo(3,ifac).ge.z1 .and. cdgfbo(3,ifac).le.z2) then
icodcl(ifac,isca(ii)) = 1
rcodcl(ifac,isca(ii),1) = dpot
else
icodcl(ifac,isca(ii)) = 3
rcodcl(ifac,isca(ii),3) = 0.d0
endif
endif
endif
if (ippmod(ielarc).ge.2) then
do idim= 1,ndimve
ii = ipotva(idim)
icodcl(ifac,isca(ii)) = 3
rcodcl(ifac,isca(ii),3) = 0.d0
enddo
endif
enddo
Example 6
For boundary faces of color 4 assign a symmetry.
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = isymet
izone = 6
izfppp(ifac) = izone
if (ippmod(ieljou).ge. 2) then
ii = ipoti
icodcl(ifac,isca(ii)) = 1
rcodcl(ifac,isca(ii),1) = 0.d0
endif
enddo