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 ipotr, ipoti, f_id, ipotva1, ipotva2, ipotva3
character(len=80) :: f_name
integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: bfpro_rom
double precision, dimension(:), pointer :: cvara_potva
integer :: keyvar
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.
call field_get_val_s(ibrom, bfpro_rom)
call getfbr(
'1', nlelt, lstelt)
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
icodcl(ifac,ipotr) = 1
rcodcl(ifac,ipotr,1) = 0.d0
if (ngazge .gt. 1) then
do iesp=1,ngazge-1
write(f_name,'(a13,i2.2)') 'esl_fraction_',iesp
call field_get_id(trim(f_name), f_id)
call field_get_key_int(f_id, keyvar, ii)
icodcl(ifac,ii) = 1
rcodcl(ifac,ii,1) = 0.d0
enddo
endif
if (ippmod(ieljou).ge. 2) then
icodcl(ifac,ipoti) = 1
rcodcl(ifac,ipoti,1) = 0.d0
endif
if (ippmod(ielarc).ge.2) then
icodcl(ifac,ipotva1) = 3
rcodcl(ifac,ipotva1,3) = 0.d0
icodcl(ifac,ipotva2) = 3
rcodcl(ifac,ipotva2,3) = 0.d0
icodcl(ifac,ipotva3) = 3
rcodcl(ifac,ipotva3,3) = 0.d0
endif
enddo
Example 2
For boundary faces of color 5 assign an free outlet and example of electrode for Joule Effect by direct conduction.
call getfbr(
'5', nlelt, lstelt)
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = isolib
izone = 2
izfppp(ifac) = izone
if (ippmod(ieljou).ge. 1) then
icodcl(ifac,ipotr) = 1
if (ielcor.eq.1) then
rcodcl(ifac,ipotr,1) = 500.d0*coejou
else
rcodcl(ifac,ipotr,1) = 500.d0
endif
endif
if (ippmod(ieljou).ge. 2) then
icodcl(ifac,ipoti) = 1
if (ielcor.eq.1) then
rcodcl(ifac,ipoti,1) = sqrt(3.d0)*500.d0*coejou
else
rcodcl(ifac,ipoti,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.
call getfbr(
'2', nlelt, lstelt)
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = isolib
izone = 3
izfppp(ifac) = izone
icodcl(ifac,ipotr) = 1
if (ippmod(ielarc).ge.1 .and. ielcor .eq.1) then
rcodcl(ifac,ipotr,1) = pot_diff
else
rcodcl(ifac,ipotr,1) = 1000.d0
endif
enddo
Example 4
For boundary faces of color 3 assign a wall and example of potential vector Dirichlet condition
call getfbr(
'3', nlelt, lstelt)
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)
icodcl(ifac,ipotva1) = 1
call field_get_val_prev_s_by_name('vec_potential_01', cvara_potva)
rcodcl(ifac,ipotva1,1) = cvara_potva(iel)
icodcl(ifac,ipotva2) = 1
call field_get_val_prev_s_by_name('vec_potential_02', cvara_potva)
rcodcl(ifac,ipotva2,1) = cvara_potva(iel)
icodcl(ifac,ipotva3) = 1
call field_get_val_prev_s_by_name('vec_potential_0', cvara_potva)
rcodcl(ifac,ipotva3,1) = cvara_potva(iel)
endif
endif
enddo
Example 5
For boundary faces of color 51 assign a wall and restriking model for electric arc (anode boundaray condition).
call getfbr(
'51', nlelt, lstelt)
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
icodcl(ifac,ipotr) = 1
if (ippmod(ielarc).ge.1 .and. ielcor .eq.1) then
rcodcl(ifac,ipotr,1) = pot_diff
else
rcodcl(ifac,ipotr,1) = 100.d0
endif
if (ippmod(ielarc).ge.1 .and. ielcor .eq.1) then
if (irestrike.eq.1 .and. ntcabs.le.ntdcla+30) then
z1 = restrike_point_z - 2.d-4
if (z1.le.0.d0) z1 = 0.d0
z2 = restrike_point_z + 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) = pot_diff
else
icodcl(ifac,isca(ii)) = 3
rcodcl(ifac,isca(ii),3) = 0.d0
endif
endif
endif
if (ippmod(ielarc).ge.2) then
icodcl(ifac,ipotva1) = 3
rcodcl(ifac,ipotva1,3) = 0.d0
icodcl(ifac,ipotva2) = 3
rcodcl(ifac,ipotva2,3) = 0.d0
icodcl(ifac,ipotva3) = 3
rcodcl(ifac,ipotva3,3) = 0.d0
endif
enddo
Example 6
For boundary faces of color 4 assign a symmetry.
call getfbr(
'4', nlelt, lstelt)
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = isymet
izone = 6
izfppp(ifac) = izone
if (ippmod(ieljou).ge. 2) then
icodcl(ifac,ipoti) = 1
rcodcl(ifac,ipoti,1) = 0.d0
endif
enddo