GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/paramlmdz_phy_mod.F90 Lines: 68 68 100.0 %
Date: 2023-06-30 12:56:34 Branches: 55 62 88.7 %

Line Branch Exec Source
1
MODULE paramLMDZ_phy_mod
2
3
! Olivier 13/07/2016
4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5
6
CONTAINS
7
8
289
  SUBROUTINE ini_paramLMDZ_phy(dtime,nid_ctesGCM)
9
10
    USE iophy
11
    USE dimphy
12
    USE ioipsl, only: histbeg, histvert, histdef, histend, ymds2ju
13
    USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root
14
    USE geometry_mod, ONLY: longitude_deg, latitude_deg
15
    USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, klon_glo
16
    USE time_phylmdz_mod, ONLY: annee_ref, day_ref, itau_phy, pdtphys
17
    USE mod_phys_lmdz_transfert_para, ONLY: gather, bcast
18
19
    IMPLICIT NONE
20
21
    include "clesphys.h"
22
    include "YOMCST.h"
23
24
    REAL, INTENT(OUT)    :: dtime
25
    INTEGER, INTENT(OUT) :: nid_ctesGCM
26
27
2
    REAL,DIMENSION(klon_glo)        :: rlat_glo
28
2
    REAL,DIMENSION(klon_glo)        :: rlon_glo
29
    INTEGER i, idayref, ISW, itau_w
30
    REAL zstophy, zout
31
2
    REAL zx_lon(nbp_lon,nbp_lat)
32
2
    REAL zx_lat(nbp_lon,nbp_lat)
33
34
    CHARACTER*1 ch1
35
    INTEGER nhori
36
    INTEGER, PARAMETER :: np=1
37
38
    REAL zjulian
39
    SAVE zjulian
40
!$OMP THREADPRIVATE(zjulian)
41
42
!IM    Implemente en modes sequentiel et parallele
43
44
1
       CALL gather(latitude_deg,rlat_glo)
45
1
       CALL bcast(rlat_glo)
46
1
       CALL gather(longitude_deg,rlon_glo)
47
1
       CALL bcast(rlon_glo)
48
49
!$OMP MASTER
50
1
      IF (is_mpi_root) THEN
51
!
52
!       zstophy = pdtphys
53
!       zout = -1
54
!--OB modified for daily output
55
1
       zstophy = 86400.
56
1
       zout = 86400.
57
!
58
1
       idayref = day_ref
59
1
       CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
60
!
61
1
       CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlon_glo,zx_lon)
62
1
       IF (nbp_lon.GT.1) THEN
63
33
       DO i = 1, nbp_lon
64
32
         zx_lon(i,1) = rlon_glo(i+1)
65
33
         zx_lon(i,nbp_lat) = rlon_glo(i+1)
66
       ENDDO
67
       ENDIF
68
!
69
1
       CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlat_glo,zx_lat)
70
!
71
       CALL histbeg("paramLMDZ_phy.nc",  &
72
                       np,zx_lon(np:np,1), np,zx_lat(1,np:np), &
73
                       1,1,1,1, &
74
                       itau_phy, zjulian, dtime, &
75
1
                       nhori, nid_ctesGCM)
76
!
77
       CALL histdef(nid_ctesGCM, "R_ecc",  &
78
                      "Excentricite","-", &
79
                      1,1,nhori, 1,1,1, -99, 32, &
80
1
                      "ave(X)", zstophy,zout)
81
!
82
       CALL histdef(nid_ctesGCM, "R_peri",  &
83
                      "Equinoxe","-", &
84
                      1,1,nhori, 1,1,1, -99, 32, &
85
1
                      "ave(X)", zstophy,zout)
86
!
87
       CALL histdef(nid_ctesGCM, "R_incl",  &
88
                      "Inclinaison","deg", &
89
                      1,1,nhori, 1,1,1, -99, 32, &
90
1
                      "ave(X)", zstophy,zout)
91
!
92
       CALL histdef(nid_ctesGCM, "solaire",  &
93
                      "Constante solaire","W/m2", &
94
                      1,1,nhori, 1,1,1, -99, 32, &
95
1
                      "ave(X)", zstophy,zout)
96
!
97
#ifdef CPP_RRTM
98
1
       IF (iflag_rrtm.EQ.1) THEN
99
7
         DO ISW=1, NSW
100
6
           WRITE(ch1,'(i1)') ISW
101
           CALL histdef(nid_ctesGCM, "rsun"//ch1,  &
102
                      "Fraction constante solaire bande "//ch1,"W/m2", &
103
                      1,1,nhori, 1,1,1, -99, 32, &
104
7
                      "ave(X)", zstophy,zout)
105
         ENDDO
106
       ENDIF
107
#endif
108
!
109
       CALL histdef(nid_ctesGCM, "co2_ppm",  &
110
                      "Concentration du CO2", "ppm", &
111
                      1,1,nhori, 1,1,1, -99, 32,  &
112
1
                      "ave(X)", zstophy,zout)
113
!
114
       CALL histdef(nid_ctesGCM, "CH4_ppb",  &
115
                      "Concentration du CH4", "ppb", &
116
                      1,1,nhori, 1,1,1, -99, 32,  &
117
1
                      "ave(X)", zstophy,zout)
118
!
119
       CALL histdef(nid_ctesGCM, "N2O_ppb", &
120
                      "Concentration du N2O", "ppb", &
121
                      1,1,nhori, 1,1,1, -99, 32, &
122
1
                      "ave(X)", zstophy,zout)
123
!
124
       CALL histdef(nid_ctesGCM, "CFC11_ppt", &
125
                      "Concentration du CFC11", "ppt", &
126
                      1,1,nhori, 1,1,1, -99, 32, &
127
1
                      "ave(X)", zstophy,zout)
128
!
129
       CALL histdef(nid_ctesGCM, "CFC12_ppt", &
130
                      "Concentration du CFC12", "ppt", &
131
                      1,1,nhori, 1,1,1, -99, 32, &
132
1
                      "ave(X)", zstophy,zout)
133
!
134
1
       CALL histend(nid_ctesGCM)
135
136
       ENDIF !(is_mpi_root)
137
!$OMP END MASTER
138
139
1
  END SUBROUTINE ini_paramLMDZ_phy
140
141
!=================================================================
142
143
288
  SUBROUTINE write_paramLMDZ_phy(itap,nid_ctesGCM,ok_sync)
144
145
1
    USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root
146
    USE time_phylmdz_mod, ONLY: day_step_phy, annee_ref, itau_phy, start_time
147
    USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, klon_glo
148
149
    USE iophy
150
    USE ioipsl, ONLY: histwrite, histsync
151
152
#ifdef CPP_RRTM
153
    USE YOESW, ONLY : RSUN
154
#endif
155
156
    IMPLICIT NONE
157
158
    include "clesphys.h"
159
    include "YOMCST.h"
160
161
    INTEGER, INTENT(IN) :: itap, nid_ctesGCM
162
    LOGICAL, INTENT(IN) :: ok_sync
163
164
    INTEGER itau_w, ISW
165
576
    INTEGER ndex2d(nbp_lon*nbp_lat)
166
    REAL :: zx_tmp_0d(1,1)
167
    INTEGER, PARAMETER :: np=1
168
169
    CHARACTER*1 ch1
170
171
!$OMP MASTER
172
288
      IF (is_mpi_root) THEN
173
!
174
304416
      ndex2d = 0
175
288
      itau_w = itau_phy + itap + int(start_time * day_step_phy)
176
!
177
! Variables globales
178
!
179

1152
      zx_tmp_0d=R_ecc
180
      CALL histwrite(nid_ctesGCM,"R_ecc",itau_w, &
181
288
                     zx_tmp_0d,np,ndex2d)
182
!
183

1152
      zx_tmp_0d=R_peri
184
      CALL histwrite(nid_ctesGCM,"R_peri",itau_w, &
185
288
                     zx_tmp_0d,np,ndex2d)
186
!
187

1152
      zx_tmp_0d=R_incl
188
      CALL histwrite(nid_ctesGCM,"R_incl",itau_w, &
189
288
                     zx_tmp_0d,np,ndex2d)
190
!
191

1152
      zx_tmp_0d=solaire
192
      CALL histwrite(nid_ctesGCM,"solaire",itau_w, &
193
288
                     zx_tmp_0d,np,ndex2d)
194
!
195
#ifdef CPP_RRTM
196
288
      IF (iflag_rrtm.EQ.1) THEN
197
2016
        DO ISW=1, NSW
198
1728
          WRITE(ch1,'(i1)') ISW
199

6912
          zx_tmp_0d=RSUN(ISW)
200
          CALL histwrite(nid_ctesGCM,"rsun"//ch1,itau_w, &
201
2016
                         zx_tmp_0d,np,ndex2d)
202
        ENDDO
203
      ENDIF
204
#endif
205
!
206

1152
      zx_tmp_0d=co2_ppm
207
      CALL histwrite(nid_ctesGCM,"co2_ppm",itau_w, &
208
288
                     zx_tmp_0d,np,ndex2d)
209
!
210

1152
      zx_tmp_0d=CH4_ppb
211
      CALL histwrite(nid_ctesGCM,"CH4_ppb",itau_w, &
212
288
                     zx_tmp_0d,np,ndex2d)
213
!
214

1152
      zx_tmp_0d=N2O_ppb
215
      CALL histwrite(nid_ctesGCM,"N2O_ppb",itau_w, &
216
288
                     zx_tmp_0d,np,ndex2d)
217
!
218

1152
      zx_tmp_0d=CFC11_ppt
219
      CALL histwrite(nid_ctesGCM,"CFC11_ppt",itau_w, &
220
288
                     zx_tmp_0d,np,ndex2d)
221
!
222

1152
      zx_tmp_0d=CFC12_ppt
223
      CALL histwrite(nid_ctesGCM,"CFC12_ppt",itau_w, &
224
288
                     zx_tmp_0d,np,ndex2d)
225
!
226
!=================================================================
227
!
228
288
      IF (ok_sync) THEN
229
288
        call histsync(nid_ctesGCM)
230
      ENDIF
231
232
      ENDIF !(is_mpi_root) then
233
!$OMP END MASTER
234
235
288
  END SUBROUTINE write_paramLMDZ_phy
236
237
END MODULE paramLMDZ_phy_mod