MODULE_PARAMETERS.f90 13.2 KB

!=================================================================================!
!                                                                                 !
!				GLOBAL PARAMETER                                  !
!                                                                                 !
!       Description: Here is the declaration of all parameter shared for each     !
!                    subroutines. It contains the subroutine for read the value   ! 
!                    of parameter from the namelist and the subroutine for        !
!                    allocate  the arrays                                         !
!                                                                                 !
!=================================================================================!



        MODULE global_parameter

        IMPLICIT NONE

!_________________________________________________________________________________
!                               TIME PARAMETERS
!_________________________________________________________________________________

        integer                         :: hour                         !for the clock
        integer                         :: time_step=6d0                !time step
        integer                         :: ndays=1d0                    !number of days ofsimulation
        integer                         :: nsteps                       !number of steps of simulation
        integer                         :: time                         !for the clock
        integer                         :: nsteps_hr                    !number of steps in an hour
        integer                         :: nsteps_d                     !number of steps in a day
        integer                         :: nsteps_min                   !number of steps in a minute
        integer                         :: day                          !for the clock
        integer                         :: output_time=100              !number of step for output
        integer                         :: minute                       !for the clock
        integer                         :: L_time                       !length of output file
        double precision, allocatable   :: time_vec(:)                     !time vector

!_________________________________________________________________________________
!                              SPACE PARAMETERS
!_________________________________________________________________________________

        double precision                :: depth=40d0                   !depth of the water column [m]
        double precision                :: dz=0.1d0                     !spatial resolution [m]
        integer                         :: Nlevel                       !number of grid interfaces
        integer                         :: Nbin                         !number of grid bin
        integer                         :: z_res
        integer                         :: bin
        double precision, allocatable   :: levels(:)

!_________________________________________________________________________________
!                              OUTPUTS
!_________________________________________________________________________________
        character(len=100)              :: root
        character(len=100)              :: conc_euler
        character(len=100)              :: radiation
        character(len=100)              :: histlight
        character(len=100)              :: weightpart
        character(len=100)              :: turb
        character(len=100)              :: binnedweight
        character(len=100)              :: nutlagrange
        character(len=100)              :: nuteuler
        character(len=100)              :: name_exp='test'
        character(len=400)              :: path
        character(len=400)              :: path2
        character(len=400)              :: Qeuler
        character(len=400)              :: Qlagrange
        character(len=400)              :: growth_eul
        character(len=400)              :: growth_lag
        character(len=400)              :: time_vector
        character(len=400)              :: depth_vector



!________________________________________________________________________________
!                               DIFFUSIVITY
!________________________________________________________________________________


        double precision                :: K_value=1d-4                 !value of diffusivity if uniform
        integer                         :: mix_state=0                  !choose if diff uniform or from GOTM
        double precision, allocatable   :: K(:)                         !diffusivity profil
        double precision, allocatable   :: KK_lev(:)
        double precision, allocatable   :: KK(:,:,:,:)                  !diffusivity profile from GOTM before interpolate
        integer                         :: length3
        integer                         :: flg

!________________________________________________________________________________
!                                LIGHT
!________________________________________________________________________________                             

        double precision                :: day_length=16
        double precision                :: rad_max=600
        double precision                :: freq
        double precision                :: rad
        double precision                :: k_bg=1.1
        double precision, allocatable   :: light(:)

!________________________________________________________________________________
!                                PARTICLES
!________________________________________________________________________________                              
        
        double precision                :: z_0=10d0
        integer                         :: particle_distribution=2
        double precision, allocatable   :: binned_pos(:)
        integer                         :: part_management=1
        double precision, allocatable   :: z_cell(:)
        integer                         :: nbpart=1000

!________________________________________________________________________________
!                                 BIO
!________________________________________________________________________________  

        double precision                :: w_s=2.3148e-06
        double precision                :: mortality=0.00006944
        double precision                :: Nutrient_0=6
        double precision                :: Nutrient_1=2
        double precision                :: Nutrient_2=2
        integer                         :: nut_profile=1
        integer                         :: nut_relax=1
        double precision                :: nut_layer=10
        double precision                :: bottom_flux=1e-6
        double precision, allocatable   :: N_init(:)
        double precision, allocatable   :: weight(:)
        double precision, allocatable   :: binned_weight(:)
        double precision, allocatable   :: Uptake_eul(:)
        double precision, allocatable   :: q(:)
        double precision, allocatable   :: N_euler(:)
        double precision, allocatable   :: binned_growth(:),euler(:)
        double precision                :: Qmax=0.28
        double precision                :: Kn=3
        double precision                :: Qmin=0.056
        double precision                :: Vmax=0
        double precision, allocatable   :: N_lag(:)
        double precision, allocatable   :: Uptake_lag(:)
        double precision, allocatable   :: Qlag(:)
        double precision, allocatable   :: Nut_taken(:)
        double precision, allocatable   :: binned_Qlag(:)
        double precision, allocatable   :: Dphyto_lag(:)
        double precision, allocatable   :: growlight(:)
        double precision                :: m0=1e-12
        double precision, allocatable   :: uptlight(:)
        double precision, allocatable   :: grow(:)
        double precision, allocatable   :: Nut(:)
        integer                         :: bio_model=2
        integer                         :: bio_calc=1
        double precision                :: mu_max=1
        double precision                :: q0=1
        double precision                :: mu_r=1e-06
        double precision                :: kw=1e-05
        double precision                :: q_max=5e-03
        double precision, allocatable   :: S(:)
        double precision, allocatable   :: weight_cell(:)
        double precision, allocatable   :: Q_distrib(:,:)
        double precision, allocatable   :: Q_distrib2(:,:,:)
        double precision, allocatable   :: Qcat(:)
        double precision, allocatable   :: growthcat(:)
        double precision, allocatable   :: growth_distrib(:,:)
        double precision, allocatable   :: growth_distrib2(:,:,:)
        double precision, allocatable   :: Ncell(:),Ncell_lag(:)
        double precision                :: Il=50
        double precision                :: Plmax=0.5
        double precision                :: Ib=150
        double precision, allocatable   :: CL(:),CL_lag(:),Clquot_ACC(:)
        double precision                :: tau=16000
        integer                         :: photo_model=1

        !_________________MODEL_3_________________________
        double precision, allocatable   :: uptake_dist(:)
        double precision, allocatable   :: q_cat(:)
        double precision, allocatable   :: q_edge(:)
        double precision, allocatable   :: q_to_mu(:)
        double precision, allocatable   :: q_dist(:,:)
        double precision, allocatable   :: q_to_newq(:)
        double precision, allocatable   :: mu_dist(:,:)
        double precision, allocatable   :: mu_cat(:)
        double precision, allocatable   :: mu_edge(:)
        double precision, allocatable   :: mu_dist2(:,:,:)
        double precision, allocatable   :: q_dist2(:,:,:)
        integer                         :: Ncat=200

        contains
!____________________________________________________________________________
!                       READ PARAMETER VALUES FRON NAMELISTS
!____________________________________________________________________________

        subroutine read_namelist
        

        namelist /model_parameter_nml/ name_exp,depth,dz,K_value,time_step,ndays, &
                                      output_time,mix_state,particle_distribution, &
                                       nbpart,z_0,day_length,rad_max,k_bg

        namelist /bio_parameter_nml/ bio_calc,bio_model,mu_max,q0,mortality, &
                                     Kn,Vmax,nut_profile,nut_layer,Nutrient_0, &
                                     Nutrient_1,Nutrient_2,bottom_flux,nut_relax, &
                                     w_s,part_management,mu_r,kw,q_max,m0,photo_model

        open(14,file='nml/model_parameter.nml',status='old')
        read(14,nml=model_parameter_nml)
        close(14)


        open(54,file='nml/bio_parameter.nml',status='old')
        read(54,nml=bio_parameter_nml)
        close(54)


!____________________________________________________________________________
        end subroutine read_namelist

!____________________________________________________________________________
!                       ALLOCATE ARRAYS
!____________________________________________________________________________




        subroutine allocation

        nsteps_min=60d0/time_step
        nsteps=INT((ndays*86400d0)/time_step)
        nsteps_hr=INT(3600d0/time_step)
        nsteps_d=INT(86400d0/time_step)
        Nlevel=INT(depth/dz)+1
        Nbin=Nlevel-1
        z_res=INT(Nbin/depth)
        L_time=INT(nsteps/output_time)+1
       
        allocate(levels(Nlevel))
        allocate(weight(nbpart))
        allocate(z_cell(nbpart))
        allocate(light(nbpart))
        allocate(binned_pos(Nbin))
        allocate(binned_weight(Nbin))
        allocate(euler(Nbin))
        allocate(K(Nlevel))
        allocate(Uptake_eul(Nbin))
        allocate(q(Nbin))
        allocate(N_init(Nbin))
        allocate(N_euler(Nbin))
        allocate(N_lag(Nbin))
        allocate(Uptake_lag(nbpart))
        allocate(qlag(nbpart))
        allocate(Nut_taken(Nbin))
        allocate(binned_Qlag(Nbin))
        allocate(Dphyto_lag(nbpart))
        allocate(growlight(Nbin))
        allocate(uptlight(nbpart))
        allocate(weight_cell(nbpart))
        allocate(S(nbpart))
        allocate(grow(Nbin))
        allocate(Nut(Nbin))
        allocate(binned_growth(Nbin))
        allocate(time_vec(L_time))
        allocate(Q_distrib(Nbin,Ncat))
        allocate(Q_distrib2(Nbin,Ncat,L_time))
        allocate(growth_distrib(Nbin,Ncat))
        allocate(growth_distrib2(Nbin,Ncat,L_time))
        allocate(q_dist2(Nbin,Ncat,L_time))
        allocate(mu_dist2(Nbin,Ncat,L_time))
        allocate(q_dist(Nbin,Ncat))
        allocate(mu_dist(Nbin,Ncat))
        allocate(Ncell(Nbin))
        allocate(Ncell_lag(nbpart))
        allocate(Qcat(Ncat+1))
        allocate(growthcat(Ncat+1))
        allocate(mu_edge(Ncat+1))
        allocate(mu_cat(Ncat))
        allocate(q_to_newq(Ncat))
        allocate(q_to_mu(Ncat))
        allocate(q_edge(Ncat+1))
        allocate(q_cat(Ncat))
        allocate(uptake_dist(Ncat))
        allocate(CL(Nbin))
        allocate(CL_lag(nbpart))
        allocate(Clquot_ACC(Nbin))

        end subroutine


!=================================================================================
        END MODULE