Instructions for Testbed Framework Version 2.0: Note: Bottom boundary conditions are now in the initial condition data files, rather than hardcoded in the bbcnsv array. If you created any new *.init files last time (e.g. for nutrients for which I did not provide initial conditions) you will need to add the bottom boundary condition as the last line. In the depth column add -999.0 (or anything you want, it actually isn't used anywhere), and add the bottom boundary condition in the variable column. As before, -9.0 tells the model to extrapolate from modeled values. I am hoping that we can all use the same initial and bottom boundary conditions. Please let me know if you have any problems with the prescribed values in the *.init files provided. If you have state variables for which *.init files are not provided, you will need to make your own files and can specify your own initial and boundary values. To modify your ecosystem specific routines: Create a src/eco_xx directory. As before, this is where your ecosystem specific routines will go. These routines can be modified as you wish. We have tried to revise the code such that the required modifications to your existing code will be as few as possible. The modifications required will be slightly different for everyone; however for guidance, I have outlined below the modifications required for the sample eco_4 code. Copy the following files from your Version 2 eco_4 directory to your Version 2 eco_x directory: Makefile input adj_params.in eco_params.in eco_derivs.f90 adeco_derivs.f90 Copy the following files from your Version 1 eco_x directory to your Version 2 eco_x directory: eco_common.f90 adeco_common.f90 eco_params.f90 derivs_mod.f90 adderivs_mod.f90 Six subroutines will require modifications: eco_common.f90 derivs_mod.f90 adderivs_mod.f90 eco_params.f90 eco_derivs.f90 adeco_derivs.f90 (Changes to adeco_common.f90 are probably not necessary, but this will depend on how this subroutine was modified from the eco_4 version.) ________________________________________________ eco_common.f90 1. Change: wnsv=(/ 0.0, 0.0, 32.0, 0.0 /), &! **Required** bbcnsv=(/ 0.0, 0.0, -9.0, 25.0/) ! **Required** to: wnsv=(/ 0.0, 0.0, 20.0, 0.0 /) 2. Change: aeonsv=0, &! **Required** HAnsv=0 ! **Required** to: aeonsv=0 ! **Required** (but not used) 3. Change: subroutine read_eco(...) to: subroutine read_eco_params(...) 4. Change: end subroutine read_eco to: end subroutine read_eco_params 5. Change: subroutine write_eco(bioparams) to: subroutine write_eco_params(bioparams,filename) 6. Remove: use common_mod, only : ecopar_fname 7. After '! Arguments' add: character(len=*) :: filename 8. Change: open(unit=ecopar_unit, file=trim(ecopar_fname)//'.new', status='replace') to: open(unit=ecopar_unit, file=trim(filename), status='replace') 9. Change: end subroutine write_eco to: end subroutine write_eco_params ________________________________________________ eco_params.f90 1. After nparams_bio is defined and before nparams_opt is defined, add parameter names that will be used as column headers in the output files. For example, for the eco_4 model these lines would be: !------------------------------------------------------------------------- ! ***Required*** param_names - names of parameters, will be used as column ! headers is ASCII output. !------------------------------------------------------------------------- character(len=20), dimension(nparams_bio), parameter :: param_names = (/ & "if0 ", & "iq0 ", & "irnt0 ", & "irphip ", & "ipgrowth ", & "igrazz ", & "ideathp ", & "iaz ", & "ian ", & "iremin "/) 2. Change the names of the initial condition files, e.g.: character(len=*),dimension(NumStateVar), parameter :: fname_bio_ic=(/ & to: character(len=*),dimension(NumStateVar), parameter :: fname_bio_suffix=(/ & 3. Change the names of the initial condition files, e.g.: 'AS_Chl.init ', & 'AS_Z.init ', & 'AS_D.init ', & 'AS_N.init ' /) to: 'Chl', & 'Z ', & 'D ', & 'N ' /) 4. Add 'get_opt_param_names' subroutine just before 'end module eco_params': contains subroutine get_opt_param_names(opt_param_names) implicit none character(len=20), dimension(nparams_opt), intent(out) :: opt_param_names integer(kind=int_kind) :: i do i=1,nparams_opt opt_param_names(i) = param_names(bio_opt_map(i)) end do end subroutine get_opt_param_names end module eco_params ________________________________________________ derivs_mod.f90 1. Add the use statement: use kinds_mod, only : dbl_kind, int_kind 2. If you use temperature,cdays or qi in your subroutine, you will need to change: use common_mod, only : cdays,Tdat,qi to: use forcing, only : cdays,Tdat,qi 3. Define arguments to be double-precision by changing: real y(NumStateVar), dydtt(NumStateVar), dydtt_diag(NumDiagVar) integer istep,iz real, dimension(:) :: bioparams to: real(kind=dbl_kind), dimension(:) :: y, dydtt, dydtt_diag integer(kind=int_kind) :: istep,iz real(kind=dbl_kind), dimension(:) :: bioparams 4. Define local variables to be double-precision by changing statements such as: real :: f0,q0,rnt0,rphip,pgrowth,grazz,deathp,az,deathz,an,remin to: real(kind=dbl_kind) :: f0,q0,rnt0,rphip,pgrowth,grazz,deathp,az,deathz,an,remin ________________________________________________ adderivs_mod.f90 1. Add the use statement: use kinds_mod, only : dbl_kind, int_kind 2. Change: use const, only : c1,secperday to: use const, only : c0,c1,secperday 3. If you use temperature in your subroutine, you will need to change: use common_mod, only : cdays,Tdat to: use forcing, only : cdays, Tdat 4. Define arguments to be double-precision by changing: real adbioparams(:) real addydtt(numstatevar) real addydtt_diag(numdiagvar) real ady(numstatevar) real bioparams(:) integer istep integer iz real y(numstatevar) to: real(kind=dbl_kind), dimension(:) :: bioparams,adbioparams real(kind=dbl_kind), dimension(:) :: addydtt,ady,y,addydtt_diag integer(kind=int_kind) :: istep,iz 5. Define local variables to be double-precision by changing statements such as: real dydtt(numstatevar) real dydtt_diag(numdiagvar) real adan real adaz to: real(kind=dbl_kind) dydtt(numstatevar) real(kind=dbl_kind) dydtt_diag(numdiagvar) real(kind=dbl_kind) adan real(kind=dbl_kind) adaz 6. Maintain double-precision consistency by changing statements such as: adan = 0. addydtt(init) = 0. to adan = c0 addydtt(init) = c0 ________________________________________________ eco_derivs.f90 The same changes that you made to your Version 1 eco_derivs.f90, will now need to be made to this updated Version 2 eco_derivs.f90. For your convenience I have included the Version 1 eco_derivs.f90 code for the eco_4 example model (eco_derivs_original.f90) in the eco_4 directory. Using a 'diff eco_derivs_original.f90 eco_derivs.f90' where the latter is the name of your ecosystem specific eco_derivs.f90 routine (Version 1) may be helpful here. If you want to see an example of the Version 2 code for a model with two size classes of phytoplankton, zooplankton and detritus, I can send you an example. Note that it may be most helpful to look back at the InstructionsPart2.doc that you followed to originally create your eco_derivs.f90 code. (If you completely rewrote the eco_derivs routine last time, I can help you make the necessary updates from Version 1 to Version 2 to your eco_derivs code; however, for most people I believe it may be simpler to start with the Version 2 eco_derivs code, and edit it just like before.) Note: 1. NumTimeSteps needs to be replaced with nt_max 2. The statements: real(kind=dbl_kind), dimension(ndat_max) :: nsed_pred nsed_pred=c0 nsed_pred(ised) = nsed_pred(ised) + c1 should be corrected to: real(kind=int_kind), dimension(ndat_max) :: nsed_pred nsed_pred=0 nsed_pred(ised) = nsed_pred(ised) + 1 ________________________________________________ adeco_derivs.f90 As above. ________________________________________________