Changeset 3366 for LMDZ6/trunk
- Timestamp:
- Jul 8, 2018, 10:35:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/phylmd/tracco2i_mod.F90
r3361 r3366 82 82 !--co2bb is zero for now 83 83 CALL co2_emissions(debutphy,co2ff,co2bb) 84 PRINT *,'co2 emissions i' 84 85 85 86 !--preparing the net anthropogenic flux at the surface for mixing layer 86 87 !--unit kg CO2 / m2 / s 87 DO i=1, klon 88 source(i,id_CO2)=co2ff(i)+co2bb(i) 89 ENDDO 88 source(:,id_CO2)=co2ff(:)+co2bb(:) 90 89 91 90 !--computing global mean CO2 for radiation … … 111 110 USE geometry_mod, ONLY : cell_area 112 111 USE mod_grid_phy_lmdz 113 USE mod_phys_lmdz_mpi_data, ONLY :is_mpi_root112 USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root 114 113 USE mod_phys_lmdz_para, ONLY: gather, scatter 115 114 USE phys_cal_mod … … 126 125 127 126 ! For NetCDF: 128 integerncid_in ! IDs for input files129 integervarid, ncerr127 INTEGER ncid_in ! IDs for input files 128 INTEGER varid, ncerr 130 129 131 130 INTEGER :: n_glo, n_month 132 131 REAL, POINTER:: vector(:), time(:) 133 REAL,ALLOCATABLE :: flx_co2_glo(:,:) ! fossil-fuel CO2 134 REAL,ALLOCATABLE, SAVE :: flx_co2(:,:) ! fossil-fuel CO2 135 !$OMP THREADPRIVATE(flx_co2) 136 137 IF (debutphy) THEN 138 139 ALLOCATE(flx_co2(klon,12)) 132 REAL,ALLOCATABLE :: flx_co2ff_glo(:,:) ! fossil-fuel CO2 133 REAL,ALLOCATABLE, SAVE :: flx_co2ff(:,:) ! fossil-fuel CO2 134 REAL,ALLOCATABLE :: flx_co2bb_glo(:,:) ! biomass-burning CO2 135 REAL,ALLOCATABLE, SAVE :: flx_co2bb(:,:) ! biomass-burning CO2 136 !$OMP THREADPRIVATE(flx_co2ff, flx_co2bb) 137 138 LOGICAL, PARAMETER :: readco2ff=.TRUE., readco2bb=.FALSE. !!may be controlled via the .def later on 139 140 IF (debutphy) THEN 141 142 ALLOCATE(flx_co2ff(klon,12)) 143 ALLOCATE(flx_co2bb(klon,12)) 140 144 141 145 !$OMP MASTER 142 IF (is_mpi_root) THEN 143 ! ... Open the file 144 CALL nf95_open("sflx_lmdz_co2.nc", nf90_nowrite, ncid_in) 145 146 CALL nf95_inq_varid(ncid_in, "vector", varid) 147 CALL nf95_gw_var(ncid_in, varid, vector) 148 n_glo = size(vector) 149 IF (n_glo.NE.klon_glo) THEN 150 print *,'Le nombre de points n est pas egal a klon_glo' 151 STOP 152 ENDIF 153 154 CALL nf95_inq_varid(ncid_in, "time", varid) 155 CALL nf95_gw_var(ncid_in, varid, time) 156 n_month = size(time) 157 IF (n_month.NE.12) THEN 158 print *,'Le nombre de month n est pas egal a 12' 159 STOP 160 ENDIF 161 162 IF (.NOT.ALLOCATED(flx_co2_glo)) ALLOCATE(flx_co2_glo(n_glo,n_month)) 163 164 !--reading flx_co2 165 CALL nf95_inq_varid(ncid_in, "flx_co2", varid) 166 ncerr = nf90_get_var(ncid_in, varid, flx_co2_glo) 167 168 CALL nf95_close(ncid_in) 169 ENDIF 146 IF (is_mpi_root) THEN 147 148 IF (.NOT.ALLOCATED(flx_co2ff_glo)) ALLOCATE(flx_co2ff_glo(n_glo,n_month)) 149 IF (.NOT.ALLOCATED(flx_co2bb_glo)) ALLOCATE(flx_co2bb_glo(n_glo,n_month)) 150 151 !--reading CO2 fossil fuel emissions 152 IF (readco2ff) THEN 153 154 ! ... Open the COZff file 155 CALL nf95_open("sflx_lmdz_co2_ff.nc", nf90_nowrite, ncid_in) 156 157 CALL nf95_inq_varid(ncid_in, "vector", varid) 158 CALL nf95_gw_var(ncid_in, varid, vector) 159 n_glo = size(vector) 160 IF (n_glo.NE.klon_glo) THEN 161 PRINT *,'sflx_lmdz_co2_ff: le nombre de points n est pas egal a klon_glo' 162 STOP 163 ENDIF 164 165 CALL nf95_inq_varid(ncid_in, "time", varid) 166 CALL nf95_gw_var(ncid_in, varid, time) 167 n_month = size(time) 168 IF (n_month.NE.12) THEN 169 PRINT *,'sflx_lmdz_co2_ff: le nombre de month n est pas egal a 12' 170 STOP 171 ENDIF 172 173 !--reading flx_co2 for fossil fuel 174 CALL nf95_inq_varid(ncid_in, "flx_co2", varid) 175 ncerr = nf90_get_var(ncid_in, varid, flx_co2ff_glo) 176 177 CALL nf95_close(ncid_in) 178 179 ELSE !--co2ff not to be read 180 flx_co2ff_glo(:,:)=0.0 181 ENDIF 182 183 !--reading CO2 biomass burning emissions 184 IF (readco2bb) THEN 185 186 ! ... Open the CO2bb file 187 CALL nf95_open("sflx_lmdz_co2_bb.nc", nf90_nowrite, ncid_in) 188 189 CALL nf95_inq_varid(ncid_in, "vector", varid) 190 CALL nf95_gw_var(ncid_in, varid, vector) 191 n_glo = size(vector) 192 IF (n_glo.NE.klon_glo) THEN 193 PRINT *,'sflx_lmdz_co2_bb: le nombre de points n est pas egal a klon_glo' 194 STOP 195 ENDIF 196 197 CALL nf95_inq_varid(ncid_in, "time", varid) 198 CALL nf95_gw_var(ncid_in, varid, time) 199 n_month = size(time) 200 IF (n_month.NE.12) THEN 201 PRINT *,'sflx_lmdz_co2_bb: le nombre de month n est pas egal a 12' 202 STOP 203 ENDIF 204 205 !--reading flx_co2 for biomass burning 206 CALL nf95_inq_varid(ncid_in, "flx_co2", varid) 207 ncerr = nf90_get_var(ncid_in, varid, flx_co2bb_glo) 208 209 CALL nf95_close(ncid_in) 210 211 ELSE !--co2bb not to be read 212 flx_co2bb_glo(:,:)=0.0 213 ENDIF 214 215 ENDIF 170 216 !$OMP END MASTER 171 217 172 218 !--scatter on all proc 173 CALL scatter(flx_co2_glo,flx_co2) 219 CALL scatter(flx_co2ff_glo,flx_co2ff) 220 CALL scatter(flx_co2bb_glo,flx_co2bb) 174 221 175 222 !$OMP MASTER 176 IF (is_mpi_root) THEN 177 DEALLOCATE(flx_co2_glo) 178 ENDIF 223 IF (is_mpi_root) THEN 224 DEALLOCATE(flx_co2ff_glo) 225 DEALLOCATE(flx_co2bb_glo) 226 ENDIF 179 227 !$OMP END MASTER 180 228 … … 183 231 !---select the correct month 184 232 IF (mth_cur.LT.1.OR.mth_cur.GT.12) THEN 185 print*,'probleme avec le mois dans co2_ini =', mth_cur233 PRINT *,'probleme avec le mois dans co2_ini =', mth_cur 186 234 ENDIF 187 co2ff(:) = flx_co2 (:,mth_cur)188 co2bb(:) = 0.0235 co2ff(:) = flx_co2ff(:,mth_cur) 236 co2bb(:) = flx_co2bb(:,mth_cur) 189 237 190 238 END SUBROUTINE co2_emissions
Note: See TracChangeset
for help on using the changeset viewer.