programmer's documentation
Lagrangian volume statistical variable (uslaen.f90)

For the writing of the listing and the post-processing: Average of the Lagrangian volume statistical variables. Possible intervention of the user.

Local variables to be added

The following local variables need to be defined for the examples in this section:

! Local variables
integer iel
double precision aa
integer ii, jj, dimtab
integer, allocatable, dimension(:) :: tabstat

Initialization and finalization

The following initialization block needs to be added for the following examples:

allocate(tabstat(ncel))

At the end of the subroutine, it is recommended to deallocate the work array:

! Free memory
deallocate(tabstat)

In theory Fortran 95 deallocates locally-allocated arrays automatically, but deallocating arrays in a symetric manner to their allocation is good pratice, and avoids using a different logic for C and Fortran.

Zone of standard statistics

Pinpoint the cells where stats are to be calculated.

ii = 0
do iel = 1, ncel
if (statis(iel,ilpd1).gt.seuil) then
ii = ii + 1
tabstat(ii) = iel
endif
tracel(iel) = 0.d0
enddo
dimtab = ii

General case:

if (ivarl.ne.ilfv .and. ivarl.ne.ilpd) then

Average

if (iflu.eq.0) then
do jj = 1, dimtab
tracel(tabstat(jj)) = statis(tabstat(jj),ivarl1) &
/ statis(tabstat(jj),ilpd1)
enddo

Variance

else
do jj = 1, dimtab
aa = statis(tabstat(jj),ivarlm)/statis(tabstat(jj),ilpd1)
tracel(tabstat(jj)) = stativ(tabstat(jj),ivarl1) &
/ statis(tabstat(jj),ilpd1) - (aa * aa)
enddo
endif

Volume fraction (ilfv)

else if (ivarl.eq.ilfv) then

Average

if (iflu.eq.0) then
do jj = 1, dimtab
tracel(tabstat(jj)) = statis(tabstat(jj),ilfv) &
/ (dble(npst) * volume(tabstat(jj)))
enddo
else

Variance

do jj = 1, dimtab
if (npst.gt.1) then
aa = statis(tabstat(jj),ivarlm) / (dble(npst) * volume(tabstat(jj)))
tracel(tabstat(jj)) = stativ(tabstat(jj),ivarl1) &
/ (dble(npst) * volume(tabstat(jj)))**2 &
- aa*aa
else
tracel(tabstat(jj)) = zero
endif
enddo
endif

Sum of the statistical weights

else if (ivarl.eq.ilpd) then
if (iflu .eq.0) then
do jj = 1, dimtab
tracel(tabstat(jj)) = statis(tabstat(jj),ivarl1)
enddo
else
write(nfecra,9000) iflu
do jj = 1, dimtab
tracel(tabstat(jj)) = zero
enddo
endif
endif

Format

9000 format( &
'@ ',/,&
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
'@ ',/,&
'@ @@ CAUTION: ERROR IN THE LAGRANGIAN MODULE (uslaen) ',/,&
'@ ========= ',/,&
'@ It is not possible to compute the variance of the ',/,&
'@ statistical weights ',/,&
'@ ',/,&
'@ The variance of the statistical weight has been asked ',/,&
'@ in uslaen (ivarl=', i10,' et iflu=', i10,'). ',/,&
'@ ',/,&
'@ The call to subroutine uslaen must be checked ',/,&
'@ ',/,&
'@ The calculation continues. ',/,&
'@ ',/,&
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@',/,&
'@ ',/)

Zone of the user intervention: example

Example 1: Statistic calculated in uslast.90 and stored in the array statis.

if (nvlsts.gt.0) then
if (ivarl.eq.ilvu(1)) then
!-----> Average for the mass concentration
if (iflu.eq.0) then
do jj = 1, dimtab
if (npst.gt.0) then
tracel(tabstat(jj)) = statis(tabstat(jj),ivarl1) &
/ (dble(npst) *ro0 *volume(tabstat(jj)))
else if (iplas.ge.idstnt) then
tracel(tabstat(jj)) = statis(tabstat(jj),ivarl1) &
/ (ro0 *volume(tabstat(jj)))
else
tracel(tabstat(jj)) = zero
endif
enddo
else
!-----> Variance of the mass concentration
do jj = 1, dimtab
aa = statis(tabstat(jj),ivarlm)/statis(tabstat(jj),ilpd1)
tracel(tabstat(jj)) = stativ(tabstat(jj),ivarl1) &
/ statis(tabstat(jj),ilpd1) &
- (aa * aa)
enddo
endif
endif
endif