Skip to content
Snippets Groups Projects
Commit 44ca41c0 authored by a_medvedev's avatar a_medvedev
Browse files

defor convert from global to regional value

parent 8917e209
No related branches found
No related tags found
1 merge request!2defor convert from global to regional value
File added
...@@ -3,7 +3,7 @@ module carbon_model_inmcm_aux ...@@ -3,7 +3,7 @@ module carbon_model_inmcm_aux
! интерфейс ! интерфейс
! ------------------------------------------------------------------------------------------------------------------- ! -------------------------------------------------------------------------------------------------------------------
use const, only : pi, r_earth, yrs use const, only : pi, yrs
use environment_model_inmcm, only : nv2 use environment_model_inmcm, only : nv2
use environment_core, only : Tsoil, Temp, Wsoil, Isoil use environment_core, only : Tsoil, Temp, Wsoil, Isoil
use carbon_model_to_core_arg_kit, only : year_min, year_max, nmonth use carbon_model_to_core_arg_kit, only : year_min, year_max, nmonth
...@@ -62,14 +62,15 @@ module carbon_model_inmcm_aux ...@@ -62,14 +62,15 @@ module carbon_model_inmcm_aux
!real, parameter :: mpe = 0.000001 !< Prevents division by zero errors, [dimensionless] !real, parameter :: mpe = 0.000001 !< Prevents division by zero errors, [dimensionless]
! ---- Landuse ---- ! ---- Landuse ----
real, parameter :: gt2year_to_kg2m2s = 1.e+12 / (4.*pi*r_earth**2 * yrs) real, parameter :: gt2year_to_kg2s = 1.e+12 / yrs
real, parameter :: defor0 = 1. * gt2year_to_kg2m2s real, parameter :: defor0 = 1. * gt2year_to_kg2s
!real, parameter :: defor1861 = 0.54 * gt2year_to_kg2m2s !real, parameter :: defor1861 = 0.54 * gt2year_to_kg2s
real, parameter :: adefr = 0.6 !< deforest/(deforest+soil erosion) real, parameter :: adefr = 0.6 !< deforest/(deforest+soil erosion)
!real, parameter :: defr(nv2) = (/1.,0.2,0.2,0.05,0.05,0.2,0.2,0.2,0.02,0.02,0.2,0.5,0.5/) real, parameter :: defr(nv2) = (/1.,0.2,0.2,0.05,0.05,0.2,0.2,0.2,0.02,0.02,0.2,0.5,0.5/)
real, parameter :: soer(nv2) = (/1.,0.2,0.2,0.05,0.05,0.2,0.2,0.2,0.02,0.02,0.2,0.5,0.5/) real, parameter :: soer(nv2) = (/1.,0.2,0.2,0.05,0.05,0.2,0.2,0.2,0.02,0.02,0.2,0.5,0.5/)
real :: landuseTot, landuseDfrA, landuseDfrB, landuseErs !< замена переменных для defor real :: landuseTot, landuseDfrA, landuseDfrB, landuseErs !< замена переменных для defor
real, allocatable, target :: dfr_weight(:,:,:), ers_weight(:,:,:) !< пространственные веса real, allocatable, target :: dfr_weight(:,:,:), ers_weight(:,:,:) !< пространственные веса
real :: conversion_defor_global_to_regional
! ---- Динамические переменные (from inmcm) ---- ! ---- Динамические переменные (from inmcm) ----
real, target :: rsw(nv2), btran(nv2) real, target :: rsw(nv2), btran(nv2)
...@@ -91,16 +92,20 @@ contains ...@@ -91,16 +92,20 @@ contains
subroutine carbon_model_init() subroutine carbon_model_init()
! ---- Part of INMCM carbon_model_init() ---- ! ---- Part of INMCM carbon_model_init() ----
use grid, only : i0, i1, j0, j1, mask, area, date_c use grid, only : i0, i1, j0, j1, mask, area, date_c, dlon, dlat, nlon, nlat, ich
!use environment_model_inmcm, only : vegg_nv2 !use environment_model_inmcm, only : vegg_nv2
!use netcdf use netcdf
!use netcdf_kit, only : nc_errhand use netcdf_kit, only : nc_errhand
!use paths, only : path_inmcm_data use paths, only : path_inmcm_data
integer :: i, j, n, na !< count integer :: i, j, n, na !< count
!integer :: ncid, varid integer :: ncid, varid
!real :: fill_v !real :: fill_v
real, allocatable, dimension(:,:,:) :: cveg_global, csoil_global
real :: sc6_global, sc6_regional
real :: sc8_global, sc8_regional
!allocate(dfr_weight(i0:i1,j0:j1,nv2)) !allocate(dfr_weight(i0:i1,j0:j1,nv2))
allocate(ers_weight(i0:i1,j0:j1,nv2)) allocate(ers_weight(i0:i1,j0:j1,nv2))
...@@ -132,11 +137,63 @@ contains ...@@ -132,11 +137,63 @@ contains
! ---- Part of inmcm carbon_model_init() ---- ! ---- Part of inmcm carbon_model_init() ----
! ---- Variables from INMCM ---- ! ---- Variables from INMCM ----
!landuseTot = landuseDfrA + landuseDfrB + landuseErs:
!landuseTot = defor0 if (dlon == 0.5 .and. dlat == 0.5) then
!landuseDfrA = adefr * min(defor0,defor1861)
!landuseDfrB = adefr * (defor0 - min(defor0,defor1861)) allocate(cveg_global(nlon,nlat,nv2))
landuseErs = (1. - adefr) * defor0 allocate(csoil_global(nlon,nlat,nv2))
call nc_errhand( nf90_open(path_inmcm_data//'control_point_for_carbon_pools.nc', nf90_nowrite, ncid) )
call nc_errhand( nf90_inq_varid(ncid, 'cveg', varid) )
call nc_errhand( nf90_get_var(ncid, varid, cveg_global(:,:,:), (/1,1,1/), (/nlon,nlat,nv2/)) )
call nc_errhand( nf90_inq_varid(ncid, 'csoil', varid) )
call nc_errhand( nf90_get_var(ncid, varid, csoil_global(:,:,:), (/1,1,1/), (/nlon,nlat,nv2/)) )
call nc_errhand( nf90_close(ncid) )
sc6_global = 0.
sc8_global = 0.
do j = 1, nlat ! sum for the whole globe
do i = 1, nlon
if (ich(i,j) /= 0) then
do n = 1, nv2
sc6_global = sc6_global + cveg_global(i,j,n)*defr(n)*area(i,j)
sc8_global = sc8_global + csoil_global(i,j,n)*soer(n)*area(i,j)
enddo
endif
enddo
enddo
if (sc6_global > 0. .and. sc8_global > 0.) then
sc6_regional = 0.
sc8_regional = 0.
do j = j0, j1 ! sum for the regional simulation domain
do i = i0, i1
if (ich(i,j) /= 0) then
do n = 1, nv2
sc6_regional = sc6_regional + cveg_global(i,j,n)*defr(n)*area(i,j)
sc8_regional = sc8_regional + csoil_global(i,j,n)*soer(n)*area(i,j)
enddo
endif
enddo
enddo
conversion_defor_global_to_regional = adefr * sc6_regional/sc6_global + &
& (1.-adefr) * sc8_regional/sc8_global
else
conversion_defor_global_to_regional = 1.
endif
deallocate(cveg_global)
deallocate(csoil_global)
else
conversion_defor_global_to_regional = 1.
endif
!!landuseTot = landuseDfrA + landuseDfrB + landuseErs:
!landuseTot = defor0 * conversion_defor_global_to_regional
!landuseDfrA = adefr * min(defor0,defor1861) * conversion_defor_global_to_regional
!landuseDfrB = adefr * (defor0 - min(defor0,defor1861)) * conversion_defor_global_to_regional
landuseErs = (1. - adefr) * defor0 * conversion_defor_global_to_regional
!allocate(admAreaFrac(720,360,nadm)) !allocate(admAreaFrac(720,360,nadm))
!call nc_errhand( nf90_open(path_inmcm_data//'admAreaFrac_NED_grid05x05.nc', nf90_nowrite, ncid) ) !call nc_errhand( nf90_open(path_inmcm_data//'admAreaFrac_NED_grid05x05.nc', nf90_nowrite, ncid) )
...@@ -195,18 +252,41 @@ contains ...@@ -195,18 +252,41 @@ contains
use grid, only : i0, i1, j0, j1, area use grid, only : i0, i1, j0, j1, area
integer :: ii, jj, n integer :: ii, jj, n
!real :: sc6
real :: sc8
!sc6 = 0.
sc8 = 0.
do ii = i0, i1 do ii = i0, i1
do jj = j0, j1 do jj = j0, j1
do n = 1, nv2 do n = 1, nv2
!dfr_weight(ii,jj,n) = Cveg(ii,jj,n) * defr(n) * area(ii,jj) !sc6 = sc6 + Cveg(ii,jj,n) * defr(n) * area(ii,jj)
ers_weight(ii,jj,n) = Csoil(ii,jj,n) * soer(n) * area(ii,jj) sc8 = sc8 + Csoil(ii,jj,n) * soer(n) * area(ii,jj)
end do end do
end do end do
end do end do
!if (sum(dfr_weight) /= 0.) dfr_weight(:,:,:) = dfr_weight(:,:,:) / sum(dfr_weight) ! dfr_weight(:,:,:) = 0.
if (sum(ers_weight) /= 0.) ers_weight(:,:,:) = ers_weight(:,:,:) / sum(ers_weight) ! if (sc6 > 0) then
! do ii = i0, i1
! do jj = j0, j1
! do n = 1, nv2
! dfr_weight(ii,jj,n) = Cveg(ii,jj,n) * defr(n) / sc6
! end do
! end do
! end do
! end if
ers_weight(:,:,:) = 0.
if (sc8 > 0) then
do ii = i0, i1
do jj = j0, j1
do n = 1, nv2
ers_weight(ii,jj,n) = Csoil(ii,jj,n) * soer(n) / sc8
end do
end do
end do
end if
end subroutine end subroutine
......
...@@ -321,19 +321,19 @@ contains ...@@ -321,19 +321,19 @@ contains
j1 = j1_nc j1 = j1_nc
end select end select
allocate(lon(i0:i1)) allocate(lon(nlon))
do i = i0, i1 do i = 1, nlon
lon(i) = lon_ref + (i-1)*dlon lon(i) = lon_ref + (i-1)*dlon
enddo enddo
allocate(lat(j0:j1)) allocate(lat(nlat))
do j = j0, j1 do j = 1, nlat
lat(j) = lat_ref + (j-1)*dlat lat(j) = lat_ref + (j-1)*dlat
enddo enddo
allocate(area(i0:i1,j0:j1)) allocate(area(nlon,nlat))
do j = j0, j1 do j = 1, nlat
do i = i0, i1 do i = 1, nlon
area(i,j) = r_earth*abs(dlat)*deg2rad * r_earth*cos(lat(j)*deg2rad)*abs(dlon)*deg2rad area(i,j) = r_earth*abs(dlat)*deg2rad * r_earth*cos(lat(j)*deg2rad)*abs(dlon)*deg2rad
enddo enddo
enddo enddo
......
...@@ -63,7 +63,9 @@ ...@@ -63,7 +63,9 @@
! 'ich' - ячейка по индексу OLIM ! 'ich' - ячейка по индексу OLIM
ich = 46967 ! Федоровское, 05x05 ich = 46967 ! Федоровское, 05x05
! 'point' - ячейка по координатам [lon, lat] ! 'point' - ячейка по координатам [lon, lat]
point(:) = 32.75, 56.25 ! Федоровское ! point(:) = 32.75, 56.25 ! Федоровское
point(:) = 39.888735, 47.364103 ! ФАНЦ (Ростов)
! point(:) = 37.535197, 55.942416 ! ДАОС (Долгопрудный)
! 'polygon' - область по координатам [lon_west, lon_east, lat_south, lat_north] ! 'polygon' - область по координатам [lon_west, lon_east, lat_south, lat_north]
polygon(:) = 26.25, 69.75, 50.75, 69.75 ! лесная зона ЕТР polygon(:) = 26.25, 69.75, 50.75, 69.75 ! лесная зона ЕТР
! (для lsm_offline) 'all' - вся область nectdf-файла ! (для lsm_offline) 'all' - вся область nectdf-файла
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment