8.0
general documentation
Atmospheric model (cs_user_atmospheric_model.f90)

Introduction

User subroutine for the atmospheric model.

Atmospheric module

imode corresponds to the number of calls of the usatdv function. Depending on the value of imode , different operations are performed in the following example.

imode = 0

if (imode.eq.0) then
write(nfecra,*) 'defining the dimensions of the 1D vertical arrays'
else
write(nfecra,*) 'defining the coordinates and levels of the 1D vertical arrays'
endif
! 1. Defining the max vertical level:
!====================================
! For the first call (imode = 0) the user should fill the maximum height of the
! 1D model (zvmax), the numbert of 1D verticals and the number of levels
! If the 1D radiative model, the profiles will be extended to 11000m (troposhere)
if (imode.eq.0) then
nvert = 1
kvert = 50
kmx = kvert
zvmax = 1975.d0 ! for Wangara
! If 1D radiative model: complete the vertical array up to 11000
if (iatra1.gt.0) then
ztop = 11000.d0
zzmax = (int(zvmax)/1000)*1000.d0
do while(zzmax.le.(ztop-1000.d0))
zzmax = zzmax + 1000.d0
kmx = kmx + 1
enddo
endif

imode = 1

! 2. Defining the coordinates and levels of the vertical arrays:
!===============================================================
! for the second call (after allocating the arrays)
! the user should fill the arrays
! Vertical levels:
zvert(1) = 0.d0
zvert(2) = 5.d0
zvert(3) = 20.5d0
zvert(4) = 42.0d0
zvert(5) = 65.0d0
zvert(6) = 89.5d0
zvert(7) = 115.0d0
zvert(8) = 142.0d0
zvert(9) = 170.5d0
zvert(10) = 199.5d0
zvert(11) = 230.0d0
zvert(12) = 262.0d0
zvert(13) = 294.5d0
zvert(14) = 328.5d0
zvert(15) = 363.5d0
zvert(16) = 399.0d0
zvert(17) = 435.5d0
zvert(18) = 473.5d0
zvert(19) = 512.0d0
zvert(20) = 551.0d0
zvert(21) = 591.5d0
zvert(22) = 632.5d0
zvert(23) = 674.0d0
zvert(24) = 716.0d0
zvert(25) = 759.0d0
zvert(26) = 802.5d0
zvert(27) = 846.5d0
zvert(28) = 891.5d0
zvert(29) = 936.5d0
zvert(30) = 982.0d0
zvert(31) = 1028.0d0
zvert(32) = 1074.5d0
zvert(33) = 1122.0d0
zvert(34) = 1169.5d0
zvert(35) = 1217.0d0
zvert(36) = 1265.5d0
zvert(37) = 1314.5d0
zvert(38) = 1363.5d0
zvert(39) = 1413.0d0
zvert(40) = 1462.5d0
zvert(41) = 1512.5d0
zvert(42) = 1563.0d0
zvert(43) = 1613.5d0
zvert(44) = 1664.5d0
zvert(45) = 1715.5d0
zvert(46) = 1767.0d0
zvert(47) = 1818.5d0
zvert(48) = 1870.0d0
zvert(49) = 1922.5d0
zvert(50) = 1975.0d0
! If 1D radiative model: complete the vertical array up to 11000 m
if (iatra1.gt.0) then
ztop = 11000.d0
ii = kvert
zzmax = (int(zvert(ii))/1000)*1000.d0
do while(zzmax.le.(ztop-1000.d0))
zzmax = zzmax+1000.d0
ii = ii + 1
zvert(ii) = zzmax
enddo
endif
! 3 - Initializing the position of each vertical
!==============================================
do iiv = 1, nvert
! xy coordinates of vertical iiv:
xyvert(iiv,1) = 50.d0 !x coordinate
xyvert(iiv,2) = 50.d0 !y coordinate
xyvert(iiv,3) = 1.d0 !kmin (in case of relief)
! 4 - Initializing the soil table of each vertical grid
!=====================================================
soilvert(iiv)%albedo = 0.25d0
soilvert(iiv)%emissi = 0.965d0
soilvert(iiv)%ttsoil = 14.77d0
soilvert(iiv)%totwat = 0.0043d0
soilvert(iiv)%pressure = 1023.d0
soilvert(iiv)%density = 1.23d0
soilvert(iiv)%foir = 0.d0
soilvert(iiv)%fos = 0.d0
enddo
endif

Data Entry for the atmospheric soil model

To activate the model, the user has to set the and to specify the zone id on which the soil model is applied in cs_user_parameters.c, routine cs_user_model:

cs_glob_atmo_option->soil_model = 1; /* Switch on soil model */
/* Set the number of predefined categories (+1 which is the default one)
* among:
* - CS_ATMO_SOIL_5_CAT
* - CS_ATMO_SOIL_7_CAT
* */
cs_glob_atmo_option->soil_cat= CS_ATMO_SOIL_5_CAT; /* Switch on soil model */
/* Specify the boundary zone which is modeled */
@ CS_ATMO_SOIL_5_CAT
Definition: cs_atmo.h:106
cs_atmo_option_t * cs_glob_atmo_option
const cs_zone_t * cs_boundary_zone_by_name(const char *name)
Return a pointer to a boundary zone based on its name if present.
Definition: cs_boundary_zone.c:711
int soil_zone_id
Definition: cs_atmo.h:281
cs_atmo_soil_cat_t soil_cat
Definition: cs_atmo.h:279
int soil_model
Definition: cs_atmo.h:274
int id
Definition: cs_zone.h:59

Then the user may change default coefficient values for soil categories in cs_user_parameters.f90, routine usipsu

! Example to modify the soil parameters if activated
if (iatsoil.eq.1) then
! Example to modify some Soil constants for minerals (from Wangara test case)
tab_sol(4)%csol = 1.7e-5
tab_sol(4)%rugthe = 0.0012
tab_sol(4)%rugdyn = 0.0012
endif

Initialization of atmospheric

The user has to specify the percentage of each categories for all faces of the soil zone in cs_user_initialization.c:

const cs_zone_t *z
cs_field_t *f = cs_field_by_name("atmo_soil_percentages");
for (cs_lnum_t elt_id = 0; elt_id < z->n_elts; elt_id++) {
for (cs_lnum_t soil_id = 0; soil_id < f->dim; soil_id++)
f->val[soil_id + f->dim * elt_id] = 0.;
/* 100% of mineral */
f->val[4 + f->dim * elt_id] = 100.;
}
}
const cs_zone_t * cs_boundary_zone_by_id(int id)
Return a pointer to a boundary zone based on its id.
Definition: cs_boundary_zone.c:687
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
cs_field_t * cs_field_by_name(const char *name)
Return a pointer to a field based on its name.
Definition: cs_field.c:2340
Field descriptor.
Definition: cs_field.h:130
cs_real_t * val
Definition: cs_field.h:151
int dim
Definition: cs_field.h:137
Definition: cs_zone.h:55
cs_lnum_t n_elts
Definition: cs_zone.h:64