I’d like to know if there is a function working like ‘getfbr’ when coupling Code_Saturne with Syrthes.
In fact, I wrote a function computing the Nusselt number on the boundary between solid and fluid meshes. It works when starting Code_Saturne only. But when I launch a coupled calculation, the ‘getfbr’ can’t find any cell.
I could use ‘getcell’ with geometric conditions, but I’d like to have a code working with any mesh or any geometry (the height of my solid obstacle is variable).
Is there a way to use ‘getfbr’ here? Or another function working the same way?
Here is my code:
Code: Select all
integer iscal, ivar, irangv
integer ifac, iel, nlelt, ielcote, ilelt
integer, allocatable, dimension(:) :: lstelt
double precision, allocatable, dimension(:,:) :: Nux
double precision Sloc, Tcell, Tcote, gradT, Temp0
double precision yy, zz, xx, delta, Nusselt, posi
integer nb_tri, ii, jj
integer impout1
!===============================================================================
!===============================================================================
! Initialization
!===============================================================================
delta = 10.d0/1000.d0
Temp0 = 0.d0
nb_tri = 0
allocate(lstelt(nfabor)) ! temporary array for boundary faces selection
!===============================================================================
! User operations
!===============================================================================
! On calcule le Nusselt autour de l'obstacle
if (ntcabs.eq.ntmabs) then ! ne calcule qu'au dernier pas de temps
iscal = iscalt ! temperature scalar number
ivar = isca(iscal) ! temperature variable number
! Appel des cellules de bord
call getfbr('parois_obstacle',nlelt,lstelt)
allocate(Nux(nlelt,2))
Nux = 0.d0
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
iel = ifabor(ifac) ! element contre la cellule
xx = xyzcen(1,iel)
yy = xyzcen(2,iel)
zz = xyzcen(3,iel)
! Détermination de la position de la cellule
if (xx.lt.2) then
posi = yy
else if (xx.gt.2.25) then
posi = 0.5+(0.25-yy)
else
posi = 0.25+(xx-2)
endif
! recherche de la cellule juste à côté de la cellule considérée.
if (xx.lt.2) then
call findpt(ncelet, ncel, xyzcen, xx-delta, yy, zz, ielcote, irangv)
else if (xx.gt.2.25) then
call findpt(ncelet, ncel, xyzcen, xx+delta, yy, zz, ielcote, irangv)
else
call findpt(ncelet, ncel, xyzcen, xx, yy+delta, zz, ielcote, irangv)
endif
!calcul du gradient de temperature
Tcote = rtp(ielcote,ivar)
Tcell = rtp(iel,ivar)
gradT = abs((Tcell-Tcote)/delta)
! calcul du nombre de Nusselt
Nusselt = gradT/(Tcell-Temp0)
!Nusselt = 1 !test pour vérifier que toutes les cellules sont visitées
! Mise a jour du vecteur du Nusselt : insertion de l'élément de manière triée
if (nb_tri.eq.0) then
Nux(1,1) = posi
Nux(1,2) = Nusselt
nb_tri = nb_tri+1
else
ii = 1
do while (posi.lt.Nux(ii,1))
ii = ii+1
enddo
do jj = nb_tri+1,ii,-1
Nux(jj,1) = Nux(jj-1,1)
Nux(jj,2) = Nux(jj-1,2)
enddo
Nux(ii,1) = posi
Nux(ii,2) = Nusselt
nb_tri = nb_tri+1
endif
enddo
! Ecriture
if (irangp.le.0) then
open(impout1,file='Nusselt.dat', position = "append")
write(impout1,*) &
'# abscisse_curviligne Nusselt (x) '
do ii=1,nlelt
write(impout1,120) &
Nux(ii,1), Nux(ii,2)
enddo
close(impout1)
endif
deallocate(lstelt)
deallocate(Nux)
endif