diff --git a/EDAllomUnitWrap.F90 b/EDAllomUnitWrap.F90 index 5b75605..12a42b7 100644 --- a/EDAllomUnitWrap.F90 +++ b/EDAllomUnitWrap.F90 @@ -1,153 +1,341 @@ +! +! gfortran -shared -fPIC -g -o EDAllomUnitWrap.o EDAllomUnitWrap.F90 +! +! module EDAllomUnitWrap + use iso_c_binding, only: c_double, c_int, c_char - + integer,parameter :: strlen_a = 20 ! token stinglength for allometry parameter names + type, public :: EDecophyscon_type - real(r8), pointer :: max_dbh (:) ! maximum dbh at which height growth ceases... - real(r8), pointer :: freezetol (:) ! minimum temperature tolerance... - real(r8), pointer :: wood_density (:) ! wood density g cm^-3 ... - real(r8), pointer :: alpha_stem (:) ! live stem turnover rate. y-1 - real(r8), pointer :: hgt_min (:) ! sapling height m - real(r8), pointer :: cushion (:) ! labile carbon storage target as multiple of leaf pool. - real(r8), pointer :: leaf_stor_priority (:) ! leaf turnover vs labile carbon use prioritisation. ! (1=lose leaves, 0=use store). - real(r8), pointer :: leafwatermax (:) ! amount of water allowed on leaf surfaces - real(r8), pointer :: rootresist (:) - real(r8), pointer :: soilbeta (:) - real(r8), pointer :: crown (:) ! fraction of the height of the plant that is occupied by crown. For fire model. - real(r8), pointer :: bark_scaler (:) ! scaler from dbh to bark thickness. For fire model. - real(r8), pointer :: crown_kill (:) ! scaler on fire death. For fire model. - real(r8), pointer :: initd (:) ! initial seedling density - real(r8), pointer :: sd_mort (:) ! rate of death of seeds produced from reproduction. - real(r8), pointer :: seed_rain (:) ! seeds that come from outside the gridbox. - real(r8), pointer :: BB_slope (:) ! ball berry slope parameter - real(r8), pointer :: root_long (:) ! root longevity (yrs) - real(r8), pointer :: clone_alloc (:) ! fraction of carbon balance allocated to clonal reproduction. - real(r8), pointer :: seed_alloc (:) ! fraction of carbon balance allocated to seeds. + real(kind=8), pointer :: max_dbh (:) ! maximum dbh at which height growth ceases... + real(kind=8), pointer :: wood_density (:) ! wood density g cm^-3 ... + real(kind=8), pointer :: hgt_min (:) ! sapling height m - real(r8), pointer :: c2b (:) ! carbon to biomass ratio - real(r8), pointer :: eclim (:) ! climatological taper influence parameter from Chave - real(r8), pointer :: bl_min (:) ! leaf biomass at d_min [kgC] - real(r8), pointer :: h_max (:) ! maximum possible height [m] - real(r8), pointer :: h_min (:) ! height of plant at d_min [m] - real(r8), pointer :: slatop (:) ! specific leaf area (SLA) at crown top [m2/gC] - real(r8), pointer :: d_adult (:) ! diameter of an adult tree, roughly the lower diameter + real(kind=8), pointer :: c2b (:) ! carbon to biomass ratio + real(kind=8), pointer :: eclim (:) ! climatological taper influence parameter from Chave + real(kind=8), pointer :: bl_min (:) ! leaf biomass at d_min [kgC] + real(kind=8), pointer :: h_max (:) ! maximum possible height [m] + real(kind=8), pointer :: h_min (:) ! height of plant at d_min [m] + real(kind=8), pointer :: slatop (:) ! specific leaf area (SLA) at crown top [m2/gC] + real(kind=8), pointer :: d_adult (:) ! diameter of an adult tree, roughly the lower diameter ! bound for the census where the allometric relations hold ! typically 10cm [cm] - real(r8), pointer :: d_sap (:) ! the maximum diameter of a sapling, below which sapling + real(kind=8), pointer :: d_sap (:) ! the maximum diameter of a sapling, below which sapling ! allometric proportions are used [cm] - real(r8), pointer :: f2l_ratio (:) ! fine-root to leaf biomass ratio when "on-allometry" [gC/gC] - real(r8), pointer :: agb_fraction (:) ! fraction of agb compared to total biomass [-] - real(r8), pointer :: latosa_int (:) ! leaf area to sapwood area intercept (previously sapwood_ratio + real(kind=8), pointer :: f2l_ratio (:) ! fine-root to leaf biomass ratio when "on-allometry" [gC/gC] + real(kind=8), pointer :: agb_fraction (:) ! fraction of agb compared to total biomass [-] + real(kind=8), pointer :: latosa_int (:) ! leaf area to sapwood area intercept (previously sapwood_ratio ! [m2/cm2] - real(r8), pointer :: latosa_slp (:) ! slope of the latosa relationship [m2/cm3] - real(r8), pointer :: d2h1_ad (:) ! parameter 1 for adult diam to height allom - real(r8), pointer :: d2h2_ad (:) ! parameter 2 for adult diam to height allom - real(r8), pointer :: d2h3_ad (:) ! parameter 3 for adult diam to height allom - real(r8), pointer :: d2h1_sap (:) ! parameter 1 for sapling diam to height allom - real(r8), pointer :: d2h2_sap (:) ! parameter 2 for sapling diam to height allom - real(r8), pointer :: d2bl1_ad (:) ! parameter 1 for adult diam to leaf biom allom - real(r8), pointer :: d2bl2_ad (:) ! parameter 2 for adult diam to leaf biom allom - real(r8), pointer :: d2bl3_ad (:) ! parameter 3 for adult diam to leaf biom allom - real(r8), pointer :: d2bl1_sap (:) ! parameter 1 for sapling diam to leaf biom allom - real(r8), pointer :: d2bl2_sap (:) ! parameter 2 for sapling diam to leaf boim allom - real(r8), pointer :: d2bag1 (:) ! parameter 1 for all diam to AGB allom - real(r8), pointer :: d2bag2 (:) ! parameter 2 for all diam to AGB allom + real(kind=8), pointer :: latosa_slp (:) ! slope of the latosa relationship [m2/cm3] + real(kind=8), pointer :: d2h1_ad (:) ! parameter 1 for adult diam to height allom + real(kind=8), pointer :: d2h2_ad (:) ! parameter 2 for adult diam to height allom + real(kind=8), pointer :: d2h3_ad (:) ! parameter 3 for adult diam to height allom + real(kind=8), pointer :: d2h1_sap (:) ! parameter 1 for sapling diam to height allom + real(kind=8), pointer :: d2h2_sap (:) ! parameter 2 for sapling diam to height allom + real(kind=8), pointer :: d2bl1_ad (:) ! parameter 1 for adult diam to leaf biom allom + real(kind=8), pointer :: d2bl2_ad (:) ! parameter 2 for adult diam to leaf biom allom + real(kind=8), pointer :: d2bl3_ad (:) ! parameter 3 for adult diam to leaf biom allom + real(kind=8), pointer :: d2bl1_sap (:) ! parameter 1 for sapling diam to leaf biom allom + real(kind=8), pointer :: d2bl2_sap (:) ! parameter 2 for sapling diam to leaf boim allom + real(kind=8), pointer :: d2bag1 (:) ! parameter 1 for all diam to AGB allom + real(kind=8), pointer :: d2bag2 (:) ! parameter 2 for all diam to AGB allom + character(len=strlen_a), pointer :: hallom_mode (:) ! height allometry function type + character(len=strlen_a), pointer :: lallom_mode (:) ! maximum leaf allometry function type + character(len=strlen_a), pointer :: fallom_mode (:) ! maximum root allometry function type + character(len=strlen_a), pointer :: aallom_mode (:) ! AGB allometry function type + character(len=strlen_a), pointer :: callom_mode (:) ! coarse root allometry function type + character(len=strlen_a), pointer :: sallom_mode (:) ! sapwood allometry function type end type EDecophyscon_type + + type pftptr_var + real(kind=8), dimension(:), pointer :: var_rp + integer, dimension(:), pointer :: var_ip + character(len = strlen_a), dimension(:), pointer :: var_cp + character(len = strlen_a) :: var_name + integer :: vtype + end type pftptr_var + + type EDecophyscon_ptr + type(pftptr_var), allocatable :: var(:) + end type EDecophyscon_ptr + type(EDecophyscon_type), public :: EDecophyscon ! ED ecophysiological constants structure + type(EDecophyscon_ptr), public :: EDecophysptr ! Pointer structure for obj-oriented id + + integer :: numparm ! Number of different PFT parameters + integer :: numpft contains - subroutine EDecophysconInit(EDpftvarcon_inst, numpft) - ! - ! !USES: - use EDPftvarcon, only : EDPftvarcon_type + + subroutine EDEcophysconPySet(name,ipft,rval,ival,cval) + + implicit none + ! Arguments + integer(c_int),intent(in) :: ipft + character(kind=c_char), intent(in) :: name(*) + real(c_double),intent(in) :: rval + integer(c_int),intent(in) :: ival + character(kind=c_char), intent(in) :: cval(*) + ! Locals + logical :: npfound + integer :: ip + + print*,ichar(name) + +! print*,"NAME: ",name(1:2)," IPFT: ",ipft," RVAL: ",rval," IVAL: ",ival," CVAL: ",cval + + ip=0 + npfound = .true. + do ip=1,numparm + + if (trim(name(:)) == trim(EDecophysptr%var(ip)%var_name ) ) then + npfound = .false. + if(EDecophysptr%var(ip)%vtype == 1) then ! real + EDecophysptr%var(ip)%var_rp(ipft) = rval + elseif(EDecophysptr%var(ip)%vtype == 2) then ! real + EDecophysptr%var(ip)%var_ip(ipft) = ival + else + EDecophysptr%var(ip)%var_cp(ipft) = cval + end if + end if + + if(npfound)then + print*,"The parameter you loaded DNE: ",name(:) + stop + end if + + end do + return + end subroutine EDEcophysconPySet + + + subroutine EDEcophysconAlloc(numpft_in) ! + ! !ARGUMENTS: - type(EDpftVarCon_type) , intent(in) :: EDpftvarcon_inst - integer , intent(in) :: numpft - ! - ! !LOCAL VARIABLES: - integer :: m, ib + integer(c_int), intent(in) :: numpft_in + ! LOCALS: + integer :: iv ! The parameter incrementer !------------------------------------------------------------------------ - allocate( EDecophyscon%max_dbh (0:numpft)); EDecophyscon%max_dbh (:) = nan - allocate( EDecophyscon%freezetol (0:numpft)); EDecophyscon%freezetol (:) = nan - allocate( EDecophyscon%wood_density (0:numpft)); EDecophyscon%wood_density (:) = nan - allocate( EDecophyscon%alpha_stem (0:numpft)); EDecophyscon%alpha_stem (:) = nan - allocate( EDecophyscon%hgt_min (0:numpft)); EDecophyscon%hgt_min (:) = nan - allocate( EDecophyscon%cushion (0:numpft)); EDecophyscon%cushion (:) = nan - allocate( EDecophyscon%leaf_stor_priority (0:numpft)); EDecophyscon%leaf_stor_priority (:) = nan - allocate( EDecophyscon%leafwatermax (0:numpft)); EDecophyscon%leafwatermax (:) = nan - allocate( EDecophyscon%rootresist (0:numpft)); EDecophyscon%rootresist (:) = nan - allocate( EDecophyscon%soilbeta (0:numpft)); EDecophyscon%soilbeta (:) = nan - allocate( EDecophyscon%crown (0:numpft)); EDecophyscon%crown (:) = nan - allocate( EDecophyscon%bark_scaler (0:numpft)); EDecophyscon%bark_scaler (:) = nan - allocate( EDecophyscon%crown_kill (0:numpft)); EDecophyscon%crown_kill (:) = nan - allocate( EDecophyscon%initd (0:numpft)); EDecophyscon%initd (:) = nan - allocate( EDecophyscon%sd_mort (0:numpft)); EDecophyscon%sd_mort (:) = nan - allocate( EDecophyscon%seed_rain (0:numpft)); EDecophyscon%seed_rain (:) = nan - allocate( EDecophyscon%BB_slope (0:numpft)); EDecophyscon%BB_slope (:) = nan - allocate( EDecophyscon%root_long (0:numpft)); EDecophyscon%root_long (:) = nan - allocate( EDecophyscon%seed_alloc (0:numpft)); EDecophyscon%seed_alloc (:) = nan - allocate( EDecophyscon%clone_alloc (0:numpft)); EDecophyscon%clone_alloc (:) = nan - allocate( EDecophyscon%sapwood_ratio (0:numpft)); EDecophyscon%sapwood_ratio (:) = nan - - allocate( EDecophyscon%c2b (0:numpft)); EDecophyscon%c2b (:) = nan - allocate( EDecophyscon%eclim (0:numpft)); EDecophyscon%eclim (:) = nan - allocate( EDecophyscon%bl_min (0:numpft)); EDecophyscon%bl_min (:) = nan - allocate( EDecophyscon%h_max (0:numpft)); EDecophyscon%h_max (:) = nan - allocate( EDecophyscon%h_min (0:numpft)); EDecophyscon%h_min (:) = nan - allocate( EDecophyscon%slatop (0:numpft)); EDecophyscon%slatop (:) = nan - allocate( EDecophyscon%d_adult (0:numpft)); EDecophyscon%d_adult (:) = nan - allocate( EDecophyscon%d_sap (0:numpft)); EDecophyscon%d_sap (:) = nan - allocate( EDecophyscon%f2l_ratio (0:numpft)); EDecophyscon%f2l_ratio (:) = nan - allocate( EDecophyscon%agb_fraction (0:numpft)); EDecophyscon%agb_fraction (:) = nan - allocate( EDecophyscon%latosa_int (0:numpft)); EDecophyscon%latosa_int (:) = nan - allocate( EDecophyscon%latosa_slp (0:numpft)); EDecophyscon%latosa_slp (:) = nan - allocate( EDecophyscon%d2h1_ad (0:numpft)); EDecophyscon%d2h1_ad (:) = nan - allocate( EDecophyscon%d2h2_ad (0:numpft)); EDecophyscon%d2h2_ad (:) = nan - allocate( EDecophyscon%d2h3_ad (0:numpft)); EDecophyscon%d2h3_ad (:) = nan - allocate( EDecophyscon%d2h1_sap (0:numpft)); EDecophyscon%d2h1_sap (:) = nan - allocate( EDecophyscon%d2h2_sap (0:numpft)); EDecophyscon%d2h2_sap (:) = nan - allocate( EDecophyscon%d2bl1_ad (0:numpft)); EDecophyscon%d2bl1_ad (:) = nan - allocate( EDecophyscon%d2bl2_ad (0:numpft)); EDecophyscon%d2bl2_ad (:) = nan - allocate( EDecophyscon%d2bl3_ad (0:numpft)); EDecophyscon%d2bl3_ad (:) = nan - allocate( EDecophyscon%d2bl1_sap (0:numpft)); EDecophyscon%d2bl1_sap (:) = nan - allocate( EDecophyscon%d2bl2_sap (0:numpft)); EDecophyscon%d2bl2_sap (:) = nan - allocate( EDecophyscon%d2bag1 (0:numpft)); EDecophyscon%d2bag1 (:) = nan - allocate( EDecophyscon%d2bag2 (0:numpft)); EDecophyscon%d2bag2 (:) = nan - - do m = 0,numpft - EDecophyscon%max_dbh(m) = EDPftvarcon_inst%max_dbh(m) - EDecophyscon%freezetol(m) = EDPftvarcon_inst%freezetol(m) - EDecophyscon%wood_density(m) = EDPftvarcon_inst%wood_density(m) - EDecophyscon%alpha_stem(m) = EDPftvarcon_inst%alpha_stem(m) - EDecophyscon%hgt_min(m) = EDPftvarcon_inst%hgt_min(m) - EDecophyscon%cushion(m) = EDPftvarcon_inst%cushion(m) - EDecophyscon%leaf_stor_priority(m) = EDPftvarcon_inst%leaf_stor_priority(m) - EDecophyscon%leafwatermax(m) = EDPftvarcon_inst%leafwatermax(m) - EDecophyscon%rootresist(m) = EDPftvarcon_inst%rootresist(m) - EDecophyscon%soilbeta(m) = EDPftvarcon_inst%soilbeta(m) - EDecophyscon%crown(m) = EDPftvarcon_inst%crown(m) - EDecophyscon%bark_scaler(m) = EDPftvarcon_inst%bark_scaler(m) - EDecophyscon%crown_kill(m) = EDPftvarcon_inst%crown_kill(m) - EDecophyscon%initd(m) = EDPftvarcon_inst%initd(m) - EDecophyscon%sd_mort(m) = EDPftvarcon_inst%sd_mort(m) - EDecophyscon%seed_rain(m) = EDPftvarcon_inst%seed_rain(m) - EDecophyscon%bb_slope(m) = EDPftvarcon_inst%bb_slope(m) - EDecophyscon%root_long(m) = EDPftvarcon_inst%root_long(m) - EDecophyscon%seed_alloc(m) = EDPftvarcon_inst%seed_alloc(m) - EDecophyscon%clone_alloc(m) = EDPftvarcon_inst%clone_alloc(m) - EDecophyscon%sapwood_ratio(m) = EDPftvarcon_inst%sapwood_ratio(m) - end do - - end subroutine EDecophysconInit + numpft = numpft_in + + allocate( EDecophysptr%var (100) ) + + iv=0 + + allocate( EDecophyscon%max_dbh (1:numpft)); EDecophyscon%max_dbh (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "max_dbh" + EDecophysptr%var(iv)%var_rp => EDecophyscon%max_dbh + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%wood_density (1:numpft)); EDecophyscon%wood_density (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "wood_density" + EDecophysptr%var(iv)%var_rp => EDecophyscon%wood_density + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%hgt_min (1:numpft)); EDecophyscon%hgt_min (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "hgt_min" + EDecophysptr%var(iv)%var_rp => EDecophyscon%hgt_min + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%c2b (1:numpft)); EDecophyscon%c2b (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "c2b" + EDecophysptr%var(iv)%var_rp => EDecophyscon%c2b + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%eclim (1:numpft)); EDecophyscon%eclim (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "eclim" + EDecophysptr%var(iv)%var_rp => EDecophyscon%eclim + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%bl_min (1:numpft)); EDecophyscon%bl_min (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "bl_min" + EDecophysptr%var(iv)%var_rp => EDecophyscon%bl_min + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%h_max (1:numpft)); EDecophyscon%h_max (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "h_max" + EDecophysptr%var(iv)%var_rp => EDecophyscon%h_max + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%h_min (1:numpft)); EDecophyscon%h_min (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "h_min" + EDecophysptr%var(iv)%var_rp => EDecophyscon%h_min + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%slatop (1:numpft)); EDecophyscon%slatop (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "slatop" + EDecophysptr%var(iv)%var_rp => EDecophyscon%slatop + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d_adult (1:numpft)); EDecophyscon%d_adult (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d_adult" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d_adult + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d_sap (1:numpft)); EDecophyscon%d_sap (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d_sap" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d_sap + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%f2l_ratio (1:numpft)); EDecophyscon%f2l_ratio (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "f2l_ratio" + EDecophysptr%var(iv)%var_rp => EDecophyscon%f2l_ratio + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%agb_fraction (1:numpft)); EDecophyscon%agb_fraction (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "agb_fraction" + EDecophysptr%var(iv)%var_rp => EDecophyscon%agb_fraction + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%latosa_int (1:numpft)); EDecophyscon%latosa_int (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "eclim" + EDecophysptr%var(iv)%var_rp => EDecophyscon%eclim + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%latosa_slp (1:numpft)); EDecophyscon%latosa_slp (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "latosa_slp" + EDecophysptr%var(iv)%var_rp => EDecophyscon%latosa_slp + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2h1_ad (1:numpft)); EDecophyscon%d2h1_ad (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2h1_ad" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2h1_ad + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2h2_ad (1:numpft)); EDecophyscon%d2h2_ad (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2h2_ad" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2h2_ad + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2h3_ad (1:numpft)); EDecophyscon%d2h3_ad (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2h3_ad" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2h3_ad + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2h1_sap (1:numpft)); EDecophyscon%d2h1_sap (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2h1_sap" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2h1_sap + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2h2_sap (1:numpft)); EDecophyscon%d2h2_sap (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2h2_sap" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2h2_sap + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2bl1_ad (1:numpft)); EDecophyscon%d2bl1_ad (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2bl1_ad" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2bl1_ad + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2bl2_ad (1:numpft)); EDecophyscon%d2bl2_ad (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2bl2_ad" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2bl2_ad + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2bl3_ad (1:numpft)); EDecophyscon%d2bl3_ad (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2bl3_ad" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2bl3_ad + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2bl1_sap (1:numpft)); EDecophyscon%d2bl1_sap (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2bl1_sap" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2bl1_sap + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2bl2_sap (1:numpft)); EDecophyscon%d2bl2_sap (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2bl2_sap" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2bl2_sap + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2bag1 (1:numpft)); EDecophyscon%d2bag1 (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2bag1" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2bag1 + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%d2bag2 (1:numpft)); EDecophyscon%d2bag2 (:) = nan + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "d2bag2" + EDecophysptr%var(iv)%var_rp => EDecophyscon%d2bag2 + EDecophysptr%var(iv)%vtype = 1 + + allocate( EDecophyscon%hallom_mode(1:numpft)); EDecophyscon%hallom_mode (:) = "" + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "hallom_mode" + EDecophysptr%var(iv)%var_cp => EDecophyscon%hallom_mode + EDecophysptr%var(iv)%vtype = 3 + + allocate( EDecophyscon%lallom_mode(1:numpft)); EDecophyscon%lallom_mode (:) = "" + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "lallom_mode" + EDecophysptr%var(iv)%var_cp => EDecophyscon%lallom_mode + EDecophysptr%var(iv)%vtype = 3 + + allocate( EDecophyscon%fallom_mode(1:numpft)); EDecophyscon%fallom_mode (:) = "" + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "fallom_mode" + EDecophysptr%var(iv)%var_cp => EDecophyscon%fallom_mode + EDecophysptr%var(iv)%vtype = 3 + + allocate( EDecophyscon%aallom_mode(1:numpft)); EDecophyscon%aallom_mode (:) = "" + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "aallom_mode" + EDecophysptr%var(iv)%var_cp => EDecophyscon%aallom_mode + EDecophysptr%var(iv)%vtype = 3 + + allocate( EDecophyscon%callom_mode(1:numpft)); EDecophyscon%callom_mode (:) = "" + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "callom_mode" + EDecophysptr%var(iv)%var_cp => EDecophyscon%callom_mode + EDecophysptr%var(iv)%vtype = 3 + + allocate( EDecophyscon%sallom_mode(1:numpft)); EDecophyscon%sallom_mode (:) = "" + iv = iv + 1 + EDecophysptr%var(iv)%var_name = "sallom_mode" + EDecophysptr%var(iv)%var_cp => EDecophyscon%sallom_mode + EDecophysptr%var(iv)%vtype = 3 + + numparm = iv + + print*,"ALLOCATED ",numparm," PARAMETERS, FOR ",numpft," PFTs" + return + end subroutine EDEcophysconAlloc end module EDAllomUnitWrap diff --git a/drive_allomtests.py b/drive_allomtests.py new file mode 100644 index 0000000..1e09fd6 --- /dev/null +++ b/drive_allomtests.py @@ -0,0 +1,37 @@ +import numpy +from ctypes import byref, cdll, c_int, c_double, c_char_p + +# edallomunitwrap_MOD_edecophysconalloc + +fallomlib = cdll.LoadLibrary('./EDAllomUnitWrap.o') + +numpft = c_int(10) + +fallomlib.__edallomunitwrap_MOD_edecophysconalloc(byref(numpft)) + +pname = c_char_p("bl_min") +ipft = c_int(2) +rval = c_double(0.04) +ival = c_int(0) +cval = c_char_p("p") + +fallomlib.__edallomunitwrap_MOD_edecophysconpyset(byref(pname),byref(ipft),byref(rval),byref(ival),byref(cval)) + + + +#fadd = cdll.LoadLibrary('./add.so') + +#arg1 = c_double(2.0) +#arg2 = c_double(4.0) + +#arg3 = c_int(2) +#arg4 = c_int(4) + +#fadd.__add_MOD_initpatch(byref(arg4)) + +#print fadd.__add_MOD_frand(byref(arg4),byref(arg3)) + +#print fadd.__add_MOD_fiadd(byref(arg3),byref(arg4)) + +#print fadd.__add_MOD_fdadd(byref(arg1),byref(arg2)) +