source: dynamico_lmdz/simple_physics/phyparam/physics/iniphyparam_mod.F90 @ 4229

Last change on this file since 4229 was 4229, checked in by dubos, 5 years ago

simple_physics : beautify code

File size: 3.9 KB
Line 
1MODULE iniphyparam_mod
2#include "use_logging.h"
3  IMPLICIT NONE
4  PRIVATE
5
6  REAL, PARAMETER :: perfect_gas_const = 8314.46261815324 ! NB using g instead of kg for mass
7
8  PUBLIC :: iniphyparam
9
10CONTAINS
11
12  SUBROUTINE iniphyparam(ngrid,nlayer, &
13       &           punjours,              &
14       &           pdayref,ptimestep,     &
15       &           prad,pg,pr,pcpp)
16    USE callkeys
17    USE phys_const, ONLY : planet_rad,g,r,cpp,rcp,dtphys,unjours,mugaz
18    USE planet, ONLY : coefir, coefvis
19    USE astronomy
20    USE turbulence, ONLY : lmixmin, emin_turb
21    USE surface
22    USE read_param_mod
23
24    INTEGER, INTENT(IN) :: &
25         ngrid, &       ! Size of the horizontal grid
26         nlayer, &      ! Number of vertical layers.
27         pdayref        ! Day of reference for the simulation
28    REAL, INTENT(IN)  :: ptimestep, prad, pg, pr, pcpp, punjours
29
30    CALL read_param('unjours', 86400., unjours,'unjours')
31    CALL read_param('planet_rad',prad,planet_rad,'planet_rad')
32    CALL read_param('g',9.8           ,g,'g')
33    CALL read_param('cpp',1004.       ,cpp,'cpp')
34    CALL read_param('mugaz',28.       ,mugaz,'mugaz')
35    r=perfect_gas_const/mugaz
36    rcp=r/cpp
37
38    CALL read_param('year_day',360.   ,year_day,'year_day')
39    CALL read_param('periheli',150.   ,periheli,'periheli')
40    CALL read_param('aphelie',150.    ,aphelie,'aphelie')
41    CALL read_param('peri_day',0.     ,peri_day,'peri_day')
42    CALL read_param('obliquit',23.    ,obliquit,'obliquit')
43    CALL read_param('Cd_mer',.01      ,Cd_mer,'Cd_mer')
44    CALL read_param('Cd_ter',.01      ,Cd_ter,'Cd_ter')
45    CALL read_param('I_mer',30000.    ,I_mer,'I_mer')
46    CALL read_param('I_ter',30000.    ,I_ter,'I_ter')
47    CALL read_param('alb_ter',.112    ,alb_ter,'alb_ter')
48    CALL read_param('alb_mer',.112    ,alb_mer,'alb_mer')
49    CALL read_param('emi_mer',1.      ,emi_mer,'emi_mer')
50    CALL read_param('emi_mer',1.      ,emi_mer,'emi_mer')
51    CALL read_param('emin_turb',1.e-16 ,emin_turb,'emin_turb')
52    CALL read_param('lmixmin',100.    ,lmixmin,'lmixmin')
53    CALL read_param('coefvis',.99     ,coefvis,'coefvis')
54    CALL read_param('coefir',.08      ,coefir,'coefir')
55
56    CALL read_param('callrad',.true.,callrad,'appel rayonnemen')
57    CALL read_param('calldifv',.true.,calldifv,'appel difv')
58    CALL read_param('calladj',.true.,calladj,'appel adj')
59    CALL read_param('callcond',.true.,callcond,'appel cond')
60    CALL read_param('callsoil',.true.,callsoil,'appel soil')
61    CALL read_param('season',.true.,season,'appel soil')
62    CALL read_param('diurnal',.false.,diurnal,'appel soil')
63    CALL read_param('lverbose',.true.,lverbose,'appel soil')
64    CALL read_param('period_sort',1.,period_sort,'period sorties en jour')
65
66    CALL check_mismatch('unjours', punjours, unjours)
67    CALL check_mismatch('rad', prad, planet_rad)
68    CALL check_mismatch('g', pg, g)
69    CALL check_mismatch('R', pr, r)
70    CALL check_mismatch('cpp', pcpp, cpp)
71
72    WRITELOG(*,*) 'Activation de la physique:'
73    WRITELOG(*,*) ' R=',r
74    WRITELOG(*,*) ' Rayonnement ',callrad
75    WRITELOG(*,*) ' Diffusion verticale turbulente ', calldifv
76    WRITELOG(*,*) ' Ajustement convectif ',calladj
77    WRITELOG(*,*) ' Sol ',callsoil
78    WRITELOG(*,*) ' Cycle diurne ',diurnal
79
80    !   choice of the frequency of the computation of radiations
81    IF(diurnal) THEN
82       iradia=NINT(punjours/(20.*ptimestep))
83    ELSE
84       iradia=NINT(punjours/(4.*ptimestep))
85    ENDIF
86    iradia=1
87    WRITELOG(*,*) 'unjours',punjours
88    WRITELOG(*,*) 'The radiative transfer is computed each ', &
89         &   iradia,' physical time-step or each ', &
90         &   iradia*ptimestep,' seconds'
91
92    dtphys=ptimestep
93
94    LOG_INFO('iniphyparama')
95  END SUBROUTINE iniphyparam
96
97  SUBROUTINE check_mismatch(name, a,b)
98    CHARACTER(*), INTENT(IN) :: name
99    REAL, INTENT(IN) :: a,b
100    IF(a /= b) THEN
101       PRINT *, 'Phys/dyn mismatch for ', name, ' : ',a,b
102    END IF
103  END SUBROUTINE check_mismatch
104
105END MODULE iniphyparam_mod
Note: See TracBrowser for help on using the repository browser.