Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

To be able to treat the fields from the busses like "normal" 1-D (row) or 2-D (slab) fields (remember the physics only see one row or slab at the time - see above) they usually get "transformed" into regular 1-D or 2-D fields by using pointers the following way:

a) Declaration of the field as 1-D or 2-D pointer, for example:

Volet
     real, pointer, dimension(:) :: zpmoins
     real, pointer, dimension(:,:) :: ztmoins


In general, the 1-D or 2-D field name is the same as the starting position of the field in the bus, preceded by a 'z'.


b) Assigning the pointer

In utils/phymkptr.hf several functions are defined to assign a pointer to the right space on the bus, depending on the dimension and type of level (if multi level). They can be used to assign a pointer to an address in a bus so the pointer can then get used in the routine like a "normal" array, for example:

...

In the main surface routine, surface/sfc_main.F90, all fields needed by the surface schemes get copied from the three main busses (dynamic, permanent and volatile) to the surface bus in calls to the routine 'copybus'. The routine 'copybus' gets called for all surface schemes separately. It copies only points from the three busses to the surface bus for which there is a surface fraction of the respective surface scheme, which greater than a critical value of the respective surface scheme. For example, before the soil routine (ISBA/SVS/CLASS) gets called, 'copybus' will copy all points of the needed fields that contain a soil fraction greater equal 'critmask' to the surface bus. This is done in the calls:

    call copybus3(bus_soil, siz_soil, &
          ptr_soil, nvarsurf, &
          rg_soil, ni_soil, &
          ni, indx_soil, trnch, CP_TO_SFCBUS)

The starting address parameters (the ones declared in sfc_businit.F90 resp. phyvar.hf), will get new values assigned, matching now the start of the variable in the surface bus.
This means that fields in the surface routines are usually shorter than in the rest of the physics and they are usually different in the different surface schemes!for each surface scheme!

After the call to the specific surface routine the output fields from the the specific surface routine will get copied back in the respective main busses, again with the routine 'copybus', for example:

     call copybus3(bus_soil, siz_soil, &
          ptr_soil, nvarsurf, &
          rg_soil, ni_soil, &
          ni, indx_soil, trnch, CP_FROM_SFCBUS)


When called from the main surface routine, surface/sfc_main.F90, the main routines of the different surface schemes then get called, passing to them:

  • the surface bus itself
  • the size of the surface bus
  • the new starting addresses of the variable in the surface bus and
  • the number of variables


Inside the respective main surface routines for the different schemes the fields from the surface bus can then get accessed by:

a) Declaration of the field as 1-D or 2-D pointer (same as in other physics routines), for example:

Volet

       real,pointer,dimension(:)   :: TA, ZSNOW
       real,pointer,dimension(:,:) :: TS


Often, the 1-D or 2-D field name is the same as the starting position of the field in the bus, preceded by a 'z'.

b) Assigning the pointer


Volet

1-D fields:
    PS            (1:n)            => bus( x(pplus,  1, 1)       : ) ! Input surface pressure at t+dt
    TA            (1:n)            => bus( x(tplus,   1, nk)     : ) ! Input temperature at t+dt on lowest model level (nk)

2-D fields:
    TS            (1:N,1:IG)  => bus( x( TSOIL, 1, 1 )    : )    !  inout Temperature of soil layers [K]

Fields defined for the different surface fractions:
    ZSNOW (
1:N)           => bus( x(SNODP , 1, indx_sfc ) : )  ! output snow depth; where indx_sfc is set to the specific surface fraction