1 | module climat_perturb_mois_lapsecouche_mod |
---|
2 | |
---|
3 | |
---|
4 | use module3d_phy |
---|
5 | implicit none |
---|
6 | |
---|
7 | integer nft ! nombre de lignes a lire dans le fichier forcage climatique |
---|
8 | real,dimension(:),allocatable :: tdate ! time for climate forcing |
---|
9 | real,dimension(:),allocatable :: tpert ! temperature for climate forcing |
---|
10 | real,dimension(:),allocatable :: spert ! sea surface perturbation |
---|
11 | |
---|
12 | real :: coefT ! pour modifier l'amplitude de la perturb. T |
---|
13 | real :: rappact ! pour le calcul du rapport 'accumulation |
---|
14 | integer :: retroac ! 1-> full retroactions accum |
---|
15 | real :: rapbmshelf ! pour calcul coefbmshelf |
---|
16 | real :: mincoefbmelt ! butoirs mini |
---|
17 | real :: maxcoefbmelt ! butoirs maxi de coefbmelt |
---|
18 | character(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 | |
---|
23 | contains |
---|
24 | |
---|
25 | !-------------------------------------------------------------------------------- |
---|
26 | subroutine input_clim !routine qui permet d'initialiser les variables climatiques |
---|
27 | |
---|
28 | implicit none |
---|
29 | character(len=8) :: control !label to check clim. forc. file (filin) is usable |
---|
30 | character(len=80):: filin |
---|
31 | |
---|
32 | |
---|
33 | ! Lecture du forcage |
---|
34 | !----------------------- |
---|
35 | ! Le fichier de forcage est lu dans le fichier entree parametres |
---|
36 | |
---|
37 | filin=trim(dirforcage)//trim(filforc) |
---|
38 | |
---|
39 | open(num_forc,file=filin,status='old') |
---|
40 | |
---|
41 | read(num_forc,*) control,nft |
---|
42 | |
---|
43 | ! Determination of file size (line nb), allocation of perturbation array |
---|
44 | |
---|
45 | if (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 |
---|
49 | endif |
---|
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 | |
---|
89 | do i=1,nft |
---|
90 | read(num_forc,*) tdate(i),spert(i),tpert(i) |
---|
91 | end do |
---|
92 | close(num_forc) |
---|
93 | |
---|
94 | tpert(:)=tpert(:)*coefT |
---|
95 | |
---|
96 | end subroutine input_clim |
---|
97 | |
---|
98 | !-------------------------------------------------------------------------------- |
---|
99 | subroutine init_forclim |
---|
100 | |
---|
101 | |
---|
102 | namelist/clim_pert/coefT,rappact,retroac,rapbmshelf,mincoefbmelt,maxcoefbmelt,filforc |
---|
103 | |
---|
104 | rewind(num_param) ! pour revenir au debut du fichier param_list.dat |
---|
105 | read(num_param,clim_pert) |
---|
106 | |
---|
107 | ! formats pour les ecritures dans 42 |
---|
108 | 428 format(A) |
---|
109 | |
---|
110 | write(num_rep_42,428)'!___________________________________________________________' |
---|
111 | write(num_rep_42,428) '&clim_pert ! module climat_perturb_mod ' |
---|
112 | write(num_rep_42,*) |
---|
113 | write(num_rep_42,*) 'coefT = ', coefT |
---|
114 | write(num_rep_42,*) 'rappact = ', rappact |
---|
115 | write(num_rep_42,*) 'rretroac = ', retroac |
---|
116 | write(num_rep_42,*) 'rapbmshelf = ', rapbmshelf |
---|
117 | write(num_rep_42,*) 'mincoefbmelt = ', mincoefbmelt |
---|
118 | write(num_rep_42,*) 'maxcoefbmelt = ', maxcoefbmelt |
---|
119 | write(num_rep_42,'(A,A)') ' filforc = ', filforc |
---|
120 | write(num_rep_42,*)'/' |
---|
121 | write(num_rep_42,*) |
---|
122 | |
---|
123 | return |
---|
124 | end subroutine init_forclim |
---|
125 | |
---|
126 | !-------------------------------------------------------------------------------- |
---|
127 | subroutine 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 | |
---|
132 | use module3d_phy |
---|
133 | implicit none |
---|
134 | |
---|
135 | ! time en dehors des limites du fichier forcage |
---|
136 | if(time.lt.tdate(1)) then |
---|
137 | tafor=tpert(1) |
---|
138 | sealevel=spert(1) |
---|
139 | ift=1 |
---|
140 | |
---|
141 | else if (time.ge.tdate(nft)) then |
---|
142 | tafor=tpert(nft) |
---|
143 | sealevel=spert(nft) |
---|
144 | ift=nft |
---|
145 | |
---|
146 | else |
---|
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 |
---|
157 | endif |
---|
158 | 100 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 | |
---|
166 | if ((tafor.le.0).and.(tafor.gt.-5.)) then |
---|
167 | coefbmshelf=(1.+tafor/rapbmshelf) ! coefbmshelf=0 pour tafor=-7 standard precedent |
---|
168 | |
---|
169 | else if (tafor.le.-5) then ! lineaire en 0 a -10 et la valeur a -5 |
---|
170 | coefbmshelf=(1.-5./rapbmshelf)/5.*(tafor+10) |
---|
171 | |
---|
172 | else |
---|
173 | coefbmshelf=(1.+5.*tafor/rapbmshelf) ! 5 fois plus efficace vers le chaud |
---|
174 | endif |
---|
175 | |
---|
176 | coefbmshelf=max(coefbmshelf,mincoefbmelt) |
---|
177 | coefbmshelf=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 | |
---|
189 | end subroutine forclim |
---|
190 | |
---|
191 | end module climat_perturb_mois_lapsecouche_mod |
---|
192 | |
---|