fsd_build.f90 987 Bytes
Newer Older
Jérémy Baudry's avatar
Jérémy Baudry committed
1 2 3 4 5
subroutine fsd_build
use parameters

	implicit none
	double precision :: coeff
Jérémy Baudry's avatar
Jérémy Baudry committed
6 7
        double precision, allocatable :: ND(:),NN(:)
        integer :: M,mm
Jérémy Baudry's avatar
Jérémy Baudry committed
8

Jérémy Baudry's avatar
Jérémy Baudry committed
9 10 11 12 13 14 15
        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
                
Jérémy Baudry's avatar
Jérémy Baudry committed
16
	elseif (FSD_scheme.eq.1) then
Jérémy Baudry's avatar
Jérémy Baudry committed
17 18
	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))
Jérémy Baudry's avatar
Jérémy Baudry committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
        else

        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

Jérémy Baudry's avatar
Jérémy Baudry committed
41
        
Jérémy Baudry's avatar
Jérémy Baudry committed
42
      
Jérémy Baudry's avatar
Jérémy Baudry committed
43 44 45


end subroutine fsd_build