New changes from l2g

w
This commit is contained in:
2022-09-12 16:40:28 +00:00
parent 78eb7147d0
commit d713d4f61a
110 changed files with 87672 additions and 1098 deletions
+64 -86
View File
@@ -17,7 +17,7 @@
integer dataunit,spareunit,ierr(2),runvalues(8),ipos1,ipos2,
&ntotfiles,noutputfiles,i,j,k,rank_mpi,numproc_mpi,numproc,
&ierror_mpi,nshare,nmod,npartfiles,istartno,iendno,indexunit(20),
&numchar,needheader(20),rootprocess
&numchar,needheader(20),rootprocess,ic3c4cam
character rundate*8,runtime*10,runzone*5,longchar*5000,achar*5,
&longchar1*5000
character*100 datapath,outpath,storein,storeout,ACidata(8000)
@@ -26,12 +26,13 @@
! Set input / output directory
parameter(
& datapath=
&'../input/',
! &'/home/l2g/ngeetropics/gamboa/curves/',
! &'/home/l2g/ngeetropics/metropolitano/curves/',
! &'/home/l2g/ngeetropics/fortsherman/curves/',
! & '/home/l2g/ngeetropics/kelsey/curves/',
! & '/home/l2g/leafres/hybriddata/Berner/',
& '/home/l2g/SingleLeafModel/ACiSimulation/hybrid/',
! & '/home/l2g/SingleLeafModel/ACiSimulation/hybrid/',
! &'/home/l2g/leafweb/data/dweston/Sphagnum_leafweb_Oct2015/',
! & '/home/l2g/SingleLeafModel/ACiSimulation/wenting/',
@@ -61,12 +62,13 @@
! & '/home/l2g/dataassim/leaf/data/dweston/inputs/',
! & '/home/l2g/GEMSiS/curves/',
& outpath=
&'../output/fitresult/touser/',
! &'/home/l2g/ngeetropics/gamboa/results/',
! &'/home/l2g/ngeetropics/metropolitano/results/',
! &'/home/l2g/ngeetropics/fortsherman/',
! &'/home/l2g/ngeetropics/kelsey/results/',
! & '/home/l2g/leafres/hybriddata/Berner/',
& '/home/l2g/SingleLeafModel/ACiSimulation/hybrid/',
! & '/home/l2g/SingleLeafModel/ACiSimulation/hybrid/',
! &'/home/l2g/leafweb/data/dweston/Sphagnum_leafweb_Oct2015/',
! &'/home/l2g/leafres/hybriddata/cernusak/2014data/',
! & '/home/l2g/SingleLeafModel/ACiSimulation/wenting/',
@@ -100,23 +102,50 @@
! &storein='/home/l2g/leafweb/users/curves/',
! &storeout='/home/l2g/leafweb/users/results/',
&storein='/home/l2g/clm/results/',
&storeout='/home/l2g/clm/results/',
&storein='../output/clninput/',
&storeout='../output/fitresult/nottouser/',
! &storein='/home/l2g/junk/',
! &storeout='/home/l2g/junk/',
! &storein='/home/l2g/dataassim/leaf/data/ellsworth/outputs/',
! &storeout='/home/l2g/dataassim/leaf/data/ellsworth/outputs/',
& AllACiFiles='AllLeafGasFiles')
& AllACiFiles='../piscal.cfg')
!---------------End of variable declaration----------------
rootprocess=0
dataunit=1
spareunit=3
! if(rank_mpi.ne.rootprocess)goto 25
!read A/Ci curve names stored in AllACiFiles
open(unit=2,file=trim(datapath)//trim(AllACiFiles))
open(unit=2,file=trim(AllACiFiles))
ntotfiles=1
ic3c4cam=-9999
10 read(2,fmt=300,end=20)longchar
if(longchar.eq.''.or.longchar.eq.' ')goto 10
if(ntotfiles.eq.1.and.ic3c4cam.lt.0)then
i=0
if(index(longchar,'_photosynthesis_leafweb').gt.0)then
i=index(longchar,'c3')+index(longchar,'C3')
if(i.gt.0)then
ic3c4cam=1
else
i=index(longchar,'c4')+index(longchar,'C4')
if(i.gt.0)then
ic3c4cam=2
else
i=index(longchar,'cam')+index(longchar,'caM')+
&index(longchar,'cAm')+index(longchar,'cAM')+
&index(longchar,'Cam')+index(longchar,'CaM')+
&index(longchar,'CAm')+index(longchar,'CAM')
if(i.gt.0)ic3c4cam=3
endif
endif
endif
if(i.gt.0)goto 10
!if no indication is provided, c3 photosynthesis is assumed and the first line
!contains the name of the first data file
ic3c4cam=1
endif
i=len(longchar)
j=0
15 j=j+1
@@ -153,6 +182,9 @@
noutputfiles=11
!10 to 20 are used for file units for output files
do i=1,noutputfiles
if(ic3c4cam.eq.1)outputfile(i)='C3_'//outputfile(i)
if(ic3c4cam.eq.2)outputfile(i)='C4_'//outputfile(i)
if(ic3c4cam.eq.3)outputfile(i)='CAM_'//outputfile(i)
indexunit(i)=i+9
enddo
call MPI_INIT(ierror_mpi)
@@ -190,82 +222,16 @@
numchar=numchar+1
goto 30
40 call NumberToChar(rank_mpi,numchar,achar)
do i=1,noutputfiles-1
do i=1,noutputfiles
open(unit=indexunit(i),
&file=trim(outpath)//trim(outputfile(i))//trim(achar))
enddo
call ToLeafGasOptimization(npartfiles,ACidata(istartno:iendno),
&dataunit,spareunit,datapath,indexunit,ierr)
do i=1,noutputfiles-1
call ToLeafGasOptimization(ic3c4cam,npartfiles,
&ACidata(istartno:iendno),dataunit,spareunit,datapath,indexunit,
&ierr)
do i=1,noutputfiles
close(indexunit(i))
enddo
if(ierr(1).ne.0)then
i=indexunit(noutputfiles)
open(unit=i,
&file=trim(outpath)//trim(outputfile(noutputfiles))//trim(achar))
write(i,*)'Input data error in ',ACidata(ierr(2)+istartno-1)
write(i,*)
&'Please resubmit the data after correcting the following error:'
if(ierr(1).eq.1)then
write(i,*)'Photosynthesis (umol/m2/s) out of range'
endif
if(ierr(1).eq.2)then
write(i,*)'Intercellular CO2(ppm) out of range'
endif
if(ierr(1).eq.3)then
write(i,*)'Leaf temperature (oC) out of range'
endif
if(ierr(1).eq.4)then
write(i,*)'Chamber PAR (umol/m2/s) out of range'
endif
if(ierr(1).eq.5)then
write(i,*)'Atmospheric pressure (Pa) out of range'
endif
if(ierr(1).eq.13)then
write(i,*)'Check line 13 for data entry error'
endif
if(ierr(1).eq.14)then
write(i,*)'Specified chloroplastic CO2 compensation point',
&'(Pa) out of range'
endif
if(ierr(1).eq.15)then
write(i,*)'Specified Michaelis-Menten constant for the',
&'carboxylase (Kc) out of range'
endif
if(ierr(1).eq.16)then
write(i,*)'Specified Michaelis-Menten constant for the',
&'oxygenase (Ko) out of range'
endif
if(ierr(1).eq.17)then
write(i,*)'Specified fraction of nonreturned glycolate',
&'carbon(alpha) out of range 0~1'
endif
if(ierr(1).eq.18)then
write(i,*)'Specified dark respiration rate Rd out of range >0'
endif
if(ierr(1).eq.19)then
write(i,*)'Specified mesophyll) resistance rch or rwp out of',
&'of range >0'
endif
if(ierr(1).eq.34)then
write(i,*)'Check Column 33 or 34. Mixing area- and mass-based
&measurements is not allowed'
endif
if(ierr(1).eq.36)then
write(i,*)'Check line 16 for data entry error'
endif
if(ierr(1).eq.39)then
write(i,*)
&'Check the main body of data for data entry error, starting from
&line 19'
endif
if(ierr(1).eq.40)then
write(i,*)
&'Data file format cannot be recognized'
endif
close(i)
endif
!make sure everyone is done before wrapping up.
45 call MPI_BARRIER(MPI_COMM_WORLD,ierror_mpi)
if(rank_mpi.eq.rootprocess)then
@@ -326,29 +292,41 @@
enddo
!----------------------------------------------------------
!intercept the data
goto 450
399 call date_and_time(rundate,runtime,runzone,runvalues)
if(needheader(noutputfiles).eq.2)then
!if there is error in any input files, donot store the data
do i=1,ntotfiles
open(unit=1,file=trim(datapath)//'clean'//trim(ACidata(i)))
close(1,status='delete')
enddo
goto 450
endif
call date_and_time(rundate,runtime,runzone,runvalues)
do i=1,ntotfiles
open(unit=1,file=trim(datapath)//trim(ACidata(i)))
open(unit=1,file=trim(datapath)//'clean'//trim(ACidata(i)))
open(unit=2,file=
&trim(storein)//rundate//runtime(1:6)//trim(ACidata(i)))
&trim(storein)//rundate//runtime(1:6)//'clean'//trim(ACidata(i)))
400 read(1,fmt=300,end=410)longchar
write(2,310)trim(longchar)
goto 400
410 close(1)
410 close(1,status='delete')
close(2)
enddo
do i=1,6
do i=1,noutputfiles
k=0
open(unit=1,file=trim(outpath)//trim(outputfile(i)))
open(unit=2,file=
if(i.ge.3.and.i.le.5)then
open(unit=2,file=
&trim(storeout)//rundate//runtime(1:6)//trim(outputfile(i)))
else
open(unit=2,file=
&trim(outpath)//rundate//runtime(1:6)//trim(outputfile(i)))
endif
420 read(1,fmt=300,end=430)longchar
write(2,310)trim(longchar)
k=1
goto 420
430 if(k.eq.1)then
close(1)
close(1,status='delete')
close(2)
else
close(1,status='delete')