Ignore:
Timestamp:
Nov 27, 2025, 6:44:57 PM (4 weeks ago)
Author:
yann meurdesoif
Message:

GPU port of surf_seaice

YM

Location:
LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/Ocean_skin/esat_m.f90

    r5268 r5889  
    55contains
    66
    7   elemental real function esat(T, P)
    8 
     7   elemental real function esat(T, P)
     8   implicit none
    99    ! Saturation vapor pressure of water in Pa. Buck, 1981,
    1010    ! J. Appl. Meteor. 20, 1527-1532, equation (8).
    11 
    1211    real, intent(in):: T ! temperature, in K
    1312    real, intent(in):: P ! air pressure, in Pa
     13    real            :: esat
    1414
    1515    !--------------------------------------------------------------------
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/Ocean_skin/sens_heat_rain_m.F90

    r5274 r5889  
    2727     USE yomcst_mod_h, ONLY: eps_w
    2828#endif
    29 
     29    real            :: sens_heat_rain
    3030    real, intent(in):: rain ! rain mass flux, in kg m-2 s-1
    3131    real, intent(in):: t ! air temperature at 10 m, in K
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/albsno.f90

    r5282 r5889  
    22! $Header$
    33!
     4MODULE albsno_mod
     5
     6CONTAINS
     7
    48SUBROUTINE albsno(klon, knon, dtime, agesno, alb_neig_grid, precip_snow)
    5 
     9!$gpum horizontal knon klon
    610  USE clesphys_mod_h
    711  IMPLICIT NONE
     
    2832  REAL                                 :: as
    2933  REAL, DIMENSION(klon,nvm)            :: veget
    30   REAL, DIMENSION(nvm),SAVE            :: init, decay
    31   !$OMP THREADPRIVATE(init, decay)
     34  REAL, DIMENSION(nvm)       :: init 
     35  REAL, DIMENSION(nvm)       :: decay
    3236
    33   DATA init /0.55, 0.14, 0.18, 0.29, 0.15, 0.15, 0.14, 0./
    34   DATA decay/0.30, 0.67, 0.63, 0.45, 0.40, 0.14, 0.06, 1./
    3537!****************************************************************************************
     38  init  = (/0.55, 0.14, 0.18, 0.29, 0.15, 0.15, 0.14, 0./)
     39  decay = (/0.30, 0.67, 0.63, 0.45, 0.40, 0.14, 0.06, 1./)
    3640
    3741  if (albsno0>=0.) then
     
    6165 
    6266END SUBROUTINE albsno
     67
     68END MODULE albsno_mod
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/calbeta.f90

    r5868 r5889  
    22! $Header$
    33!
     4MODULE calbeta_mod
     5
     6CONTAINS
     7
    48SUBROUTINE calbeta(dtime,indice,knon,snow,qsol, &
    59     vbeta,vcal,vdif)
    6 
     10!$gpum horizontal knon
    711USE flux_arp_mod_h
    812    USE dimphy
     
    96100END SUBROUTINE calbeta
    97101
     102END MODULE calbeta_mod
    98103
    99104
     
    111116
    112117
    113 
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/calcul_fluxs_mod.f90

    r5868 r5889  
    1515       tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &
    1616       sens_prec_liq, sens_prec_sol, lat_prec_liq, lat_prec_sol, rhoa)
    17 
     17!$gpum horizontal knon
    1818    USE indice_sol_mod
    1919    use sens_heat_rain_m, only: sens_heat_rain
     
    104104    CHARACTER (len = 20)                 :: modname = 'calcul_fluxs'
    105105    LOGICAL                              :: fonte_neige
    106     LOGICAL, SAVE                        :: check = .FALSE.
    107     !$OMP THREADPRIVATE(check)
     106    LOGICAL, PARAMETER                   :: check = .FALSE.
    108107
    109108! End definition
     
    281280       p1lay, t1lay, &
    282281       flux_u1, flux_v1)
    283 
     282!$gpum horizontal knon
    284283    USE clesphys_mod_h
    285284    USE yomcst_mod_h
    286 USE dimphy
     285    USE dimphy
    287286
    288287
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/fonte_neige_mod.F90

    r5868 r5889  
    237237#endif
    238238     &   )
    239 
     239!$gpum horizontal knon
    240240    USE indice_sol_mod
    241241#ifdef ISO
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/limit_read_mod.f90

    r5868 r5889  
    151151!GG
    152152  SUBROUTINE limit_read_hice(knon, knindex, hice_out)
     153!$gpum horizontal knon klon
    153154!
    154155! This subroutine returns the sea surface temperature already read from limit.nc.
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/ocean_forced_mod.F90

    r5868 r5889  
    4343    USE phys_output_var_mod, ONLY : sens_prec_liq_o, sens_prec_sol_o, lat_prec_liq_o, lat_prec_sol_o
    4444    use config_ocean_skin_m, only: activate_ocean_skin
     45    USE calbeta_mod, ONLY : calbeta
     46
    4547#ifdef ISO
    4648    USE infotrac_phy, ONLY: ntiso,niso
     
    310312#endif           
    311313       )
     314!$gpum horizontal knon klon
    312315!
    313316! This subroutine treats the ocean where there is ice.
     
    329332    USE fonte_neige_mod,  ONLY : fonte_neige
    330333    USE indice_sol_mod
     334    USE albsno_mod, ONLY : albsno
     335    USE soil_mod, ONLY : soil
     336    USE calbeta_mod, ONLY : calbeta
    331337    USE phys_output_var_mod, ONLY : sens_prec_liq_o, sens_prec_sol_o, lat_prec_liq_o, lat_prec_sol_o
    332338#ifdef ISO
     
    412418! Local variables
    413419!****************************************************************************************
    414     LOGICAL                     :: check=.FALSE.
     420    LOGICAL,PARAMETER           :: check=.FALSE.
    415421    INTEGER                     :: i, j
    416422    REAL                        :: zfra
     
    470476
    471477! albedo  and radiation parameters
    472     INTEGER, SAVE :: iflag_sic_albedo
     478    INTEGER :: iflag_sic_albedo
    473479! albedo old or NEMO
    474480    REAL :: alb_sno_dry!=rn_alb_sdry !dry snow albedo
     
    492498    ! ice (not snow). Should be visible only, not NIR
    493499    REAL :: pen_ext !=si_pen_ext !extinction length of penetrating shortwave (m-1)
     500    REAl :: lon(knon), lat(knon)   ! for indexation
    494501
    495502! HF from ocean below ice
     
    535542    IF (soil_model) THEN
    536543! update tsoil and calculate soilcap and soilflux
     544       lon(1:knon) = longitude(knindex(1:knon))
     545       lat(1:knon) = latitude(knindex(1:knon))
    537546       CALL soil(dtime, is_sic, knon, snow, tsurf_tmp, qsol, &
    538         & longitude(knindex(1:knon)), latitude(knindex(1:knon)), tsoil,soilcap, soilflux)
     547        & lon, lat, tsoil,soilcap, soilflux)
    539548       cal(1:knon) = RCPD / soilcap(1:knon)
    540549       radsol(1:knon) = radsol(1:knon)  + soilflux(1:knon)
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/ocean_slab_mod.f90

    r5868 r5889  
    352352    USE slab_heat_transp_mod, ONLY: divgrad_phy,slab_ekman1,slab_ekman2,slab_gmdiff
    353353    USE mod_phys_lmdz_para
     354    USE calbeta_mod, ONLY : calbeta
     355
    354356
    355357
     
    691693   USE clesphys_mod_h
    692694   USE yomcst_mod_h
    693 USE calcul_fluxs_mod
     695   USE calcul_fluxs_mod
     696    USE calbeta_mod, ONLY : calbeta
     697
    694698
    695699
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/pbl_surface_mod.F90

    r5885 r5889  
    113113    USE climb_qbs_mod, ONLY : climb_qbs_init
    114114    USE yamada_c_mod, ONLY : yamada_c_init
     115    USE soil_mod, ONLY : soil_init
    115116
    116117    IMPLICIT NONE
     
    272273    CALL climb_qbs_init
    273274    CALL yamada_c_init
     275    CALL soil_init
    274276
    275277  END SUBROUTINE pbl_surface_init
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/soil.f90

    r5868 r5889  
    22! $Header$
    33!
    4 SUBROUTINE soil(ptimestep, indice, knon, snow, ptsrf, qsol, &
    5      lon, lat, ptsoil, pcapcal, pfluxgrd)
    6  
    7   USE yomcst_mod_h
    8   USE dimphy
    9   USE mod_phys_lmdz_para
    10   USE indice_sol_mod
    11   USE print_control_mod, ONLY: lunout
     4MODULE soil_mod
    125  USE dimsoil_mod_h, ONLY: nsoilmx
    13   USE comsoil_mod_h
    14   IMPLICIT NONE
    15 
    16 !=======================================================================
    17 !
    18 !   Auteur:  Frederic Hourdin     30/01/92
    19 !   -------
    20 !
    21 !   Object:  Computation of : the soil temperature evolution
    22 !   -------                   the surfacic heat capacity "Capcal"
    23 !                            the surface conduction flux pcapcal
    24 !
    25 !   Update: 2021/07 : soil thermal inertia, formerly a constant value,
    26 !   ------   can also be now a function of soil moisture (F Cheruy's idea)
    27 !            depending on iflag_inertie, read from physiq.def via conf_phys_m.F90
    28 !            ("Stage L3" Eve Rebouillat, with E Vignon, A Sima, F Cheruy)
    29 !
    30 !   Method: Implicit time integration
    31 !   -------
    32 !   Consecutive ground temperatures are related by:
    33 !           T(k+1) = C(k) + D(k)*T(k)  (*)
    34 !   The coefficients C and D are computed at the t-dt time-step.
    35 !   Routine structure:
    36 !   1) C and D coefficients are computed from the old temperature
    37 !   2) new temperatures are computed using (*)
    38 !   3) C and D coefficients are computed from the new temperature
    39 !      profile for the t+dt time-step
    40 !   4) the coefficients A and B are computed where the diffusive
    41 !      fluxes at the t+dt time-step is given by
    42 !             Fdiff = A + B Ts(t+dt)
    43 !      or     Fdiff = F0 + Capcal (Ts(t+dt)-Ts(t))/dt
    44 !             with F0 = A + B (Ts(t))
    45 !                 Capcal = B*dt
    46 !
    47 !   Interface:
    48 !   ----------
    49 !
    50 !   Arguments:
    51 !   ----------
    52 !   ptimestep            physical timestep (s)
    53 !   indice               sub-surface index
    54 !   snow(klon)           snow
    55 !   ptsrf(klon)          surface temperature at time-step t (K)
    56 !   qsol(klon)           soil moisture (kg/m2 or mm)
    57 !   lon(klon)            longitude in radian
    58 !   lat(klon)            latitude in radian
    59 !   ptsoil(klon,nsoilmx) temperature inside the ground (K)
    60 !   pcapcal(klon)        surfacic specific heat (W*m-2*s*K-1)
    61 !   pfluxgrd(klon)       surface diffusive flux from ground (Wm-2)
    62 !
    63 !=======================================================================
    64 ! Arguments
    65 ! ---------
    66   REAL, INTENT(IN)                     :: ptimestep
    67   INTEGER, INTENT(IN)                  :: indice, knon !, knindex
    68   REAL, DIMENSION(knon), INTENT(IN)    :: snow
    69   REAL, DIMENSION(knon), INTENT(IN)    :: ptsrf
    70   REAL, DIMENSION(knon), INTENT(IN)    :: qsol
    71   REAL, DIMENSION(knon), INTENT(IN)    :: lon
    72   REAL, DIMENSION(knon), INTENT(IN)    :: lat
    73 
    74   REAL, DIMENSION(knon,nsoilmx), INTENT(INOUT) :: ptsoil
    75   REAL, DIMENSION(knon), INTENT(OUT)           :: pcapcal
    76   REAL, DIMENSION(knon), INTENT(OUT)           :: pfluxgrd
    77 
    78 !-----------------------------------------------------------------------
    79 ! Local variables
    80 ! ---------------
    81   INTEGER                             :: ig, jk, ierr
    82   REAL                                :: min_period,dalph_soil
    83   REAL, DIMENSION(nsoilmx)            :: zdz2
    84   REAL                                :: z1s
    85   REAL, DIMENSION(knon)               :: ztherm_i
    86   REAL, DIMENSION(knon,nsoilmx,nbsrf) :: C_coef, D_coef
    87 
    88 ! Local saved variables
    89 ! ---------------------
     6  PRIVATE
     7 
    908  REAL, SAVE                     :: lambda
    919!$OMP THREADPRIVATE(lambda)
    9210  REAL, DIMENSION(nsoilmx), SAVE :: dz1, dz2
    9311!$OMP THREADPRIVATE(dz1,dz2)
    94   LOGICAL, SAVE                  :: firstcall=.TRUE.
    95 !$OMP THREADPRIVATE(firstcall)
    96    
     12  LOGICAL, SAVE                  :: is_initialized=.FALSE.
     13!$OMP THREADPRIVATE(is_initialized)
     14
     15  PUBLIC :: soil_init, soil
     16
     17CONTAINS
     18
     19SUBROUTINE soil_init
     20USE dimsoil_mod_h, ONLY: nsoilmx
     21USE print_control_mod, ONLY: lunout
     22USE mod_phys_lmdz_para
     23IMPLICIT NONE
     24  REAL                                :: min_period,dalph_soil
     25  INTEGER                             :: ig, jk, ierr
    9726!-----------------------------------------------------------------------
    9827!   Depthts:
     
    10736!-----------------------------------------------------------------------
    10837
    109   IF (firstcall) THEN
    11038!-----------------------------------------------------------------------
    11139!   ground levels
    11240!   grnd=z/l where l is the skin depth of the diurnal cycle:
    11341!-----------------------------------------------------------------------
     42    IF (.NOT. is_initialized) THEN
    11443
    11544     min_period=1800. ! en secondes
     
    15483     ENDDO
    15584
    156      firstcall =.FALSE.
     85     is_initialized=.TRUE.
    15786  END IF
     87
     88END SUBROUTINE  soil_init
     89
     90SUBROUTINE soil(ptimestep, indice, knon, snow, ptsrf, qsol, &
     91     lon, lat, ptsoil, pcapcal, pfluxgrd)
     92!$gpum horizontal knon klon
     93  USE yomcst_mod_h
     94  USE dimphy
     95  USE mod_phys_lmdz_para
     96  USE indice_sol_mod
     97  USE print_control_mod, ONLY: lunout
     98  USE dimsoil_mod_h, ONLY: nsoilmx
     99  USE comsoil_mod_h
     100  IMPLICIT NONE
     101
     102!=======================================================================
     103!
     104!   Auteur:  Frederic Hourdin     30/01/92
     105!   -------
     106!
     107!   Object:  Computation of : the soil temperature evolution
     108!   -------                   the surfacic heat capacity "Capcal"
     109!                            the surface conduction flux pcapcal
     110!
     111!   Update: 2021/07 : soil thermal inertia, formerly a constant value,
     112!   ------   can also be now a function of soil moisture (F Cheruy's idea)
     113!            depending on iflag_inertie, read from physiq.def via conf_phys_m.F90
     114!            ("Stage L3" Eve Rebouillat, with E Vignon, A Sima, F Cheruy)
     115!
     116!   Method: Implicit time integration
     117!   -------
     118!   Consecutive ground temperatures are related by:
     119!           T(k+1) = C(k) + D(k)*T(k)  (*)
     120!   The coefficients C and D are computed at the t-dt time-step.
     121!   Routine structure:
     122!   1) C and D coefficients are computed from the old temperature
     123!   2) new temperatures are computed using (*)
     124!   3) C and D coefficients are computed from the new temperature
     125!      profile for the t+dt time-step
     126!   4) the coefficients A and B are computed where the diffusive
     127!      fluxes at the t+dt time-step is given by
     128!             Fdiff = A + B Ts(t+dt)
     129!      or     Fdiff = F0 + Capcal (Ts(t+dt)-Ts(t))/dt
     130!             with F0 = A + B (Ts(t))
     131!                 Capcal = B*dt
     132!
     133!   Interface:
     134!   ----------
     135!
     136!   Arguments:
     137!   ----------
     138!   ptimestep            physical timestep (s)
     139!   indice               sub-surface index
     140!   snow(klon)           snow
     141!   ptsrf(klon)          surface temperature at time-step t (K)
     142!   qsol(klon)           soil moisture (kg/m2 or mm)
     143!   lon(klon)            longitude in radian
     144!   lat(klon)            latitude in radian
     145!   ptsoil(klon,nsoilmx) temperature inside the ground (K)
     146!   pcapcal(klon)        surfacic specific heat (W*m-2*s*K-1)
     147!   pfluxgrd(klon)       surface diffusive flux from ground (Wm-2)
     148!
     149!=======================================================================
     150! Arguments
     151! ---------
     152  REAL, INTENT(IN)                     :: ptimestep
     153  INTEGER, INTENT(IN)                  :: indice, knon !, knindex
     154  REAL, DIMENSION(knon), INTENT(IN)    :: snow
     155  REAL, DIMENSION(knon), INTENT(IN)    :: ptsrf
     156  REAL, DIMENSION(knon), INTENT(IN)    :: qsol
     157  REAL, DIMENSION(knon), INTENT(IN)    :: lon
     158  REAL, DIMENSION(knon), INTENT(IN)    :: lat
     159
     160  REAL, DIMENSION(knon,nsoilmx), INTENT(INOUT) :: ptsoil
     161  REAL, DIMENSION(knon), INTENT(OUT)           :: pcapcal
     162  REAL, DIMENSION(knon), INTENT(OUT)           :: pfluxgrd
     163
     164!-----------------------------------------------------------------------
     165! Local variables
     166! ---------------
     167  INTEGER                             :: ig, jk, ierr
     168  REAL, DIMENSION(nsoilmx)            :: zdz2
     169  REAL                                :: z1s
     170  REAL, DIMENSION(knon)               :: ztherm_i
     171  REAL, DIMENSION(knon,nsoilmx,nbsrf) :: C_coef, D_coef
     172
    158173
    159174
     
    351366   
    352367END SUBROUTINE soil
     368
     369END MODULE soil_mod
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/surf_land_bucket_hetero_mod.F90

    r5876 r5889  
    4141    USE surf_param_mod, ONLY: eff_surf_param, average_surf_var
    4242    USE cdrag_mod
     43    USE albsno_mod, ONLY :  albsno
     44    USE calbeta_mod, ONLY :  calbeta
    4345
    4446#ifdef ISO
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/surf_land_bucket_mod.F90

    r5868 r5889  
    4747    USE yomcst_mod_h
    4848    USE dimsoil_mod_h, ONLY: nsoilmx
     49    USE albsno_mod, ONLY :  albsno
     50    USE soil_mod, ONLY :  soil
     51    USE calbeta_mod, ONLY :  calbeta
     52
    4953!****************************************************************************************
    5054! Bucket calculations for surface.
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/surf_landice_mod.F90

    r5868 r5889  
    5858    USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INLANDSIS
    5959    USE dimsoil_mod_h, ONLY: nsoilmx
     60    USE albsno_mod, ONLY : albsno
     61    USE soil_mod, ONLY : soil
     62    USE calbeta_mod, ONLY :  calbeta
     63
    6064
    6165
  • LMDZ6/branches/PBLSURF_GPUPORT/libf/phylmd/surf_seaice_mod.F90

    r5868 r5889  
    3131#endif               
    3232         &      )
     33!$gpum horizontal knon klon
    3334
    3435  USE dimphy
     
    150151!****************************************************************************************
    151152    IF (type_ocean == 'couple') THEN
    152        
     153!$gpum nocall       
    153154       CALL ocean_cpl_ice( &
    154155            rlon, rlat, swnet, lwnet, alb1, &
     
    165166       
    166167    ELSE IF (type_ocean == 'slab'.AND.version_ocean=='sicINT') THEN
     168!$gpum nocall 
    167169       CALL ocean_slab_ice( &
    168170          itime, dtime, jour, knon, knindex, &
     
    176178
    177179      ELSE ! type_ocean=force or slab +sicOBS or sicNO
     180
    178181       IF (is_master) WRITE(lunout,*) "******* CHECKSUM  ==> ocean_forced IN *******"
     182!$gpum nocall checksum
    179183       CALL checksum("itime", itime)
    180184       CALL checksum("dtime", dtime)
Note: See TracChangeset for help on using the changeset viewer.