Changeset 115 for trunk


Ignore:
Timestamp:
06/20/17 14:46:35 (7 years ago)
Author:
dumas
Message:

New subroutine lect_vitbil_Lebrocq : choose between lect_vitbil and lect_vitbil_Lebrocq with type_vitbil flag in param_list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SOURCES/spinup_mod.f90

    r65 r115  
    2323  use deformation_mod_2lois 
    2424  use interface_input 
     25  use io_netcdf_grisli 
     26   
    2527  implicit none 
    2628 
     
    3941  real, dimension(nx,ny) :: Vsl_x             !< 
    4042  real, dimension(nx,ny) :: Vsl_y             !< 
     43   
     44  integer :: type_vitbil ! defini le type de fichier a lire : lect_vitbil ou lect_vitbil_Lebrocq 
    4145 
    4246contains 
     
    4751  !< 
    4852  subroutine init_spinup 
    49   namelist/spinup/ispinup 
     53  namelist/spinup/ispinup,type_vitbil 
    5054 
    5155    ! put here which type of spinup 
     
    7983write(num_rep_42,*)'! ispinup = 2     conservation de la masse avec vitesses bilan ' 
    8084write(num_rep_42,*)'! ispinup = 3     equilibre temperature avec vitesses bilan' 
     85write(num_rep_42,*)'! type_vitbil type de lecture des vitesses de bilan 1: lect_vitbil, 2 : lect_vitbil_Lebrocq' 
    8186write(num_rep_42,*) 
    8287 
     
    8893endif 
    8994 
    90  
    91     call lect_vitbil 
     95select case (type_vitbil) 
     96case (1) 
     97!cdc Methode Cat lecture fichier selon x et y sur grille stag 
     98  call lect_vitbil 
     99case(2) 
     100!cdc Methode Tof lecture fichier Lebrocq vitesse et direction 
     101  call lect_vitbil_Lebrocq 
     102case default 
     103  print*,'type_vitbil valeur invalide dans spinup_vitbil' 
     104end select 
    92105 
    93106    if (itracebug.eq.1)  call tracebug(' fin routine init_spinup de spinup_vitbil') 
     
    96109  subroutine lect_vitbil 
    97110 
    98  
    99111    character(len=100) :: balance_Ux_file        !  balance velocity file Ux 
    100112    character(len=100) :: balance_Uy_file        !  balance velocity file Uy 
    101  
     113          real*8, dimension(:,:),   pointer    :: tab               !< tableau 2d real pointer 
     114           
    102115    namelist/vitbil_upwind/balance_Ux_file, balance_Uy_file   
    103116 
     
    122135    balance_Ux_file = trim(dirnameinp)//trim(balance_Ux_file) 
    123136    balance_Uy_file = trim(dirnameinp)//trim(balance_Uy_file) 
    124  
    125     call lect_input(1,'Vcol_x',1,Vcol_x,balance_Ux_file,"") 
    126     call lect_input(1,'Vcol_y',1,Vcol_y,balance_Uy_file,"") 
     137     
     138    call Read_Ncdf_var('Vcol_x',balance_Ux_file,tab) 
     139    Vcol_x(:,:)=tab(:,:) 
     140    call Read_Ncdf_var('Vcol_y',balance_Uy_file,tab) 
     141    Vcol_y(:,:)=tab(:,:) 
    127142 
    128143!    call lect_input(2,'Vcol',1,Vcol_x,balance_vel_file,trim(dirnameinp)//trim(runname)//'.nc')  !read Vcol_x 
     
    135150 
    136151  end subroutine lect_vitbil 
     152   
     153  subroutine lect_vitbil_Lebrocq 
     154 
     155 
     156    character(len=100) :: vit_balance_file        !  balance velocity file 
     157    character(len=100) :: flowdir_balance_file    !  balance flow direction file 
     158    real*8, dimension(:,:),   pointer    :: tab               !< tableau 2d real pointer 
     159    real, dimension(nx,ny) :: V_Lebrocq           !< vertically averaged velocity (balance) 
     160    real, dimension(nx,ny) :: flowdir_Lebrocq     !< flow direction (degree) 
     161    real, dimension(nx,ny) :: Vx_Lebrocq, Vy_Lebrocq ! vitesses selon x et y 
     162     
     163    namelist/vitbil_Lebrocq/vit_balance_file, flowdir_balance_file   
     164 
     165    if (itracebug.eq.1)  call tracebug(' Subroutine lect_vitbil_Lebrocq')  
     166 
     167    ! lecture des parametres du run                     
     168    !-------------------------------------------------------------------- 
     169 
     170    rewind(num_param)        ! pour revenir au debut du fichier param_list.dat 
     171428 format(A) 
     172    read(num_param,vitbil_Lebrocq) 
     173 
     174    write(num_rep_42,428) '!___________________________________________________________'  
     175    write(num_rep_42,428) '!read balance velocities from Lebrocq code' 
     176    write(num_rep_42,vitbil_Lebrocq)                     
     177    write(num_rep_42,428) '! vit_balance_file : balance velocity file' 
     178    write(num_rep_42,428) '! flowdir_balance_file : balance flow direction file' 
     179    write(num_rep_42,*) 
     180 
     181    ! read balance velocities on staggered nodes 
     182     
     183    vit_balance_file = trim(dirnameinp)//trim(vit_balance_file) 
     184    flowdir_balance_file = trim(dirnameinp)//trim(flowdir_balance_file) 
     185     
     186    call Read_Ncdf_var('z',vit_balance_file,tab) 
     187    V_Lebrocq(:,:)=tab(:,:) 
     188    call Read_Ncdf_var('z',flowdir_balance_file,tab) 
     189    flowdir_Lebrocq(:,:)=tab(:,:)*PI/180. 
     190 
     191                ! calcul des vitesses selon x et selon y : 
     192                where (V_Lebrocq(:,:).ge.0.) 
     193                        Vx_Lebrocq(:,:) = V_Lebrocq(:,:)*sin(flowdir_Lebrocq(:,:)) 
     194                        Vy_Lebrocq(:,:) = V_Lebrocq(:,:)*cos(flowdir_Lebrocq(:,:)) 
     195                elsewhere 
     196                        Vx_Lebrocq(:,:) = 0. 
     197                        Vy_Lebrocq(:,:) = 0. 
     198                endwhere 
     199                 
     200                ! calcul des vitesses sur les points staggered 
     201                 
     202                do j=2,ny 
     203                        do i=2,nx 
     204                                Vcol_x(i,j) = (Vx_Lebrocq(i-1,j) + Vx_Lebrocq(i,j))/2. 
     205                                Vcol_y(i,j) = (Vy_Lebrocq(i,j-1) + Vy_Lebrocq(i,j))/2. 
     206                        enddo 
     207                enddo 
     208 
     209  end subroutine lect_vitbil_Lebrocq  
    137210  !____________________________________________________________________________________ 
    138211 
Note: See TracChangeset for help on using the changeset viewer.