BIO_LAGRANGE.f90 7.65 KB
Newer Older
Jérémy Baudry's avatar
Jérémy Baudry committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

!=============================================================================!
!                                                                             !
!                    LAGRANGIAN CALCULATION OF PHYTOPLANKTON GROWTH           !
!                                                                             !
!                                                                             !
!       Description: In this routine, the light intensity at each depth is    !
!                    calculated using the surface irradiance calculated in    !
!                    the subroutine DAYLIGHT.f90 and decreases exponentially  !
!                    with the depth. The phytoplankton growth is then computed!
!                    in an Lagrangian framework using Monod's equations if    !
!                    bio_model=1 or Droop equations if bio_model=2.           !
!                                                                             !
!=============================================================================!


        subroutine light_growth

        use global_parameter                                                    !shared parameters


!____________________________________________________________________________
!                               LOCAL PARAMETERS
!____________________________________________________________________________

        IMPLICIT NONE

        integer                                 :: i
        integer                                 :: j
Jérémy Baudry's avatar
Jérémy Baudry committed
30
        integer                                 :: ii
Jérémy Baudry's avatar
Jérémy Baudry committed
31 32 33 34 35 36 37 38 39
        integer                                 :: a
        integer                                 :: div
        double precision, allocatable           :: dummy1(:)
        double precision, allocatable           :: light_level(:)
        double precision, allocatable           :: light_bin(:)
        double precision, allocatable           :: nb(:)
        double precision                        :: Pdmax=1
        double precision                        :: Idark=50      
        double precision, dimension(100000)     :: Fi
Jérémy Baudry's avatar
Jérémy Baudry committed
40
        double precision                        :: nb1
Jérémy Baudry's avatar
Jérémy Baudry committed
41 42 43 44 45 46 47 48 49 50

        allocate(light_level(Nlevel))
        allocate(dummy1(Nlevel))
        allocate(light_bin(Nbin))
        allocate(nb(Nbin))


        Fi(1:100000)=0
        div=0
        nb(1:Nbin)=0
Jérémy Baudry's avatar
Jérémy Baudry committed
51
        nb1=0d0
Jérémy Baudry's avatar
Jérémy Baudry committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88


!___________________________________________________________________________
!                               LIGHT
!___________________________________________________________________________


        light_level=rad*0.45*4.16*dexp(-k_bg*levels)                            !compute light intensity at each grid interface
        a=0                                                                     !
        do i=1,Nlevel                                                           !
        dummy1(Nlevel-a)=light_level(i)                                         !
        a=a+1                                                                   !
        end do                                                                  !
        light_level=dummy1                                                      !

        do i=1,Nbin                                                             !compute light intensity in each grid bin
        light_bin(i)=(light_level(i)+light_level(i+1))/2                        !
        end do                                                                  !


!___________________________________________________________________________
!                               GROWTH
!___________________________________________________________________________


        do i=1,nbpart

                bin=1+floor(z_cell(i)*z_res)                                            !find the bin where the particle is.
                uptlight(i)=Pdmax*(1d0-dexp(-light_bin(bin)/Idark))                     !compute P(I)

                if (bio_model.eq.1) then                                                ! Use Monod's equations

                Dphyto_lag(i)=(uptlight(i)*mu_max*(N_lag(bin)/(Kn+N_lag(bin))) -mortality)-mu_r                 !compute growth rate                 
                Nut_taken(bin)=Nut_taken(bin)+(uptlight(i)*mu_max*(N_lag(bin)/(Kn+N_lag(bin))))*q0*weight(i)    !nutrient taken
                weight_cell(i)=weight_cell(i)+Dphyto_lag(i)*time_step*weight_cell(i)                            !compute growth for each particle

                else                                                                    ! Use Droop's equations
Jérémy Baudry's avatar
Jérémy Baudry committed
89
             
Jérémy Baudry's avatar
Jérémy Baudry committed
90

Jérémy Baudry's avatar
Jérémy Baudry committed
91 92 93 94 95
                do ii=1,20
                if ((qlag(i).ge.Qcat(ii)).and.(qlag(i).le.Qcat(ii+1))) then
                 Q_distrib(bin,ii)=Q_distrib(bin,ii)+1
                end if
                end do
Jérémy Baudry's avatar
Jérémy Baudry committed
96 97 98 99 100 101 102
                Uptake_lag(i)=Vmax*(N_lag(bin)/(Kn+N_lag(bin)))*(1-qlag(i)/q_max)       ! nutrient uptake
                Nut_taken(bin)=Nut_taken(bin)+(Uptake_lag(i)-kw*qlag(i))*weight(i)      ! nutrient taken
                if (qlag(i).ge.q0) then                                                 !compute growth rate
                Dphyto_lag(i)=uptlight(i)*mu_max*(1-q0/qlag(i)) -mu_r
                else
                Dphyto_lag(i)=-mortality -mu_r
                end if
Jérémy Baudry's avatar
Jérémy Baudry committed
103 104 105 106 107 108
                 do ii=1,20
                if ((Dphyto_lag(i).ge.growthcat(ii)).and.(Dphyto_lag(i).le.growthcat(ii+1))) then
                 growth_distrib(bin,ii)=growth_distrib(bin,ii)+1
                end if
                end do

Jérémy Baudry's avatar
Jérémy Baudry committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
                qlag(i)=qlag(i)+(Uptake_lag(i)-kw*qlag(i)-Dphyto_lag(i)*qlag(i))*time_step      !change in cell quota
                weight_cell(i)=weight_cell(i)+Dphyto_lag(i)*time_step*weight_cell(i)            !compute growth for each particle

                end if


                if(weight_cell(i).gt.2d0*m0) then                                               !cell division
                S(i)=2*S(i)                                                                     !
                weight_cell(i)=weight_cell(i)*0.5                                               !
                end if                                                                          !
                weight(i)=S(i)*weight_cell(i)                                                   !


                if (part_management.eq.1) then                                                  !particle management
                if(S(i).gt.16*4e6) then                                                         !if 4 divisions
                div=div+1                                                                       ! Number of particle to be divided
                Fi(div)=i                                                                       ! save which particle to be divided
                end if                                                                          !
                end if                                                                          !

Jérémy Baudry's avatar
Jérémy Baudry committed
129
                nb1(bin)=nb1(bin)+1
Jérémy Baudry's avatar
Jérémy Baudry committed
130 131 132 133 134 135 136 137 138 139
                nb(bin)=nb(bin)+weight(i)
                binned_weight(bin)=binned_weight(bin)+weight(i)
                binned_Qlag(bin)=binned_Qlag(bin) + qlag(i)*weight(i)
                binned_growth(bin)=binned_growth(bin) + Dphyto_lag(i)*weight(i)


        end do


        do i=1,Nbin
Jérémy Baudry's avatar
Jérémy Baudry committed
140 141
        Q_distrib(i,:)=Q_distrib(i,:)/nb1(i)
        growth_distrib(i,:)=growth_distrib(i,:)/nb1(i)
Jérémy Baudry's avatar
Jérémy Baudry committed
142 143 144 145 146 147
        binned_Qlag(i)=binned_Qlag(i)/nb(i)
        binned_growth(i)=binned_growth(i)/nb(i)
        end do

        Nut_taken=Nut_taken/dz

Jérémy Baudry's avatar
Jérémy Baudry committed
148
        
Jérémy Baudry's avatar
Jérémy Baudry committed
149 150 151 152 153 154 155

        if (part_management.eq.1) then                                                          !particle management
        CALL PART_MGMT(div,Fi)
        end if

!=================================================================================
        end subroutine light_growth