source: trunk/SOURCES/Old-sources/lect-Ant_CISM_gen_dat.f90 @ 334

Last change on this file since 334 was 236, checked in by aquiquet, 5 years ago

Deprecated modules moved to Old-sources

File size: 5.9 KB
Line 
1!> \file lect-Ant_CISM_gen_dat.f90
2!!Module pour la lecture de la topographie
3!<
4
5!> \namespace lect_topo_ant_CISM_gen
6!! Module pour la lecture de la topographie
7!! \author ...
8!! \date ...
9!! @note Used module
10!! @note   - use module3D_phy
11!! @note   - use param_phy_mod
12!<
13
14module lect_topo_ant_CISM_gen
15
16use module3D_phy
17use param_phy_mod
18use interface_input
19character(len=100) :: topo_surf      !< surface
20character(len=100) :: correc_surf    !< ice-real correction
21character(len=100) :: topo_thick     !< thickness
22character(len=100) :: topo_bed       !< bedrock
23character(len=100) :: mask_grounded  !< mask
24character(len=100) :: longitude      !< longitude
25character(len=100) :: latitude       !< latitude
26character(len=100) :: heatflux       !< geothermal heat flux
27logical            :: corr_firn      !< eventuellement correction firn (deja fait dans Le Brocq)
28real,dimension(nx,ny) :: work_tab         
29Character(len=100) :: file_ncdf      !< fichier netcdf issue des fichiers .dat
30
31contains
32
33  subroutine input_topo
34
35    namelist/topo_CISM_gen/topo_surf,correc_surf,topo_thick,topo_bed,mask_grounded,longitude,latitude,heatflux
36    if (itracebug.eq.1)  call tracebug(' Entree dans routine input_topo')
37
38428 format(A)
39
40    rewind(num_param)                     ! pour revenir au debut du fichier param_list.dat
41    read(num_param,topo_CISM_gen)
42
43    write(num_rep_42,428)'!___________________________________________________________' 
44    write(num_rep_42,428)'!  module  lect_topo_ant_CISM                               '
45    write(num_rep_42,topo_CISM_gen)
46    write(num_rep_42,428)'!___________________________________________________________' 
47
48
49    if ((trim(correc_surf).eq.'no').or.(trim(correc_surf).eq.'NO')) then
50       corr_firn=.false.
51    else
52       corr_firn=.true.
53    end if
54
55    topo_surf     = trim(dirnameinp)//trim(topo_surf)
56    correc_surf   = trim(dirnameinp)//trim(correc_surf)
57    topo_thick    = trim(dirnameinp)//trim(topo_thick)
58    topo_bed      = trim(dirnameinp)//trim(topo_bed)
59    mask_grounded = trim(dirnameinp)//trim(mask_grounded)
60    longitude     = trim(dirnameinp)//trim(longitude)
61    latitude      = trim(dirnameinp)//trim(latitude)
62    heatflux      = trim(dirnameinp)//trim(heatflux)
63
64    ! Transformation des fichiers .dat en .nc
65
66    file_ncdf= trim(dirnameinp)//trim(runname)//'.nc'
67
68    call lect_input(3,'Bsoc',1,Bsoc,topo_bed,file_ncdf)
69    ! lecture adaptee aux fichiers ZBL.dat
70    !call lect_datfile(nx,ny,Bsoc,1,topo_bed)               ! bedrock
71
72    Bsoc0(:,:) = Bsoc(:,:)
73
74    call lect_input(3,'S',1,S,topo_surf,file_ncdf)
75    !call lect_datfile(nx,ny,S,1,topo_surf)                 ! surface
76
77
78    call lect_input(3,'H',1,H,topo_thick,file_ncdf)
79    !call lect_datfile(nx,ny,H,1,topo_thick)                ! thickness
80
81if (itracebug.eq.1)  call tracebug(' avant corr firn')
82
83    if (corr_firn) then                                    ! density correction
84       !call lect_datfile(nx,ny,work_tab,1,correc_surf)    ! for CISM files but not
85       ! Cat treatment of Le Brocq
86       ! already done
87if (itracebug.eq.1)  call tracebug(' apres corr firn')
88       call lect_input(3,'work_tab1',1,work_tab,correc_surf,file_ncdf)
89
90       where (H(:,:).gt.0.)
91          work_tab(:,:)=min(H(:,:),work_tab(:,:))   
92          S(:,:) = S(:,:) - work_tab(:,:)                  ! corrected surface
93          H(:,:) = H(:,:) - work_tab(:,:)                  ! corrected thickness
94       end where
95    end if
96    H(:,:)=max(0.,H(:,:))
97    H0(:,:)= H(:,:)
98    S0(:,:)= S(:,:)
99
100!!$call lect_datfile(nx,ny,work_tab,1,mask_grounded)   ! masque
101!!$mk0(:,:) = int(work_tab)
102    mk0(:,:)=0.
103
104    call lect_input(3,'work_tab2',2,work_tab,mask_grounded,file_ncdf)
105    !call lect_datfile(nx,ny,work_tab,2,mask_grounded)    ! masque
106
107    ! On lit la colonne 2 : 0 pour la glace 1 ailleurs y compris les iles qu'on veut enlever
108    ! ij_grisli2mask.sh points-iles-a-enlever.dat
109
110    ! Le masque iceberg est 0 quand glace et 1 quand mer (evite des incoherences sur les iles)
111    ! ce masque est fait en bricolant le *berg.nc
112if (itracebug.eq.1)  call tracebug(' avant worktab')
113
114
115    mk0(:,:)=work_tab(:,:)
116
117! bloc pour enlever les iles : merde sur les outcrop
118where ((mk0(:,:).eq.1).and.(H(:,:).gt.1.))
119   H(:,:)=0.
120   S(:,:)=0.
121   Bsoc(:,:)=min(Bsoc(:,:),-100.)
122   B(:,:)=0.
123end where
124   Bsoc0(:,:) = Bsoc(:,:)
125   H0(:,:)= H(:,:)
126   S0(:,:)= S(:,:)
127
128  if (itracebug.eq.1)  call tracebug(' apres worktab')
129
130
131    write(266,*) 'petite ile qui merde'
132    do j=227,224,-1
133       write(266,*) (H(i,j),i=43,46)
134    end do
135    write(266,*) 'socle'
136    do j=227,224,-1
137       write(266,*) (Bsoc(i,j),i=43,46)
138    end do
139
140
141! pour l'Antarctique masque mko vrai partout (version 2006)
142 MK0(:,:)=1  ! mis apres la lecture cptr
143
144
145    ! determination des flot
146    do j=1,ny
147       do i=1,nx
148          if ((Bsoc(i,j)+H(i,j)*ro/row -sealevel).lt.0.) then
149             flot(i,j)=.true.
150          else
151             flot(i,j)=.false.
152          endif
153       enddo
154    enddo
155
156    ! le calcul des courbures du socle devrait etre dans le dragging
157
158    call lect_input(1,'Xlong',1,Xlong,longitude,file_ncdf)
159    !call lect_datfile(nx,ny,Xlong,1,longitude)      ! lecture des coordonnées geographiques
160   
161    call lect_input(1,'Ylat',1,Ylat,latitude,file_ncdf)
162    !call lect_datfile(nx,ny,Ylat,1,latitude)        !
163
164    open(22,file=longitude)                         ! juste pour avoir l'en tete
165    read(22,*) i,i,xmin,xmax,ymin,ymax
166    xmin=xmin/1000.
167    ymin=ymin/1000.
168    xmax=xmax/1000.
169    ymax=ymax/1000.
170    close(22)
171
172
173    call lect_input(1,'ghf',1,ghf,heatflux,file_ncdf)
174    !call lect_datfile(nx,ny,ghf,1,heatflux)
175 
176    ! for the purposes of SeaRISE, GTHF should be capped at a value of -0.07 w/m^2,
177    ! and the field provided in the netCDF file does not include these updated values
178
179    ghf(:,:)=min(ghf(:,:),0.07)
180
181    ! pour passer les flux des W/m2 au J/m2/an     
182    ghf(:,:)=-SECYEAR*ghf(:,:)
183    ghf0(:,:)=ghf(:,:)
184
185  end subroutine input_topo
186
187
188end module lect_topo_ant_CISM_gen
189
Note: See TracBrowser for help on using the repository browser.