00001
00002
00003 subroutine respfactor_control( sib, time, rank )
00004
00005
00006
00007
00008
00009
00010 use kinds
00011 use timetype
00012 use sib_const_module
00013 use sib_io_module
00014 use sibtype
00015
00016 implicit none
00017
00018
00019 type(sib_t), dimension(subcount), intent(inout) :: sib
00020 type(time_struct), intent(in) :: time
00021 integer(kind=int_kind), intent(in) :: rank
00022
00023
00024 integer(kind=int_kind) :: i, s, m
00025 real(kind=dbl_kind) test
00026
00027
00028 do i = 1, subcount
00029 sib(i)%param%tot_an(time%month) = sib(i)%param%tot_an(time%month) + &
00030 sib(i)%diag%assimn(6) * time%dtsib
00031 sib(i)%param%tot_gpp(time%month) = sib(i)%param%tot_gpp(time%month) + &
00032 sib(i)%diag%assim(6) * time%dtsib
00033 sib(i)%param%tot_rc(time%month) = sib(i)%param%tot_rc(time%month) + &
00034 sib(i)%diag%resp_can(6) * time%dtsib
00035 sib(i)%param%tot_fpar(time%month) = sib(i)%param%tot_fpar(time%month) + &
00036 sib(i)%param%aparc * time%dtsib
00037 sib(i)%param%tot_nee(time%month) = sib(i)%param%tot_nee(time%month) + &
00038 (sib(i)%diag%resp_tot-sib(i)%diag%assim(6))* time%dtsib
00039 sib(i)%param%tot_het(time%month) = sib(i)%param%tot_het(time%month) + &
00040 sib(i)%diag%resp_het * time%dtsib
00041 sib(i)%param%tot_auto(time%month) = sib(i)%param%tot_auto(time%month) + &
00042 sib(i)%diag%resp_auto * time%dtsib
00043
00044
00045 sib(i)%param%tot_d13c(time%month) = sib(i)%param%tot_d13c(time%month) + &
00046 sib(i)%diag%assimn(6) * time%dtsib * sib(i)%diag%d13cassimn(6)
00047
00048
00049 Do s = 1, nsoil
00050 sib(i)%param%tot_ss(time%month,s) = &
00051 sib(i)%param%tot_ss(time%month,s) + &
00052 sib(i)%diag%soilscale(s) * time%dtsib
00053 enddo
00054 enddo
00055
00056
00057 if ( time%calc_respf ) then
00058
00059
00060 do i = 1, subcount
00061
00062
00063 sib(i)%param%tot_an(13) = 0.0_dbl_kind
00064 sib(i)%param%tot_gpp(13) = 0.0_dbl_kind
00065 sib(i)%param%tot_rc(13) = 0.0_dbl_kind
00066 sib(i)%param%tot_fpar(13) = 0.0_dbl_kind
00067 sib(i)%param%tot_ss(13,:) = 0.0_dbl_kind
00068 sib(i)%param%tot_nee(13) = 0.0_dbl_kind
00069 sib(i)%param%tot_het(13) = 0.0_dbl_kind
00070 sib(i)%param%tot_auto(13) = 0.0_dbl_kind
00071
00072
00073 sib(i)%param%tot_d13c(13) = 0.0_dbl_kind
00074
00075
00076
00077 do m = 1, 12
00078 sib(i)%param%tot_an(13) = sib(i)%param%tot_an(13) + &
00079 sib(i)%param%tot_an(m)
00080 sib(i)%param%tot_gpp(13) = sib(i)%param%tot_gpp(13) + &
00081 sib(i)%param%tot_gpp(m)
00082 sib(i)%param%tot_rc(13) = sib(i)%param%tot_rc(13) + &
00083 sib(i)%param%tot_rc(m)
00084 sib(i)%param%tot_fpar(13) = sib(i)%param%tot_fpar(13) + &
00085 sib(i)%param%tot_fpar(m)
00086 sib(i)%param%tot_nee(13) = sib(i)%param%tot_nee(13) + &
00087 sib(i)%param%tot_nee(m)
00088 sib(i)%param%tot_het(13) = sib(i)%param%tot_het(13) + &
00089 sib(i)%param%tot_het(m)
00090 sib(i)%param%tot_auto(13) = sib(i)%param%tot_auto(13) + &
00091 sib(i)%param%tot_auto(m)
00092
00093
00094 sib(i)%param%tot_d13c(13) = sib(i)%param%tot_d13c(13) + &
00095 sib(i)%param%tot_d13c(m)
00096
00097
00098
00099 do s = 1, nsoil
00100 sib(i)%param%tot_ss(13,s) = sib(i)%param%tot_ss(13,s) + &
00101 sib(i)%param%tot_ss(m,s)
00102 enddo
00103 enddo
00104
00105 enddo
00106
00107
00108 i=1
00109 do m = 1, 12
00110 print*, m, sib(i)%param%tot_rc(m),sib(i)%param%tot_gpp(m)
00111 enddo
00112 do m = 1, 12
00113 print*, m, sib(i)%param%tot_gpp(m)-sib(i)%param%tot_rc(m)-sib(i)%param%tot_an(m)
00114 enddo
00115 print*, 'ann nee=',sib(i)%param%tot_nee(13)
00116 print*, 'test nee=',sib(i)%param%tot_het(13) + sib(i)%param%tot_auto(13) + sib(i)%param%tot_rc(13)- sib(i)%param%tot_gpp(13)
00117 print*, 'ann an=',sib(i)%param%tot_an(13)
00118 print*, 'ann gpp=',sib(i)%param%tot_gpp(13)
00119 print*, 'ann het=',sib(i)%param%tot_het(13)
00120 print*, 'ann aut=',sib(i)%param%tot_auto(13)
00121 print*, 'ann can=',sib(i)%param%tot_rc(13),sib(i)%param%tot_gpp(13)-sib(i)%param%tot_an(13)
00122 print*, 'ann fpar=',sib(i)%param%tot_fpar(13)
00123 print*, 'het ratio=',sib(i)%param%tot_het(13)/sib(i)%param%tot_gpp(13)
00124 print*, 'aut ratio=',(sib(i)%param%tot_auto(13) + sib(i)%param%tot_rc(13))/sib(i)%param%tot_gpp(13)
00125
00126
00127 call calc_respfactor( sib )
00128
00129
00130 if ( time%write_respf ) then
00131 if(drvr_type=='single' .OR. drvr_type == 'ncp_sngl') then
00132 call write_single_respfactor(sib,time)
00133 else
00134 call write_global_respfactor ( sib, time, rank )
00135 endif
00136 endif
00137
00138
00139 if(roll_respf) then
00140 m = mod( time%month, 12 ) + 1
00141 do i = 1, subcount
00142 sib(i)%param%tot_an(m) = 0.0_dbl_kind
00143 sib(i)%param%tot_gpp(m) = 0.0_dbl_kind
00144 sib(i)%param%tot_rc(m) = 0.0_dbl_kind
00145 sib(i)%param%tot_fpar(m) = 0.0_dbl_kind
00146 sib(i)%param%tot_nee(m) = 0.0_dbl_kind
00147 sib(i)%param%tot_het(m) = 0.0_dbl_kind
00148 sib(i)%param%tot_auto(m) = 0.0_dbl_kind
00149 sib(i)%param%tot_ss(m,:) = 0.0_dbl_kind
00150
00151 sib(i)%param%tot_d13c(m) = 0.0_dbl_kind
00152
00153 enddo
00154 else
00155 do i = 1, subcount
00156 sib(i)%param%tot_an(:) = 0.0_dbl_kind
00157 sib(i)%param%tot_gpp(:) = 0.0_dbl_kind
00158 sib(i)%param%tot_rc(:) = 0.0_dbl_kind
00159 sib(i)%param%tot_fpar(:) = 0.0_dbl_kind
00160 sib(i)%param%tot_nee(:) = 0.0_dbl_kind
00161 sib(i)%param%tot_het(:) = 0.0_dbl_kind
00162 sib(i)%param%tot_auto(:) = 0.0_dbl_kind
00163 sib(i)%param%tot_ss(:,:) = 0.0_dbl_kind
00164
00165 sib(i)%param%tot_d13c(:) = 0.0_dbl_kind
00166
00167 enddo
00168 endif
00169 endif
00170
00171 end subroutine respfactor_control
00172
00173
00174 subroutine calc_respfactor( sib )
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 use kinds
00198 use sibtype
00199 use sib_const_module
00200
00201 implicit none
00202
00203
00204 type(sib_t), dimension(subcount), intent(inout) :: sib
00205
00206
00207 integer :: n,l
00208 real(kind=dbl_kind) xag
00209 real(kind=dbl_kind) xbg
00210 real(kind=dbl_kind) xagmin
00211 real(kind=dbl_kind) xagmax
00212 real(kind=dbl_kind) anainflec
00213 real(kind=dbl_kind) kxag
00214 real(kind=dbl_kind) tot_het
00215 real(kind=dbl_kind) tot_auto
00216 real(kind=dbl_kind) rcfrac
00217
00218 parameter(xagmin = 0.10, xagmax = 0.75, anainflec = 1000., &
00219 kxag=5.e-3)
00220
00221
00222 do n = 1, subcount
00223
00224
00225 rcfrac=sib(n)%param%tot_rc(13)/sib(n)%param%tot_gpp(13)
00226 if(rcfrac<=autofrac) then
00227 tot_het=(1.-autofrac)*sib(n)%param%tot_gpp(13)
00228 tot_auto=autofrac*sib(n)%param%tot_gpp(13)-sib(n)%param%tot_rc(13)
00229 else
00230 tot_het=sib(n)%param%tot_gpp(13)-sib(n)%param%tot_rc(13)
00231 if(tot_het<0.) print*, n, sib(n)%param%tot_gpp(13)-sib(n)%param%tot_rc(13), sib(n)%param%tot_an(13)
00232 tot_auto=0.
00233 endif
00234
00235
00236
00237 xag = xagmin + (xagmax - xagmin) / &
00238 ( 1.0 + exp( -kxag * ( tot_het * 12. - anainflec ) ) )
00239
00240
00241 xbg = 1.0 - xag
00242
00243
00244
00245 sib(n)%param%het_respfac(1) = tot_het * ( 0.5 * xag + &
00246 xbg * sib(n)%param%rootf(1))
00247
00248 sib(n)%param%het_respfac(2) = tot_het * ( 0.5 * xag + &
00249 xbg * sib(n)%param%rootf(2))
00250
00251
00252 do l = 3, nsoil
00253 sib(n)%param%het_respfac(l) = tot_het * xbg &
00254 * sib(n)%param%rootf(l)
00255 end do
00256
00257
00258 do l = 1, nsoil
00259 sib(n)%param%het_respfac(l) = sib(n)%param%het_respfac(l) / &
00260 sib(n)%param%tot_ss(13,l)
00261 end do
00262
00263
00264 sib(n)%param%auto_respfac=tot_auto/sib(n)%param%tot_fpar(13)
00265
00266
00267
00268
00269 sib(n)%param%d13c_het = sib(n)%param%tot_d13c(13) / &
00270 sib(n)%param%tot_an(13)
00271
00272
00273 End do
00274
00275 end subroutine calc_respfactor
00276
00277
00278 subroutine write_global_respfactor ( sib, time, rank )
00279
00280
00281
00282
00283
00284
00285
00286 use kinds
00287 #ifdef PGF
00288 use netcdf
00289 use typeSizes
00290 #endif
00291 use sibtype
00292 use timetype
00293 use sib_io_module
00294 use sib_const_module
00295
00296 Implicit none
00297
00298
00299 type(sib_t), dimension(subcount), intent(in) :: sib
00300 type(time_struct), intent(in) :: time
00301 integer(kind=int_kind), intent(in) :: rank
00302
00303
00304 integer(kind=int_kind) :: status
00305 integer(kind=int_kind) :: ncid
00306 integer(kind=int_kind) :: did_time
00307 integer(kind=int_kind) :: did_nsib
00308 integer(kind=int_kind) :: did_nsoil
00309 integer(kind=int_kind) :: did_lat
00310 integer(kind=int_kind) :: did_lon
00311 integer(kind=int_kind) :: did_subcount
00312 integer(kind=int_kind) :: did_char
00313 integer(kind=int_kind) :: vid_time
00314 integer(kind=int_kind) :: vid_start
00315 integer(kind=int_kind) :: vid_end
00316 integer(kind=int_kind) :: vid_period
00317 integer(kind=int_kind) :: vid_lon
00318 integer(kind=int_kind) :: vid_lat
00319 integer(kind=int_kind) :: vid_lonindx
00320 integer(kind=int_kind) :: vid_latindx
00321 integer(kind=int_kind) :: vid_sibindx
00322 integer(kind=int_kind) :: vid_subc
00323 integer(kind=int_kind) :: vid_het
00324 integer(kind=int_kind) :: vid_auto
00325 integer(kind=int_kind) :: vid_nsec
00326
00327 integer(kind=int_kind) :: vid_d13cr
00328
00329
00330
00331
00332 integer(kind=int_kind) :: i,j,k,l,m,n
00333 character*8 txt
00334 character*256 filename
00335 integer(kind=int_kind) :: nsectemp
00336 real(kind=dbl_kind) het_respfac(subcount,nsoil)
00337 real(kind=dbl_kind) auto_respfac(subcount)
00338
00339
00340
00341 real(kind=dbl_kind) d13c_het_resp(subcount)
00342
00343
00344
00345
00346
00347 do i = 1, subcount
00348 auto_respfac(i) = sib(i)%param%auto_respfac
00349
00350
00351 d13c_het_resp(i) = sib(i)%param%d13c_het
00352
00353
00354 do j = 1, nsoil
00355 het_respfac(i,j) = sib(i)%param%het_respfac(j)
00356 enddo
00357 enddo
00358
00359
00360 nsectemp = time%year
00361
00362
00363 write(txt, '(i4.4,a,i3.3)') time%year, 'p', rank
00364 filename = trim(out_path)//"CO2_respf_"//trim(txt)//".nc"
00365 print*, 'write global respfactor ', trim(filename)
00366 status = nf90_create( filename, nf90_clobber, ncid )
00367
00368
00369 call global_atts( ncid, 'sib3', 'lat/lon', '1.0', drvr_type, &
00370 biome_source, soil_source, soref_source, ndvi_source, c4_source, &
00371 d13cresp_source, rank )
00372
00373
00374 status = nf90_def_dim( ncid, 'time', nf90_unlimited, did_time )
00375 if(status/=nf90_noerr) call handle_err(status,'rf_write',1)
00376 status = nf90_def_dim( ncid, 'nsib', nsib, did_nsib )
00377 if(status/=nf90_noerr) call handle_err(status,'rf_write',2)
00378 status = nf90_def_dim( ncid, 'level', nsoil, did_nsoil )
00379 if(status/=nf90_noerr) call handle_err(status,'rf_write',3)
00380 status = nf90_def_dim( ncid, 'char_len', 10, did_char )
00381 if(status/=nf90_noerr) call handle_err(status,'rf_write',4)
00382 status = nf90_def_dim( ncid, 'latitude', jhr, did_lat )
00383 if(status/=nf90_noerr) call handle_err(status,'rf_write',5)
00384 status = nf90_def_dim( ncid, 'longitude', ihr, did_lon )
00385 if(status/=nf90_noerr) call handle_err(status,'rf_write',6)
00386 status = nf90_def_dim( ncid, 'landpoints', subcount, did_subcount )
00387 if(status/=nf90_noerr) call handle_err(status,'rf_write',7)
00388
00389
00390 status = nf90_def_var( ncid, 'time', nf90_double, (/did_time/), vid_time )
00391 if(status/=nf90_noerr) call handle_err(status,'rf_write',8)
00392 status = nf90_put_att( ncid, vid_time, 'quantity', 'time' )
00393 if(status/=nf90_noerr) call handle_err(status,'rf_write',9)
00394 status = nf90_put_att( ncid, vid_time, 'units', 'year' )
00395 if(status/=nf90_noerr) call handle_err(status,'rf_write',10)
00396 status = nf90_put_att( ncid, vid_time, 'calender', 'noleap' )
00397 if(status/=nf90_noerr) call handle_err(status,'rf_write',11)
00398
00399 status = nf90_def_var( ncid, 'start_period', nf90_int, (/did_time/), vid_start )
00400 if(status/=nf90_noerr) call handle_err(status,'rf_write',12)
00401 status = nf90_put_att( ncid, vid_start, 'long_name', 'start of respfactor period' )
00402 if(status/=nf90_noerr) call handle_err(status,'rf_write',13)
00403 status = nf90_put_att( ncid, vid_start, 'units', 'day of year' )
00404 if(status/=nf90_noerr) call handle_err(status,'rf_write',14)
00405
00406 status = nf90_def_var( ncid, 'end_period', nf90_int, (/did_time/), vid_end )
00407 if(status/=nf90_noerr) call handle_err(status,'rf_write',15)
00408 status = nf90_put_att( ncid, vid_end, 'long_name', 'end of respfactor period' )
00409 if(status/=nf90_noerr) call handle_err(status,'rf_write',16)
00410 status = nf90_put_att( ncid, vid_end, 'units', 'day of year' )
00411 if(status/=nf90_noerr) call handle_err(status,'rf_write',17)
00412
00413 status = nf90_def_var( ncid, 'period_length', nf90_double, (/did_time/), vid_period )
00414 if(status/=nf90_noerr) call handle_err(status,'rf_write',18)
00415 status = nf90_put_att( ncid, vid_period, 'long_name', 'length of respfactor period' )
00416 if(status/=nf90_noerr) call handle_err(status,'rf_write',19)
00417 status = nf90_put_att( ncid, vid_period, 'units', 'days' )
00418 if(status/=nf90_noerr) call handle_err(status,'rf_write',20)
00419
00420 status = nf90_def_var( ncid, 'latitude', nf90_float, (/did_lat/), vid_lat )
00421 if(status/=nf90_noerr) call handle_err(status,'rf_write',21)
00422 status = nf90_put_att( ncid, vid_lat, 'units', 'degrees_north' )
00423 if(status/=nf90_noerr) call handle_err(status,'rf_write',22)
00424 status = nf90_put_att( ncid, vid_lat, 'quantity', 'latitude' )
00425 if(status/=nf90_noerr) call handle_err(status,'rf_write',23)
00426
00427 status = nf90_def_var( ncid, 'longitude', nf90_float, (/did_lon/), vid_lon )
00428 if(status/=nf90_noerr) call handle_err(status,'rf_write',24)
00429 status = nf90_put_att( ncid, vid_lon, 'units', 'degrees_east' )
00430 if(status/=nf90_noerr) call handle_err(status,'rf_write',25)
00431 status = nf90_put_att( ncid, vid_lon, 'quantity', 'longitude' )
00432 if(status/=nf90_noerr) call handle_err(status,'rf_write',26)
00433
00434 status = nf90_def_var( ncid, 'lonindex', nf90_int, (/did_subcount/), vid_lonindx )
00435 if(status/=nf90_noerr) call handle_err(status,'rf_write',27)
00436 status = nf90_put_att( ncid, vid_lonindx, 'long_name', 'Longitude array index' )
00437 if(status/=nf90_noerr) call handle_err(status,'rf_write',28)
00438 status = nf90_put_att( ncid, vid_lonindx, 'units', 'index-integer' )
00439 if(status/=nf90_noerr) call handle_err(status,'rf_write',29)
00440
00441 status = nf90_def_var( ncid, 'latindex', nf90_int, (/did_subcount/), vid_latindx )
00442 if(status/=nf90_noerr) call handle_err(status,'rf_write',30)
00443 status = nf90_put_att( ncid, vid_latindx, 'long_name', 'Latitude array index' )
00444 if(status/=nf90_noerr) call handle_err(status,'rf_write',31)
00445 status = nf90_put_att( ncid, vid_latindx, 'units', 'index-integer' )
00446 if(status/=nf90_noerr) call handle_err(status,'rf_write',32)
00447
00448 status = nf90_def_var( ncid, 'sibindex', nf90_int, (/did_subcount/), vid_sibindx )
00449 if(status/=nf90_noerr) call handle_err(status,'rf_write',30)
00450 status = nf90_put_att( ncid, vid_sibindx, 'long_name', 'subset to nsib array index' )
00451 if(status/=nf90_noerr) call handle_err(status,'rf_write',31)
00452 status = nf90_put_att( ncid, vid_sibindx, 'units', 'index-integer' )
00453 if(status/=nf90_noerr) call handle_err(status,'rf_write',32)
00454
00455
00456 status = nf90_def_var( ncid, 'het_respfac', nf90_double, (/did_subcount,did_nsoil/), vid_het)
00457 if(status/=nf90_noerr) call handle_err(status,'rf_write',33)
00458 status = nf90_put_att( ncid, vid_het, 'long_name', 'Heterotrophic Respiration Factor' )
00459 if(status/=nf90_noerr) call handle_err(status,'rf_write',34)
00460 status = nf90_put_att( ncid, vid_het, 'title', 'Heterotrophic Respiration Factor' )
00461 if(status/=nf90_noerr) call handle_err(status,'rf_write',35)
00462 status = nf90_put_att( ncid, vid_het, 'units', 'moles/m2/s' )
00463 if(status/=nf90_noerr) call handle_err(status,'rf_write',36)
00464 status = nf90_put_att( ncid, vid_het, 'missing_value', 1.e36 )
00465 if(status/=nf90_noerr) call handle_err(status,'rf_write',37)
00466
00467
00468 status = nf90_def_var( ncid, 'auto_respfac', nf90_double, (/did_subcount/), vid_auto)
00469 if(status/=nf90_noerr) call handle_err(status,'rf_write',38)
00470 status = nf90_put_att( ncid, vid_auto, 'long_name', 'Autotrophic Respiration Factor' )
00471 if(status/=nf90_noerr) call handle_err(status,'rf_write',39)
00472 status = nf90_put_att( ncid, vid_auto, 'title', 'Autotrophic Respiration Factor' )
00473 if(status/=nf90_noerr) call handle_err(status,'rf_write',40)
00474 status = nf90_put_att( ncid, vid_auto, 'units', 'moles/m2/s' )
00475 if(status/=nf90_noerr) call handle_err(status,'rf_write',41)
00476 status = nf90_put_att( ncid, vid_auto, 'missing_value', 1.e36 )
00477 if(status/=nf90_noerr) call handle_err(status,'rf_write',42)
00478
00479
00480
00481
00482 status = nf90_def_var( ncid, 'del13c_resp_het', nf90_double, &
00483 (/did_subcount/), vid_d13cr)
00484 if(status/=nf90_noerr) call handle_err(status,'rf_write',421)
00485 status = nf90_put_att( ncid, vid_d13cr, 'long_name', &
00486 'del13C of Heterotrophic Respiration' )
00487 if(status/=nf90_noerr) call handle_err(status,'rf_write',422)
00488 status = nf90_put_att( ncid, vid_d13cr, 'title', &
00489 'del13C of Heterotrophic Respiration' )
00490 if(status/=nf90_noerr) call handle_err(status,'rf_write',423)
00491 status = nf90_put_att( ncid, vid_d13cr, 'units', 'none' )
00492 if(status/=nf90_noerr) call handle_err(status,'rf_write',424)
00493 status = nf90_put_att( ncid, vid_d13cr, 'missing_value', 1.e36 )
00494 if(status/=nf90_noerr) call handle_err(status,'rf_write',425)
00495
00496
00497
00498
00499 status = nf90_enddef( ncid )
00500 if(status/=nf90_noerr) call handle_err(status,'rf_write',43)
00501
00502
00503 status = nf90_put_var( ncid, vid_time, nsectemp )
00504 if(status/=nf90_noerr) call handle_err(status,'rf_write',44)
00505 status = nf90_put_var( ncid, vid_start, 1 )
00506 if(status/=nf90_noerr) call handle_err(status,'rf_write',45)
00507 status = nf90_put_var( ncid, vid_end, 365 )
00508 if(status/=nf90_noerr) call handle_err(status,'rf_write',46)
00509 status = nf90_put_var( ncid, vid_period, 365 )
00510 if(status/=nf90_noerr) call handle_err(status,'rf_write',47)
00511 status = nf90_put_var( ncid, vid_lat, latitude )
00512 if(status/=nf90_noerr) call handle_err(status,'rf_write',48)
00513 status = nf90_put_var( ncid, vid_lon, longitude )
00514 if(status/=nf90_noerr) call handle_err(status,'rf_write',49)
00515 status = nf90_put_var( ncid, vid_lonindx, sublon )
00516 if(status/=nf90_noerr) call handle_err(status,'rf_write',50)
00517 status = nf90_put_var( ncid, vid_latindx, sublat )
00518 if(status/=nf90_noerr) call handle_err(status,'rf_write',51)
00519 status = nf90_put_var( ncid, vid_sibindx, subset )
00520 if(status/=nf90_noerr) call handle_err(status,'rf_write',51)
00521
00522
00523 status = nf90_put_var( ncid, vid_het, het_respfac )
00524 if(status/=nf90_noerr) call handle_err(status,'rf_write',52)
00525 status = nf90_put_var( ncid, vid_auto, auto_respfac )
00526 if(status/=nf90_noerr) call handle_err(status,'rf_write',53)
00527
00528
00529 status = nf90_put_var( ncid, vid_d13cr, d13c_het_resp )
00530 if(status/=nf90_noerr) call handle_err(status,'rf_write',531)
00531
00532
00533
00534 status = nf90_close( ncid )
00535 if(status/=nf90_noerr) call handle_err(status,'rf_write',54)
00536
00537 end subroutine write_global_respfactor
00538
00539
00540 subroutine write_single_respfactor(sib,time)
00541
00542
00543
00544
00545
00546
00547
00548 use kinds
00549 use sibtype
00550 use timetype
00551 use sib_const_module
00552 use sib_io_module
00553
00554 implicit none
00555
00556
00557 type(sib_t), dimension(subcount), intent(inout) :: sib
00558 type(time_struct), intent(in) :: time
00559
00560
00561 integer(kind=int_kind) :: i,j, k, l,n,m
00562 character*8 txt
00563 character*256 filename
00564
00565 logical good
00566 real(kind=dbl_kind), allocatable :: loc_data(:,:)
00567
00568
00569 write(txt, '(i4.4)') time%year
00570 filename = trim(out_path)//'CO2_respf_'//trim(txt)
00571 open( unit=3, file=trim(filename), form='formatted')
00572
00573
00574 print*, '\t write single respfactor ', trim(filename)
00575
00576
00577 do i = 1,nsoil
00578 write(3,*) sib(1)%param%het_respfac(i),' het_respfac lev',i
00579 enddo
00580
00581
00582 write(3,*) sib(1)%param%auto_respfac,' auto_respfac'
00583
00584
00585
00586
00587 write(3,*) sib(1)%param%d13c_het,' d13C_het_resp'
00588
00589
00590
00591
00592 close (3)
00593
00594 end subroutine write_single_respfactor