| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Atmospheric example

# Atmospheric example

## Local variables to be added

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

integer iel
double precision d2s3
double precision zent,xuent,xvent,xkent,xeent,tpent
integer, allocatable, dimension(:) :: lstelt

## Allocation

Before user initialization, work arrays lstelt must be allocated, like in basic example.

## Initialization

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

allocate(lstelt(ncel)) ! temporary array for cells selection
d2s3 = 2.d0/3.d0
!===============================================================================
! Initialize variables using an input meteo profile
! (only if we are not doing a restart)
!===============================================================================
if (isuite.eq.0) then
do iel = 1, ncel
zent=xyzcen(3,iel)
call intprf &
!==========
(nbmetd, nbmetm, &
zdmet, tmmet, umet , zent , ttcabs, xuent )
call intprf &
!==========
(nbmetd, nbmetm, &
zdmet, tmmet, vmet , zent , ttcabs, xvent )
call intprf &
!==========
(nbmetd, nbmetm, &
zdmet, tmmet, ekmet, zent , ttcabs, xkent )
call intprf &
!==========
(nbmetd, nbmetm, &
zdmet, tmmet, epmet, zent , ttcabs, xeent )
rtp(iel,iu)=xuent
rtp(iel,iv)=xvent
rtp(iel,iw)=0.d0
! ITYTUR est un indicateur qui vaut ITURB/10
if (itytur.eq.2) then
rtp(iel,ik) = xkent
rtp(iel,iep) = xeent
elseif (itytur.eq.3) then
rtp(iel,ir11) = d2s3*xkent
rtp(iel,ir22) = d2s3*xkent
rtp(iel,ir33) = d2s3*xkent
rtp(iel,ir12) = 0.d0
rtp(iel,ir13) = 0.d0
rtp(iel,ir23) = 0.d0
rtp(iel,iep) = xeent
elseif (iturb.eq.50) then
rtp(iel,ik) = xkent
rtp(iel,iep) = xeent
rtp(iel,iphi) = d2s3
rtp(iel,ifb) = 0.d0
elseif (iturb.eq.60) then
rtp(iel,ik) = xkent
rtp(iel,iomg) = xeent/cmu/xkent
elseif (iturb.eq.70) then
rtp(iel,inusa) = cmu*xkent**2/xeent
endif
if (iscalt.ge.0) then
! On suppose que le scalaire est la temperature potentielle :
call intprf &
!==========
(nbmett, nbmetm, &
ztmet, tmmet, tpmet, zent , ttcabs, tpent )
rtp(iel,isca(iscalt)) = tpent
endif
enddo
endif

## Finalization

At the end of the subroutine, it is recommended to deallocate the work array lstelt, like in basic example.