Changeset 604


Ignore:
Timestamp:
10/24/17 01:32:57 (6 years ago)
Author:
dubos
Message:

trunk : backported r600-603 from devel

Location:
codes/icosagcm/trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/trunk/src/diagnostics/diagflux.F90

    r599 r604  
    1010       f_massfluxt(:), f_qfluxt(:), & ! time-integrated mass flux and tracer flux 
    1111       f_qfluxt_lon(:), f_qfluxt_lat(:), & ! scalar flux reconstructed at cell centers 
    12        f_epot(:), f_ekin(:), f_enthalpy(:), & ! time-averaged potential E, kinetic E and enthalpy 
    13        f_epotfluxt(:), f_ekinfluxt(:), f_enthalpyfluxt(:) ! time averaged 'fluxes' of epot, ekin and enthalpy 
     12       f_ulont(:), f_thetat(:), f_epot(:), f_ekin(:), f_enthalpy(:), & ! time-averaged potential E, kinetic E and enthalpy 
     13       f_ulonfluxt(:), f_thetafluxt(:), f_epotfluxt(:), f_ekinfluxt(:), f_enthalpyfluxt(:) ! time averaged 'fluxes' of epot, ekin and enthalpy 
    1414  LOGICAL :: diagflux_on 
    1515  !$OMP THREADPRIVATE(diagflux_on) 
     
    2626    ll = MERGE(llm,1,diagflux_on) 
    2727    CALL allocate_field(f_masst,         field_t,type_real,ll,       name="masst") 
     28    CALL allocate_field(f_ulont,         field_t,type_real,ll,       name="ulont") 
     29    CALL allocate_field(f_thetat,        field_t,type_real,ll,       name="thetat") 
    2830    CALL allocate_field(f_epot,          field_t,type_real,ll,       name="epot") 
    2931    CALL allocate_field(f_ekin,          field_t,type_real,ll,       name="ekin") 
     
    3133    CALL allocate_field(f_qmasst,        field_t,type_real,ll,nqtot, name="qmasst") 
    3234    CALL allocate_field(f_massfluxt,     field_u,type_real,ll,       name="massfluxt") 
     35    CALL allocate_field(f_ulonfluxt,     field_u,type_real,ll,       name="ulonfluxt") 
     36    CALL allocate_field(f_thetafluxt,    field_u,type_real,ll,       name="thetafluxt") 
    3337    CALL allocate_field(f_epotfluxt,     field_u,type_real,ll,       name="epotfluxt") 
    3438    CALL allocate_field(f_ekinfluxt,     field_u,type_real,ll,       name="ekinfluxt") 
     
    5054       CALL swap_dimensions(ind) 
    5155       ZERO2(f_masst) 
     56       ZERO2(f_ulont) 
     57       ZERO2(f_thetat) 
    5258       ZERO2(f_epot) 
    5359       ZERO2(f_ekin) 
     
    5561       ZERO3(f_qmasst) 
    5662       ZERO2(f_massfluxt) 
     63       ZERO2(f_ulonfluxt) 
     64       ZERO2(f_thetafluxt) 
    5765       ZERO2(f_epotfluxt) 
    5866       ZERO2(f_ekinfluxt) 
     
    110118!------------------------------------ Compute energy fluxes --------------------------------------- 
    111119 
    112   SUBROUTINE diagflux_energy(frac, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta, f_hfluxt) 
     120  SUBROUTINE diagflux_energy(frac, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta,f_pk, f_hfluxt) 
    113121    REAL(rstd), INTENT(IN) :: frac 
    114     TYPE(t_field),POINTER :: f_phis(:),f_rhodz(:),f_theta_rhodz(:),f_u(:), f_geopot(:), f_theta(:), f_hfluxt(:) 
     122    TYPE(t_field),POINTER :: f_phis(:),f_rhodz(:),f_theta_rhodz(:),f_u(:), f_geopot(:), f_theta(:), f_pk(:), f_hfluxt(:) 
    115123    REAL(rstd), POINTER :: phis(:), rhodz(:,:), theta_rhodz(:,:,:), u(:,:), & 
    116          geopot(:,:), pk(:,:,:), hfluxt(:,:), & 
    117          epot(:,:), ekin(:,:), enthalpy(:,:), & 
    118          epotflux(:,:), ekinflux(:,:), enthalpyflux(:,:) 
     124         geopot(:,:), theta(:,:,:), pk(:,:), hfluxt(:,:), & 
     125         ulont(:,:), thetat(:,:), epot(:,:), ekin(:,:), enthalpy(:,:), & 
     126         thetaflux(:,:), ulonflux(:,:), epotflux(:,:), ekinflux(:,:), enthalpyflux(:,:) 
    119127    INTEGER :: ind 
    120128    DO ind=1,ndomain 
     
    128136       u = f_u(ind) 
    129137       geopot = f_geopot(ind) 
    130        pk = f_theta(ind) ! buffer 
     138       theta = f_theta(ind) ! buffer 
     139       pk = f_pk(ind) ! buffer 
     140       ulont = f_ulont(ind) 
     141       thetat = f_thetat(ind) 
    131142       epot = f_epot(ind) 
    132143       ekin = f_ekin(ind) 
    133144       enthalpy = f_enthalpy(ind) 
     145       ulonflux = f_ulonfluxt(ind) 
     146       thetaflux = f_thetafluxt(ind) 
    134147       epotflux = f_epotfluxt(ind) 
    135148       ekinflux = f_ekinfluxt(ind) 
    136149       enthalpyflux = f_enthalpyfluxt(ind) 
    137        CALL compute_diagflux_energy(frac,hfluxt, phis,rhodz,theta_rhodz,u, geopot,pk, epot,ekin,enthalpy, epotflux, ekinflux, enthalpyflux) 
     150       CALL compute_diagflux_energy(frac,hfluxt, phis,rhodz,theta_rhodz,u, geopot,theta,pk, & 
     151            ulont, thetat, epot, ekin, enthalpy, & 
     152            ulonflux, thetaflux, epotflux, ekinflux, enthalpyflux) 
    138153    END DO 
    139154  END SUBROUTINE diagflux_energy 
    140155 
    141   SUBROUTINE compute_diagflux_energy(frac, massflux, phis,rhodz,theta_rhodz,u, geopot,pk, epot,ekin,enthalpy, epot_flux, ekin_flux, enthalpy_flux) 
     156  SUBROUTINE compute_diagflux_energy(frac, massflux, phis,rhodz,theta_rhodz,ue, geopot,theta,pk, & 
     157       ulon, thetat, epot, ekin, enthalpy, & 
     158       ulon_flux, thetat_flux, epot_flux, ekin_flux, enthalpy_flux) 
    142159    USE disvert_mod, ONLY : ptop 
    143160    REAL(rstd), INTENT(IN) :: frac 
    144     REAL(rstd), INTENT(IN) :: massflux(3*iim*jjm,llm), u(3*iim*jjm,llm),& 
     161    REAL(rstd), INTENT(IN) :: massflux(3*iim*jjm,llm), ue(3*iim*jjm,llm),& 
    145162                              phis(iim*jjm), rhodz(iim*jjm,llm), theta_rhodz(iim*jjm,llm,nqtot) 
    146     REAL(rstd), INTENT(INOUT) :: geopot(iim*jjm,llm+1), pk(iim*jjm,llm) ! pk = buffer 
    147     REAL(rstd), INTENT(INOUT), DIMENSION(iim*jjm, llm)   ::  epot, ekin, enthalpy 
    148     REAL(rstd), INTENT(INOUT), DIMENSION(3*iim*jjm, llm) ::  epot_flux, ekin_flux, enthalpy_flux     
    149     REAL(rstd) :: energy, p_ik, theta_ik, temp_ik, gv, Rd  
     163    REAL(rstd), INTENT(INOUT) :: geopot(iim*jjm,llm+1), theta(iim*jjm,llm), pk(iim*jjm,llm) ! theta,pk = buffers 
     164    REAL(rstd), INTENT(INOUT), DIMENSION(iim*jjm, llm)   ::  ulon, thetat, epot, ekin, enthalpy 
     165    REAL(rstd), INTENT(INOUT), DIMENSION(3*iim*jjm, llm) ::  ulon_flux, thetat_flux, epot_flux, ekin_flux, enthalpy_flux     
     166    REAL(rstd) :: energy, p_ik, theta_ik, temp_ik, gv, Rd, cx,cy,cz, ux,uy,uz, ue_le,ulon_i 
    150167    INTEGER :: ij, l, ij_omp_begin_ext, ij_omp_end_ext 
    151168    Rd = kappa*cpp 
    152169    ! even if loops are of the _ext variant, we still need halo exchanges before reconstructing fluxes at cell centers 
    153170    ! => loop over interior region 
    154     CALL distrib_level(ij_end-ij_begin+1,ij_omp_begin_ext,ij_omp_end_ext) 
    155     ij_omp_begin_ext = ij_omp_begin_ext+ij_begin-1 
    156     ij_omp_end_ext = ij_omp_end_ext+ij_begin-1 
     171    CALL distrib_level(ij_begin_ext, ij_end_ext, ij_omp_begin_ext,ij_omp_end_ext) 
    157172#include "../kernels/energy_fluxes.k90" 
    158173  END SUBROUTINE compute_diagflux_energy 
  • codes/icosagcm/trunk/src/diagnostics/observable.f90

    r599 r604  
    11MODULE observable_mod 
    22  USE icosa 
     3  USE diagflux_mod 
     4  USE output_field_mod 
    35  IMPLICIT NONE 
    46  PRIVATE 
     
    3840    USE disvert_mod 
    3941    USE wind_mod 
    40     USE output_field_mod 
    4142    USE omp_para 
    4243    USE time_mod 
     
    4748    USE theta2theta_rhodz_mod 
    4849    USE omega_mod 
    49     USE diagflux_mod 
    5050    LOGICAL, INTENT(IN) :: init 
    5151    INTEGER :: l 
     
    166166          CALL output_field("massflux_lat",f_buf_ulat) 
    167167 
    168           CALL transfert_request(f_epotfluxt,req_e1_vect)  
    169           CALL flux_centered_lonlat(1./(itau_out*dt) , f_epotfluxt, f_buf_ulon, f_buf_ulat) 
    170           CALL output_field("epot_t", f_epot) 
    171           CALL output_field("epotflux_lon",f_buf_ulon) 
    172           CALL output_field("epotflux_lat",f_buf_ulat) 
    173  
    174           CALL transfert_request(f_ekinfluxt,req_e1_vect)  
    175           CALL flux_centered_lonlat(1./(itau_out*dt) , f_ekinfluxt, f_buf_ulon, f_buf_ulat) 
    176           CALL output_field("ekin_t", f_ekin) 
    177           CALL output_field("ekinflux_lon",f_buf_ulon) 
    178           CALL output_field("ekinflux_lat",f_buf_ulat) 
    179  
    180           CALL transfert_request(f_enthalpyfluxt,req_e1_vect)  
    181           CALL flux_centered_lonlat(1./(itau_out*dt) , f_enthalpyfluxt, f_buf_ulon, f_buf_ulat) 
    182           CALL output_field("enthalpy_t", f_enthalpy) 
    183           CALL output_field("enthalpyflux_lon",f_buf_ulon) 
    184           CALL output_field("enthalpyflux_lat",f_buf_ulat) 
     168          CALL output_energyflux(f_ulont, f_ulonfluxt, "ulon_t", "ulonflux_lon", "ulonflux_lat") 
     169          CALL output_energyflux(f_thetat, f_thetafluxt, "theta_t", "thetaflux_lon", "thetaflux_lat") 
     170          CALL output_energyflux(f_epot, f_epotfluxt, "epot_t", "epotflux_lon", "epotflux_lat") 
     171          CALL output_energyflux(f_ekin, f_ekinfluxt, "ekin_t", "ekinflux_lon", "ekinflux_lat") 
     172          CALL output_energyflux(f_enthalpy, f_enthalpyfluxt, "enthalpy_t", "enthalpyflux_lon", "enthalpyflux_lat") 
    185173 
    186174          CALL qflux_centered_lonlat(1./(itau_out*dt) , f_qfluxt, f_qfluxt_lon, f_qfluxt_lat) 
     
    192180    END IF 
    193181  END SUBROUTINE write_output_fields_basic 
     182 
     183  SUBROUTINE output_energyflux(f_energy, f_flux, name_energy, name_fluxlon, name_fluxlat) 
     184    TYPE(t_field), POINTER :: f_energy(:), f_flux(:) 
     185    CHARACTER(*), INTENT(IN) :: name_energy, name_fluxlon, name_fluxlat 
     186    CALL transfert_request(f_flux,req_e1_vect) 
     187    CALL flux_centered_lonlat(1./(itau_out*dt) , f_flux, f_buf_ulon, f_buf_ulat) 
     188    CALL output_field(name_energy,  f_energy) 
     189    CALL output_field(name_fluxlon, f_buf_ulon) 
     190    CALL output_field(name_fluxlat, f_buf_ulat) 
     191  END SUBROUTINE output_energyflux 
    194192   
    195193 !------------------- Conversion from prognostic to observable variables ------------------ 
  • codes/icosagcm/trunk/src/dynamics/caldyn_kernels_base.F90

    r580 r604  
    4343!$OMP BARRIER 
    4444 
    45     CALL distrib_level(ij_end_ext-ij_begin_ext+1,ij_omp_begin_ext,ij_omp_end_ext) 
    46     ij_omp_begin_ext=ij_omp_begin_ext+ij_begin_ext-1 
    47     ij_omp_end_ext=ij_omp_end_ext+ij_begin_ext-1 
     45    CALL distrib_level(ij_begin_ext,ij_end_ext, ij_omp_begin_ext,ij_omp_end_ext) 
    4846 
    4947    Rd = kappa*cpp 
     
    190188    CALL trace_start("compute_caldyn_vert") 
    191189 
    192     CALL distrib_level(ij_end-ij_begin+1,ij_omp_begin,ij_omp_end) 
    193     ij_omp_begin=ij_omp_begin+ij_begin-1 
    194     ij_omp_end=ij_omp_end+ij_begin-1 
     190    CALL distrib_level(ij_begin,ij_end, ij_omp_begin,ij_omp_end) 
    195191 
    196192    !    REAL(rstd) :: wwuu(iim*3*jjm,llm+1) ! tmp var, don't know why but gain 30% on the whole code in opemp 
  • codes/icosagcm/trunk/src/dynamics/caldyn_kernels_hevi.F90

    r580 r604  
    122122    INTEGER    :: iter, ij, l, ij_omp_begin_ext, ij_omp_end_ext 
    123123 
    124     CALL distrib_level(ij_end_ext-ij_begin_ext+1,ij_omp_begin_ext,ij_omp_end_ext) 
    125     ij_omp_begin_ext=ij_omp_begin_ext+ij_begin_ext-1 
    126     ij_omp_end_ext=ij_omp_end_ext+ij_begin_ext-1 
     124    CALL distrib_level(ij_begin_ext,ij_end_ext, ij_omp_begin_ext,ij_omp_end_ext) 
    127125 
    128126    IF(dysl) THEN 
  • codes/icosagcm/trunk/src/kernels/energy_fluxes.k90

    r599 r604  
    1111      END DO 
    1212   END DO 
     13   ! NB : at this point pressure is stored in array pk 
     14   ! pk then serves as buffer to store temperature 
    1315   SELECT CASE(caldyn_thermo) 
    1416   CASE(thermo_theta) 
     
    1719            p_ik = pk(ij,l) 
    1820            theta_ik = theta_rhodz(ij,l,1)/rhodz(ij,l) 
     21            theta(ij,l) = theta_ik 
    1922            temp_ik = theta_ik*(p_ik/preff)**kappa 
    2023            gv = (g*Rd)*temp_ik/p_ik 
     
    2932            theta_ik = theta_rhodz(ij,l,1)/rhodz(ij,l) 
    3033            temp_ik = Treff*exp((theta_ik + Rd*log(p_ik/preff))/cpp) 
     34            theta(ij,l) = Treff*exp(theta_ik/cpp) 
    3135            gv = (g*Rd)*temp_ik/p_ik ! specific volume v = Rd*T/p 
    3236            pk(ij,l) = temp_ik 
     
    3741   !$OMP BARRIER 
    3842   ! Now accumulate energies and energy fluxes 
    39    ! enthalpy 
    4043   ! NB : at this point temperature is stored in array pk 
    4144   ! pk then serves as buffer to store energy 
     45   ! enthalpy 
    4246   DO l = ll_begin, ll_end 
    4347      !DIR$ SIMD 
     
    7377      END DO 
    7478   END DO 
     79   ! theta 
     80   DO l = ll_begin, ll_end 
     81      !DIR$ SIMD 
     82      DO ij=ij_begin_ext, ij_end_ext 
     83         energy = theta(ij,l) 
     84         thetat(ij,l) = thetat(ij,l) + frac*rhodz(ij,l)*energy 
     85         pk(ij,l) = energy 
     86      END DO 
     87   END DO 
     88   DO l = ll_begin, ll_end 
     89      !DIR$ SIMD 
     90      DO ij=ij_begin_ext, ij_end_ext 
     91         thetat_flux(ij+u_right,l) = thetat_flux(ij+u_right,l) + .5*massflux(ij+u_right,l)*(pk(ij,l)+pk(ij+t_right,l)) 
     92         thetat_flux(ij+u_lup,l) = thetat_flux(ij+u_lup,l) + .5*massflux(ij+u_lup,l)*(pk(ij,l)+pk(ij+t_lup,l)) 
     93         thetat_flux(ij+u_ldown,l) = thetat_flux(ij+u_ldown,l) + .5*massflux(ij+u_ldown,l)*(pk(ij,l)+pk(ij+t_ldown,l)) 
     94      END DO 
     95   END DO 
    7596   ! kinetic energy 
    7697   DO l = ll_begin, ll_end 
     
    7899      DO ij=ij_begin_ext, ij_end_ext 
    79100         energy=0.d0 
    80          energy = energy + le(ij+u_rup)*de(ij+u_rup)*u(ij+u_rup,l)**2 
    81          energy = energy + le(ij+u_lup)*de(ij+u_lup)*u(ij+u_lup,l)**2 
    82          energy = energy + le(ij+u_left)*de(ij+u_left)*u(ij+u_left,l)**2 
    83          energy = energy + le(ij+u_ldown)*de(ij+u_ldown)*u(ij+u_ldown,l)**2 
    84          energy = energy + le(ij+u_rdown)*de(ij+u_rdown)*u(ij+u_rdown,l)**2 
    85          energy = energy + le(ij+u_right)*de(ij+u_right)*u(ij+u_right,l)**2 
     101         energy = energy + le(ij+u_rup)*de(ij+u_rup)*ue(ij+u_rup,l)**2 
     102         energy = energy + le(ij+u_lup)*de(ij+u_lup)*ue(ij+u_lup,l)**2 
     103         energy = energy + le(ij+u_left)*de(ij+u_left)*ue(ij+u_left,l)**2 
     104         energy = energy + le(ij+u_ldown)*de(ij+u_ldown)*ue(ij+u_ldown,l)**2 
     105         energy = energy + le(ij+u_rdown)*de(ij+u_rdown)*ue(ij+u_rdown,l)**2 
     106         energy = energy + le(ij+u_right)*de(ij+u_right)*ue(ij+u_right,l)**2 
    86107         energy = energy * (.25/Ai(ij)) 
    87108         ekin(ij,l) = ekin(ij,l) + frac*rhodz(ij,l)*energy 
     
    97118      END DO 
    98119   END DO 
     120   ! ulon 
     121   DO l = ll_begin, ll_end 
     122      !DIR$ SIMD 
     123      DO ij=ij_begin_ext, ij_end_ext 
     124         cx=centroid(ij,1) 
     125         cy=centroid(ij,2) 
     126         cz=centroid(ij,3) 
     127         ux=0. ; uy=0. ; uz=0. 
     128         ue_le = ne_rup*ue(ij+u_rup,l)*le(ij+u_rup) 
     129         ux = ux + ue_le*(.5*(xyz_v(ij+z_rup,1)+xyz_v(ij+z_up,1))-cx) 
     130         uy = uy + ue_le*(.5*(xyz_v(ij+z_rup,2)+xyz_v(ij+z_up,2))-cy) 
     131         uz = uz + ue_le*(.5*(xyz_v(ij+z_rup,3)+xyz_v(ij+z_up,3))-cz) 
     132         ue_le = ne_lup*ue(ij+u_lup,l)*le(ij+u_lup) 
     133         ux = ux + ue_le*(.5*(xyz_v(ij+z_lup,1)+xyz_v(ij+z_up,1))-cx) 
     134         uy = uy + ue_le*(.5*(xyz_v(ij+z_lup,2)+xyz_v(ij+z_up,2))-cy) 
     135         uz = uz + ue_le*(.5*(xyz_v(ij+z_lup,3)+xyz_v(ij+z_up,3))-cz) 
     136         ue_le = ne_left*ue(ij+u_left,l)*le(ij+u_left) 
     137         ux = ux + ue_le*(.5*(xyz_v(ij+z_lup,1)+xyz_v(ij+z_ldown,1))-cx) 
     138         uy = uy + ue_le*(.5*(xyz_v(ij+z_lup,2)+xyz_v(ij+z_ldown,2))-cy) 
     139         uz = uz + ue_le*(.5*(xyz_v(ij+z_lup,3)+xyz_v(ij+z_ldown,3))-cz) 
     140         ue_le = ne_ldown*ue(ij+u_ldown,l)*le(ij+u_ldown) 
     141         ux = ux + ue_le*(.5*(xyz_v(ij+z_ldown,1)+xyz_v(ij+z_down,1))-cx) 
     142         uy = uy + ue_le*(.5*(xyz_v(ij+z_ldown,2)+xyz_v(ij+z_down,2))-cy) 
     143         uz = uz + ue_le*(.5*(xyz_v(ij+z_ldown,3)+xyz_v(ij+z_down,3))-cz) 
     144         ue_le = ne_rdown*ue(ij+u_rdown,l)*le(ij+u_rdown) 
     145         ux = ux + ue_le*(.5*(xyz_v(ij+z_rdown,1)+xyz_v(ij+z_down,1))-cx) 
     146         uy = uy + ue_le*(.5*(xyz_v(ij+z_rdown,2)+xyz_v(ij+z_down,2))-cy) 
     147         uz = uz + ue_le*(.5*(xyz_v(ij+z_rdown,3)+xyz_v(ij+z_down,3))-cz) 
     148         ue_le = ne_right*ue(ij+u_right,l)*le(ij+u_right) 
     149         ux = ux + ue_le*(.5*(xyz_v(ij+z_rup,1)+xyz_v(ij+z_rdown,1))-cx) 
     150         uy = uy + ue_le*(.5*(xyz_v(ij+z_rup,2)+xyz_v(ij+z_rdown,2))-cy) 
     151         uz = uz + ue_le*(.5*(xyz_v(ij+z_rup,3)+xyz_v(ij+z_rdown,3))-cz) 
     152         ulon_i = ux*elon_i(ij,1) + uy*elon_i(ij,2) + uz*elon_i(ij,3) 
     153         energy = ulon_i*(1./Ai(ij)) 
     154         ulon(ij,l) = ulon(ij,l) + frac*rhodz(ij,l)*energy 
     155         pk(ij,l) = energy 
     156      END DO 
     157   END DO 
     158   DO l = ll_begin, ll_end 
     159      !DIR$ SIMD 
     160      DO ij=ij_begin_ext, ij_end_ext 
     161         ulon_flux(ij+u_right,l) = ulon_flux(ij+u_right,l) + .5*massflux(ij+u_right,l)*(pk(ij,l)+pk(ij+t_right,l)) 
     162         ulon_flux(ij+u_lup,l) = ulon_flux(ij+u_lup,l) + .5*massflux(ij+u_lup,l)*(pk(ij,l)+pk(ij+t_lup,l)) 
     163         ulon_flux(ij+u_ldown,l) = ulon_flux(ij+u_ldown,l) + .5*massflux(ij+u_ldown,l)*(pk(ij,l)+pk(ij+t_ldown,l)) 
     164      END DO 
     165   END DO 
    99166   !---------------------------- energy_fluxes ---------------------------------- 
    100167   !-------------------------------------------------------------------------- 
  • codes/icosagcm/trunk/src/parallel/omp_para.F90

    r548 r604  
    204204  END SUBROUTINE init_omp_para 
    205205 
    206   SUBROUTINE distrib_level(size,lbegin,lend) 
    207   IMPLICIT NONE 
    208     INTEGER,INTENT(IN)  :: size   
     206  SUBROUTINE distrib_level(ibegin,iend, lbegin,lend) 
     207  IMPLICIT NONE 
     208    INTEGER,INTENT(IN)  :: ibegin,iend   
    209209    INTEGER,INTENT(OUT) :: lbegin   
    210210    INTEGER,INTENT(OUT) :: lend   
    211     INTEGER :: div,rest 
    212      
     211    INTEGER :: size,div,rest 
     212    size=iend-ibegin+1 
    213213    div=size/omp_level_size 
    214214    rest=MOD(size,omp_level_size) 
    215215    IF (omp_level_rank<rest) THEN 
    216       lbegin=(div+1)*omp_level_rank+1 
     216      lbegin=(div+1)*omp_level_rank + ibegin 
    217217      lend=lbegin+div 
    218218    ELSE 
    219       lbegin=(div+1)*rest + (omp_level_rank-rest)*div+1 
     219      lbegin=(div+1)*rest + (omp_level_rank-rest)*div + ibegin 
    220220      lend=lbegin+div-1 
    221221    ENDIF 
  • codes/icosagcm/trunk/src/parallel/transfert_mpi.f90

    r548 r604  
    12371237 
    12381238          dim3=size(field(ind)%rval3d,2) 
    1239           CALL distrib_level(dim3,lbegin,lend) 
     1239          CALL distrib_level(1,dim3, lbegin,lend) 
    12401240 
    12411241          rval3d=>field(ind)%rval3d 
     
    12951295          IF (.NOT. assigned_domain(ind) ) CYCLE 
    12961296          dim3=size(field(ind)%rval3d,2) 
    1297           CALL distrib_level(dim3,lbegin,lend) 
     1297          CALL distrib_level(1,dim3, lbegin,lend) 
    12981298          rval3d=>field(ind)%rval3d 
    12991299          req=>message%request(ind) 
     
    13491349 
    13501350          dim3=size(field(ind)%rval4d,2) 
    1351           CALL distrib_level(dim3,lbegin,lend) 
     1351          CALL distrib_level(1,dim3, lbegin,lend) 
    13521352          dim4=size(field(ind)%rval4d,3) 
    13531353          rval4d=>field(ind)%rval4d 
     
    14111411           
    14121412          dim3=size(field(ind)%rval4d,2) 
    1413           CALL distrib_level(dim3,lbegin,lend) 
     1413          CALL distrib_level(1,dim3, lbegin,lend) 
    14141414          dim4=size(field(ind)%rval4d,3) 
    14151415          rval4d=>field(ind)%rval4d 
     
    15891589              dim3=size(rval3d,2) 
    15901590     
    1591               CALL distrib_level(dim3,lbegin,lend) 
     1591              CALL distrib_level(1,dim3, lbegin,lend) 
    15921592              offset=recv%offset*dim3 + (lbegin-1)*recv%size 
    15931593              CALL trace_start("copy_from_buffer") 
     
    16371637 
    16381638              dim3=size(rval4d,2) 
    1639               CALL distrib_level(dim3,lbegin,lend) 
     1639              CALL distrib_level(1,dim3, lbegin,lend) 
    16401640              dim4=size(rval4d,3) 
    16411641              CALL trace_start("copy_from_buffer") 
  • codes/icosagcm/trunk/src/sphere/geometry.f90

    r548 r604  
    639639          IF (ii_glo==1 .AND. jj_glo==1) THEN 
    640640            le(n+u_ldown)=0 
     641            le_de(n+u_ldown)=0 
    641642            xyz_v(n+z_ldown,:)=xyz_v(n+z_down,:) 
    642643                        
     
    645646          IF (ii_glo==iim_glo .AND. jj_glo==1) THEN 
    646647            le(n+u_right)=0 
     648            le_de(n+u_right)=0 
    647649            xyz_v(n+z_rdown,:)=xyz_v(n+z_rup,:) 
    648650          ENDIF 
     
    650652          IF (ii_glo==iim_glo .AND. jj_glo==jjm_glo) THEN 
    651653            le(n+u_rup)=0 
     654            le_de(n+u_rup)=0 
    652655            xyz_v(n+z_rup,:)=xyz_v(n+z_up,:) 
    653656          ENDIF 
     
    655658          IF (ii_glo==1 .AND. jj_glo==jjm_glo) THEN 
    656659            le(n+u_lup)=0 
     660            le_de(n+u_lup)=0 
    657661            xyz_v(n+z_up,:)=xyz_v(n+z_lup,:) 
    658662          ENDIF 
  • codes/icosagcm/trunk/src/time/timeloop_gcm.f90

    r599 r604  
    309309          ! At this point advect_tracer has obtained the halos of u and rhodz, 
    310310          ! needed for correct computation of kinetic energy 
    311           IF(diagflux_on) CALL diagflux_energy(adv_over_out, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta, f_hfluxt) 
     311          IF(diagflux_on) CALL diagflux_energy(adv_over_out, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta,f_buf_i, f_hfluxt) 
    312312 
    313313          IF (check_rhodz) THEN ! check that rhodz is consistent with ps 
Note: See TracChangeset for help on using the changeset viewer.