source: trunk/SOURCES/climat-perturb-mois_lapsecouche_mod.F90 @ 23

Last change on this file since 23 was 4, checked in by dumas, 10 years ago

initial import GRISLI trunk

File size: 5.4 KB
Line 
1module  climat_perturb_mois_lapsecouche_mod
2
3
4use module3d_phy
5implicit none
6
7integer nft             ! nombre de lignes a lire dans le fichier forcage climatique
8real,dimension(:),allocatable :: tdate          ! time for climate forcing
9real,dimension(:),allocatable :: tpert          ! temperature for climate forcing
10real,dimension(:),allocatable :: spert          ! sea surface perturbation
11
12real :: coefT                   ! pour modifier l'amplitude de la perturb. T
13real :: rappact                 ! pour le calcul du rapport 'accumulation
14integer :: retroac              ! 1-> full retroactions accum
15real :: rapbmshelf              ! pour calcul coefbmshelf
16real :: mincoefbmelt            ! butoirs mini
17real :: maxcoefbmelt            ! butoirs maxi de coefbmelt
18character(len=80) :: filforc    ! nom du fichier forcage
19
20! Pour l'instant tafor est global meme si inutile si on utilise
21! un forcage  (variation spatiales)
22
23contains
24
25!--------------------------------------------------------------------------------
26subroutine input_clim !routine qui permet d'initialiser les variables climatiques
27
28implicit none
29character(len=8) :: control      !label to check clim. forc. file (filin) is usable
30character(len=80):: filin
31
32
33! Lecture du forcage
34!-----------------------
35! Le fichier de forcage est lu dans le fichier entree parametres
36
37filin=trim(dirforcage)//trim(filforc)
38
39open(num_forc,file=filin,status='old')
40
41read(num_forc,*) control,nft
42
43! Determination of file size (line nb), allocation of perturbation array
44
45if (control.ne.'nb_lines') then
46   write(6,*) filin,'indiquer le nb de ligne en debut de fichier:'
47   write(6,*) 'le nb de lignes et le label de control nb_lines'
48   stop
49endif
50
51! Dimensionnement des tableaux tdate, ....
52#if defined key_agrif
53   if (.not.associated(tdate)) then
54#else
55   if (.not.allocated(tdate)) then
56#endif
57
58      allocate(tdate(nft),stat=err)
59      if (err/=0) then
60         print *,"erreur a l'allocation du tableau Tdate",err
61         stop 4
62      end if
63   end if
64
65#if defined key_agrif
66  if (.not.associated(spert)) then
67#else
68  if (.not.allocated(spert)) then
69#endif
70     allocate(spert(nft),stat=err)
71     if (err/=0) then
72        print *,"erreur a l'allocation du tableau Spert",err
73        stop 4
74     end if
75  end if
76
77#if defined key_agrif
78  if (.not.associated(tpert)) then
79#else
80  if (.not.allocated(tpert)) then
81#endif
82     allocate(tpert(nft),stat=err)
83     if (err/=0) then
84        print *,"erreur a l'allocation du tableau Tpert",err
85        stop 4
86     end if
87  end if
88
89do i=1,nft
90   read(num_forc,*) tdate(i),spert(i),tpert(i)
91end do
92close(num_forc)
93
94tpert(:)=tpert(:)*coefT
95
96end subroutine input_clim
97
98!--------------------------------------------------------------------------------
99subroutine init_forclim
100
101
102namelist/clim_pert/coefT,rappact,retroac,rapbmshelf,mincoefbmelt,maxcoefbmelt,filforc
103
104rewind(num_param)        ! pour revenir au debut du fichier param_list.dat
105read(num_param,clim_pert)
106
107! formats pour les ecritures dans 42
108428 format(A)
109
110write(num_rep_42,428)'!___________________________________________________________' 
111write(num_rep_42,428) '&clim_pert                      ! module climat_perturb_mod '
112write(num_rep_42,*)
113write(num_rep_42,*) 'coefT        = ', coefT 
114write(num_rep_42,*) 'rappact      = ', rappact 
115write(num_rep_42,*) 'rretroac     = ', retroac 
116write(num_rep_42,*) 'rapbmshelf   = ', rapbmshelf 
117write(num_rep_42,*) 'mincoefbmelt = ', mincoefbmelt
118write(num_rep_42,*) 'maxcoefbmelt = ', maxcoefbmelt
119write(num_rep_42,'(A,A)') ' filforc      = ', filforc
120write(num_rep_42,*)'/'                           
121write(num_rep_42,*)
122
123return
124end subroutine init_forclim
125
126!--------------------------------------------------------------------------------
127subroutine forclim               !  au temps considere (time) attribue les scalaires
128                                 !  tafor : forcage en temperature
129                                 !  sealevel : forcage niveau des mers
130                                 !  coefbmelt : forcage fusion basale ice shelves
131
132use module3d_phy
133implicit none
134
135!       time en dehors des limites du fichier forcage
136if(time.lt.tdate(1)) then
137   tafor=tpert(1)
138   sealevel=spert(1)
139   ift=1
140
141else if (time.ge.tdate(nft)) then
142   tafor=tpert(nft)
143   sealevel=spert(nft)
144   ift=nft
145
146else
147   do i=1,nft-1 
148      if((time.ge.tdate(i)).and.(time.lt.tdate(i+1))) then ! entre i et i+1 : cas general
149         tafor=tpert(i)+(tpert(i+1)-tpert(i))*       &
150              (time-tdate(i))/(tdate(i+1)-tdate(i))
151         sealevel=spert(i)+(spert(i+1)-spert(i))*    &
152              (time-tdate(i))/(tdate(i+1)-tdate(i))
153         ift=i
154         goto 100
155      endif
156   end do
157endif
158100   continue
159
160       
161!  coefmshelf est un coefficient qui fait varier bmgrz et bmshelf
162!  en fonction de tafor
163
164!   coefbmshelf=(1.+tafor/10.)           ! coefbmshelf=0 pour tafor=-10deg
165
166if ((tafor.le.0).and.(tafor.gt.-5.)) then
167   coefbmshelf=(1.+tafor/rapbmshelf)     ! coefbmshelf=0 pour tafor=-7 standard precedent
168
169else if (tafor.le.-5) then               ! lineaire en 0 a -10 et la valeur a -5
170   coefbmshelf=(1.-5./rapbmshelf)/5.*(tafor+10)
171
172else
173   coefbmshelf=(1.+5.*tafor/rapbmshelf)  ! 5 fois plus efficace vers le chaud
174endif
175
176coefbmshelf=max(coefbmshelf,mincoefbmelt) 
177coefbmshelf=min(coefbmshelf,maxcoefbmelt)
178
179#if defined key_agrif
180   if ( .not. agrif_root() ) then
181      geoplace = agrif_parent(geoplace)
182   endif
183#endif
184
185
186
187   call massb_perturb_mois_lapsecouche
188
189end subroutine forclim
190
191end module  climat_perturb_mois_lapsecouche_mod
192
Note: See TracBrowser for help on using the repository browser.