Skip to content
Snippets Groups Projects
Commit a70c1372 authored by Victor Stepanenko's avatar Victor Stepanenko
Browse files

Column-wise values of methane production constant implemented

parent a989ce93
No related branches found
No related tags found
No related merge requests found
......@@ -767,50 +767,50 @@
enddo iycyc
if (nstep==nstep_final .and. output_laststep) then
calibrif : if (calibrate_parameter) then
!if (nstep==nstep_final .and. output_laststep) then
! calibrif : if (calibrate_parameter) then
#ifdef mpi
if (.not. associated(calibr_par1)) &
& write(*,*) 'calibr_par1 not associated', ix, nstep, rank_mpi
! if (.not. associated(calibr_par1)) &
! & write(*,*) 'calibr_par1 not associated', ix, nstep, rank_mpi
#endif
i = ubound(cost_function, dim = 1) - &
& lbound(cost_function, dim = 1) + 1
if (.not.allocated(calibrdata)) then
allocate(calibrdata(1:npoints,1:i+2))
calibrdata = 0
endif
calibrdata(ix,1) = calibr_par1
calibrdata(ix,2) = calibr_par2
calibrdata(ix,3:i+2) = cost_function(:)
! i = ubound(cost_function, dim = 1) - &
! & lbound(cost_function, dim = 1) + 1
!
! if (.not.allocated(calibrdata)) then
! allocate(calibrdata(1:npoints,1:i+2))
! calibrdata = 0
! endif
!
! calibrdata(ix,1) = calibr_par1
! calibrdata(ix,2) = calibr_par2
! calibrdata(ix,3:i+2) = cost_function(:)
#ifdef mpi
if (ix == ixproc_max) then
write(*,*) 'Process rank ', rank_mpi, &
& ' entered calibrdata output'
allocate (workcalibr(1:npoints,1:i+2))
call MPI_REDUCE (calibrdata, workcalibr, npoints*(i+2), &
& MPI_DOUBLE_PRECISION, MPI_SUM, 0, MPI_COMM_WORLD, ierr_mpi)
calibrdata = workcalibr
deallocate (workcalibr)
if (rank_mpi == 0) then
! if (ix == ixproc_max) then
! write(*,*) 'Process rank ', rank_mpi, &
! & ' entered calibrdata output'
! allocate (workcalibr(1:npoints,1:i+2))
! call MPI_REDUCE (calibrdata, workcalibr, npoints*(i+2), &
! & MPI_DOUBLE_PRECISION, MPI_SUM, 0, MPI_COMM_WORLD, ierr_mpi)
! calibrdata = workcalibr
! deallocate (workcalibr)
! if (rank_mpi == 0) then
#else
if (ix == npoints) then
! if (ix == npoints) then
#endif
!do j = 1, npoints
! write (laststep_unitout,'(2e12.4,<i>e12.4)') calibrdata(j,1:2+i)
!enddo
deallocate (calibrdata)
! !do j = 1, npoints
! ! write (laststep_unitout,'(2e12.4,<i>e12.4)') calibrdata(j,1:2+i)
! !enddo
! deallocate (calibrdata)
write (*,*) 'Calibration data written'
! write (*,*) 'Calibration data written'
#ifdef mpi
endif
! endif
#endif
endif
! endif
endif calibrif
endif
! endif calibrif
!endif
if (call_Flake == 1) then
......
......@@ -230,7 +230,7 @@ use TURB_CONST, only : &
& lamTM, min_diff
use METH_OXYG_CONSTANTS, only : &
& r0_oliglake, r0_oldorg2_star, &
& r0_methprod_phot, r0_oldorg2_star, &
& ngasb, mf, &
& molm3tonM, &
& molm3toppm_co2,molm3toppm_o2,molm3toppm_ch4, &
......@@ -279,8 +279,6 @@ use RADIATION, only : &
implicit none
!Input variables
!Reals
!> Air temperature, K
......@@ -484,39 +482,39 @@ dnx = nx - nx0 + 1
dny = ny - ny0 + 1
if (firstcall) then
if (calibrate_parameter) then
! Calibration runs are performed only when ny = 1
if (npoint_calibr(1)*npoint_calibr(2) /= dnx) then
write(*,*) 'npoint_calibr(1)*npoint_calibr(2) /= dnx in LAKE: STOP'
STOP
else
! Calibration of constants r0_oliglake and r0_oldorg2_star
calibr_par1 => r0_oliglake
calibr_par2 => r0_oldorg2_star
cost_function => febultot
! calibr_par_min(1) = calibr_par1/2. ; calibr_par_max(1) = calibr_par1*2.
calibr_par_min(1) = 2.25d-8 ; calibr_par_max(1) = 3.d-8
! calibr_par_min(2) = calibr_par2/sqrt(2.) ; calibr_par_max(2) = calibr_par2*sqrt(2.)
calibr_par_min(2) = 6.d-11 ; calibr_par_max(2) = 8.d-11
step_calibr(1:2) = (calibr_par_max(1:2) - calibr_par_min(1:2))/ &
& real(npoint_calibr(1:2)-1)
endif
endif
endif
if (calibrate_parameter) then
if (mod(ix,npoint_calibr(1)) == 0) then
i = npoint_calibr(1)
j = ix/npoint_calibr(1)
else
i = mod(ix,npoint_calibr(1))
j = 1 + ix/npoint_calibr(1)
endif
calibr_par1 = calibr_par_min(1) + (i-1)*step_calibr(1)
calibr_par2 = calibr_par_min(2) + (j-1)*step_calibr(2)
endif
!if (firstcall) then
! if (calibrate_parameter) then
! ! Calibration runs are performed only when ny = 1
! if (npoint_calibr(1)*npoint_calibr(2) /= dnx) then
! write(*,*) 'npoint_calibr(1)*npoint_calibr(2) /= dnx in LAKE: STOP'
! STOP
! else
! ! Calibration of constants r0_methprod_phot and r0_oldorg2_star
! calibr_par1 => r0_methprod_phot
! calibr_par2 => r0_oldorg2_star
! cost_function => febultot
!
!! calibr_par_min(1) = calibr_par1/2. ; calibr_par_max(1) = calibr_par1*2.
! calibr_par_min(1) = 2.25d-8 ; calibr_par_max(1) = 3.d-8
!! calibr_par_min(2) = calibr_par2/sqrt(2.) ; calibr_par_max(2) = calibr_par2*sqrt(2.)
! calibr_par_min(2) = 6.d-11 ; calibr_par_max(2) = 8.d-11
! step_calibr(1:2) = (calibr_par_max(1:2) - calibr_par_min(1:2))/ &
! & real(npoint_calibr(1:2)-1)
! endif
! endif
!endif
!
!if (calibrate_parameter) then
! if (mod(ix,npoint_calibr(1)) == 0) then
! i = npoint_calibr(1)
! j = ix/npoint_calibr(1)
! else
! i = mod(ix,npoint_calibr(1))
! j = 1 + ix/npoint_calibr(1)
! endif
! calibr_par1(:) = calibr_par_min(1) + (i-1)*step_calibr(1)
! calibr_par2 = calibr_par_min(2) + (j-1)*step_calibr(2)
!endif
!Checking if forcing data is read
if ( (.not.dataread) .and. PBLpar%par /= 0) then
......
......@@ -711,7 +711,7 @@ END MODULE ARRAYS_SOIL
real(kind=ireals) :: comptime(1:ncomp) = 0.d0
!Parameter calibration group
real(kind=ireals), pointer, save :: calibr_par1, calibr_par2, cost_function(:)
real(kind=ireals), pointer, save :: calibr_par1(:), calibr_par2, cost_function(:)
logical, save :: calibrate_parameter = .false.
type, public :: gas_type
......@@ -1616,11 +1616,10 @@ real(kind=ireals), protected :: rnpp ! 100. - previous value ! NPP (gC/(m**2
real(kind=ireals), protected :: rnppmax ! the maximum value of the NPP
real(kind=ireals), protected :: q100 ! 2.3 (Liikanen et al., Biogeochemistry, 2002)
real(kind=ireals), protected :: r0 ! the constant rate factor, mol/(m**3*s)
!real(kind=ireals), parameter :: r0_oliglake = 1.7d-8 !1.d-8 ! the constant rate factor for oligotrophic lake, mol/(m**3*s)
real(kind=ireals), target :: r0_oliglake ! the constant for CH_4 production below photic zone, mol/(m**3*s)
! 2.55d-8 - optimal for Shuchi lake (Stepanenko et al., 2011)
real(kind=ireals), target :: r0_oliglake1 ! the constant for CH_4 production in the photic zone, mol/(m**3*s)
!real(kind=ireals), target, save :: r0_oliglake = 16.31d-10 !1.d-8 ! the constant rate factor for oligotrophic lake, mol/(m**3*s)
real(kind=ireals), allocatable, target :: r0_methprod_phot (:) ! the constant for CH_4 production
! in photic zone, mol/(m**3*s)
real(kind=ireals), allocatable, target :: r0_methprod_nonphot(:) ! the constant for CH_4 production
! below photic zone, mol/(m**3*s)
real(kind=ireals), protected :: forg0 ! the constant in depth dependence of methane production rate
real(kind=ireals), protected :: lambda_new_org !5. in Walter & Heimann model,
! the parameter describing the decrease rate
......@@ -1837,6 +1836,7 @@ real(kind=ireals), protected :: Chla_to_extinct !linear dependence coefficient o
contains
SUBROUTINE SET_METH_OXYG_CONSTANTS
use DRIVING_PARAMS, only : nsoilcols_
implicit none
pH = 6. !The pH of the water in a lake, assumed to be constant
......@@ -1954,11 +1954,12 @@ rnpp = 100. ! 100. - previous value ! NPP (gC/(m**2*month))
rnppmax = 180. ! the maximum value of the NPP
q100 = 2.3 ! 2.3 (Liikanen et al., Biogeochemistry, 2002)
r0 = 1.67d-7 ! the constant rate factor, mol/(m**3*s)
!real(kind=ireals), parameter :: r0_oliglake = 1.7d-8 !1.d-8 ! the constant rate factor for oligotrophic lake, mol/(m**3*s)
r0_oliglake = 6.d-8 ! the constant for CH_4 production below photic zone, mol/(m**3*s)
! 2.55d-8 - optimal for Shuchi lake (Stepanenko et al., 2011)
r0_oliglake1 = 6.d-8 ! the constant for CH_4 production in the photic zone, mol/(m**3*s)
!real(kind=ireals), target, save :: r0_oliglake = 16.31d-10 !1.d-8 ! the constant rate factor for oligotrophic lake, mol/(m**3*s)
allocate(r0_methprod_phot (1:nsoilcols_%par))
allocate(r0_methprod_nonphot(1:nsoilcols_%par))
r0_methprod_phot (:) = 6.d-8 ! the constant for CH_4 production in photic zone, mol/(m**3*s)
r0_methprod_nonphot(:) = 6.d-8 ! the constant for CH_4 production below photic zone, mol/(m**3*s)
forg0 = 0.857 ! the constant in depth dependence of methane production rate
lambda_new_org = 3. !5. in Walter & Heimann model,
! the parameter describing the decrease rate
......
......@@ -230,8 +230,8 @@ implicit none
! Constant of methane production in sediments is set differently for
! sediments in photic zone and underneath
dz_ = ls%H_photic_zone - h1
r0_meth = 0.5*( (1. - sign(1._ireals,dz_) )*r0_oliglake + &
& (1. + sign(1._ireals,dz_) )*r0_oliglake1)
r0_meth = 0.5*( (1. - sign(1._ireals,dz_) )*r0_methprod_phot (gs%isoilcol) + &
& (1. + sign(1._ireals,dz_) )*r0_methprod_nonphot(gs%isoilcol))
qsoil => gas%qsoil (:,gs%isoilcol)
qwater => gas%qwater
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment