Changeset 346
- Timestamp:
- 04/30/21 19:25:36 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SOURCES/bmelt-beckmann-gcm_mod.f90
r339 r346 29 29 implicit none 30 30 31 integer, parameter :: n zoc = 40 !< number of vertical levels in the ocean32 integer , parameter :: nbassins = 10 !< number of vertical levels in the ocean31 integer, parameter :: nbassins = 10 !< number of sectors in the ocean 32 integer :: nzoc !< number of vertical levels in the ocean (read in netcdf T/S file) 33 33 real*8 :: coef_OM !combined coefficient by DeConto et Pollard (m/yr/C2) 34 34 real*8 :: K_t 35 35 real*8 :: n_tour 36 real*8, dimension (nx,ny,nzoc) :: temp_ocean , mask_oce2, temp_ocean_2 !< thermal forcing , input 37 real*8, dimension (nx,ny,nzoc) :: salinity_ocean !< thermal forcing , input 36 real*8, dimension (:,:,:), allocatable :: temp_ocean , mask_oce2, temp_ocean_2 !< thermal forcing , input 37 real*8, dimension (:,:,:), allocatable :: salinity_ocean !< thermal forcing , input 38 38 39 real :: bmelt_empty ! bmelt value for bassins without any GCM data 39 40 40 41 ! integer, dimension (nx,ny) :: profondeur 41 42 integer, dimension(nx,ny) :: bassin 42 real*8, dimension ( nzoc):: zoc !< depth of oceanic levels , input43 real*8, dimension (:), allocatable :: zoc !< depth of oceanic levels , input 43 44 real*8, dimension (nx,ny) :: mesh_area !< grid cell area 44 45 real*8, dimension (nx,ny) :: ice_draft !< ice draft (S-H) 45 46 character(len=200) :: TO_file, SO_file, Bassin_file ! fichiers de forcage 46 logical, dimension(n zoc) :: mask_bassin_vide ! mask true if bassin without any GCM data47 logical, dimension(nbassins) :: mask_bassin_vide ! mask true if bassin without any GCM data 47 48 48 49 contains … … 67 68 integer :: depth_max_grid ! max depth level were T S are defined (all grid) 68 69 integer, dimension(nx,ny) :: depth_max ! max depth were T S are defined for every point 69 integer, dimension( nx,ny,nzoc):: mask_gcm ! mask were T S are defined70 integer, dimension( nx,ny,nzoc):: mask_gcm_init ! mask were T S are defined in GCM before interpolation70 integer, dimension(:,:,:), allocatable :: mask_gcm ! mask were T S are defined 71 integer, dimension(:,:,:), allocatable :: mask_gcm_init ! mask were T S are defined in GCM before interpolation 71 72 integer, dimension(nbassins) :: max_depth_bassin ! max level were T S are defined for every bassins 72 73 integer :: nmax ! to avoid inifite loop 74 integer :: err 73 75 namelist/bmelt_beckmann_gcm_mod/TO_file,SO_file,Bassin_file,bmelt_empty 74 76 … … 82 84 83 85 file_inputs=TRIM(DIRNAMEINP)//'Snapshots-GCM/'//TRIM(TO_file) 86 87 ! read the number of levels in T/S files : 88 nzoc = read_nzoc(file_inputs) 89 ! print*, 'nzoc = ',nzoc 90 91 ! allocate tabs : 92 if (.not.allocated(zoc)) then 93 allocate(zoc(nzoc),stat=err) 94 if (err/=0) then 95 print *,"erreur a l'allocation du tableau zoc",err 96 stop 4 97 end if 98 end if 99 if (.not.allocated(temp_ocean)) then 100 allocate(temp_ocean(nx,ny,nzoc),stat=err) 101 if (err/=0) then 102 print *,"erreur a l'allocation du tableau temp_ocean",err 103 stop 4 104 end if 105 end if 106 if (.not.allocated(mask_oce2)) then 107 allocate(mask_oce2(nx,ny,nzoc),stat=err) 108 if (err/=0) then 109 print *,"erreur a l'allocation du tableau mask_oce2",err 110 stop 4 111 end if 112 end if 113 if (.not.allocated(temp_ocean_2)) then 114 allocate(temp_ocean_2(nx,ny,nzoc),stat=err) 115 if (err/=0) then 116 print *,"erreur a l'allocation du tableau temp_ocean_2",err 117 stop 4 118 end if 119 end if 120 if (.not.allocated(salinity_ocean)) then 121 allocate(salinity_ocean(nx,ny,nzoc),stat=err) 122 if (err/=0) then 123 print *,"erreur a l'allocation du tableau salinity_ocean",err 124 stop 4 125 end if 126 end if 127 if (.not.allocated(mask_gcm)) then 128 allocate(mask_gcm(nx,ny,nzoc),stat=err) 129 if (err/=0) then 130 print *,"erreur a l'allocation du tableau mask_gcm",err 131 stop 4 132 end if 133 end if 134 if (.not.allocated(mask_gcm_init)) then 135 allocate(mask_gcm_init(nx,ny,nzoc),stat=err) 136 if (err/=0) then 137 print *,"erreur a l'allocation du tableau mask_gcm_init",err 138 stop 4 139 end if 140 end if 141 84 142 call Read_Ncdf_var('lev',file_inputs,tab1d) 85 143 zoc(:) = -tab1d(:) … … 378 436 379 437 end subroutine bmeltshelf 438 439 function read_nzoc(filename) 440 ! Reads number of vertical levels in ocean forcing NetCDF File. 441 ! Returns the levels number 442 443 ! Reads 444 use netcdf 445 446 implicit none 447 ! input 448 character (len = *), intent(in) :: filename 449 integer :: read_nzoc 450 451 ! This will be the netCDF ID for the file and data variable. 452 integer :: ncid, varid, status 453 integer, dimension(3) :: count 454 integer, dimension(3) :: start 455 456 ! Open the file. 457 status = nf90_open(filename, nf90_nowrite, ncid) 458 if (status/=nf90_noerr) then 459 write(*,*)"unable to open netcdf file : ",filename 460 stop 461 endif 462 463 ! Get the varids of the netCDF variable. 464 status = nf90_inq_dimid(ncid, "lev", varid) 465 status = nf90_inquire_dimension(ncid, varid, len = read_nzoc) 466 467 ! Close the file. This frees up any internal netCDF resources 468 ! associated with the file. 469 status = nf90_close(ncid) 470 471 end function read_nzoc 472 380 473 end module bmelt_beckmann_gcm_mod
Note: See TracChangeset
for help on using the changeset viewer.