fsd_build.f90 2 KB

!________________________________________________________________________________

                        !DESCRIPTION: In this routine the average floe size
                        !Dave is computed using the value of Dmax calculated in
                        !the subroutine 'floe_breaking'. 

!________________________________________________________________________________



                        !INTERFACE:
                        subroutine fsd_build
                        
                        !MODULE USES:
                        use parameters
                        
                        !LOCAL PARAMETERS:
                        implicit none

                        double precision :: coeff
                        double precision, allocatable :: ND(:)
                        double precision, allocatable :: NN(:)
                        integer :: M
                        integer :: mm

!_________________________________________________________________________________

        if(C_ice(i).eq.0)then
        Dave(i)=0
        elseif (Dmax(i).eq.D0) then
        Dave(i)=Dmax(i)
        elseif (Dmax(i).eq.Dmin) then
        Dave(i)=Dmin
                
        elseif (FSD_scheme.eq.1) then   !use a power law to compute <D>
        coeff=1/((1/(1-gam))*(Dmax(i)**(1-gam)-Dmin**(1-gam)))
        Dave(i)=coeff*(1/(2-gam))*(Dmax(i)**(2-gam)-Dmin**(2-gam))

        else   !use the method from Dumont et al.(2011) to compute <D>
        
        M=floor(log(Dmax(i)/Dmin)/log(psi))
 
        allocate(ND(M+1))
        allocate(NN(M+1))
        jj=1
        do mm=0,M-1

        NN(jj)=((1-ff)*(psi**2*ff)**mm)*(Dmax(i)/psi**mm)
        ND(jj)=(1-ff)*(psi**2*ff)**mm
        jj=jj+1
                
        end do
        
        Dave(i)=(sum(NN)+((psi**2*ff)**M)*(Dmax(i)/psi**M))/(sum(ND)+(psi**2*ff)**M)

        deallocate(ND)
        deallocate(NN)
        
        end if

        
      
!_________________________________________________________________________________

end subroutine fsd_build