Ignore:
Timestamp:
10/31/14 14:52:01 (10 years ago)
Author:
ymipsl
Message:

Merging OpenMP parallisme mode : by subdomain and on vertical level.
This feature is actually experimental but may be retro-compatible with the last method based only on subdomain

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/trunk/src/physics.f90

    r281 r295  
    1010  TYPE(t_field),POINTER :: f_extra_physics_2D(:), f_extra_physics_3D(:) 
    1111  TYPE(t_field),POINTER :: f_dulon(:), f_dulat(:) 
     12  TYPE(t_field),POINTER :: f_temp(:) 
    1213 
    1314  CHARACTER(LEN=255) :: physics_type 
     
    3839       CALL allocate_field(f_dulon,field_t,type_real,llm, name='dulon') 
    3940       CALL allocate_field(f_dulat,field_t,type_real,llm, name='dulat') 
     41       CALL allocate_field(f_temp,field_t,type_real,llm, name='temp') 
    4042       CALL init_pack_before ! Compute physics_inout%ngrid and offsets used by pack/unpack 
    4143       CALL init_physics_dcmip 
     
    102104    USE physics_interface_mod 
    103105    USE physics_dcmip_mod, ONLY : full_physics_dcmip => full_physics 
     106    USE theta2theta_rhodz_mod 
    104107    USE mpipara 
    105108    IMPLICIT NONE 
     
    111114    REAL(rstd),POINTER :: phis(:) 
    112115    REAL(rstd),POINTER :: ps(:) 
     116    REAL(rstd),POINTER :: temp(:,:) 
    113117    REAL(rstd),POINTER :: theta_rhodz(:,:) 
    114118    REAL(rstd),POINTER :: ue(:,:) 
     
    118122    INTEGER :: it, ind 
    119123 
     124    CALL theta_rhodz2temperature(f_ps,f_theta_rhodz,f_temp) 
     125 
    120126    DO ind=1,ndomain 
    121127       IF (.NOT. assigned_domain(ind)) CYCLE 
     
    124130       phis=f_phis(ind) 
    125131       ps=f_ps(ind) 
    126        theta_rhodz=f_theta_rhodz(ind) 
     132       temp=f_temp(ind) 
    127133       ue=f_ue(ind) 
    128134       q=f_q(ind) 
    129        CALL pack_physics(pack_info(ind), phis, ps, theta_rhodz, ue, q) 
     135       CALL pack_physics(pack_info(ind), phis, ps, temp, ue, q) 
    130136    END DO 
    131137 
     
    134140       CALL full_physics_dcmip 
    135141    CASE DEFAULT 
    136        IF(is_mpi_root) PRINT *,'Internal error : illegal value of phys_type', phys_type 
     142       IF(is_mpi_master) PRINT *,'Internal error : illegal value of phys_type', phys_type 
    137143       STOP 
    138144    END SELECT 
     
    143149       CALL swap_geometry(ind) 
    144150       ps=f_ps(ind) 
    145        theta_rhodz=f_theta_rhodz(ind) 
     151       temp=f_temp(ind) 
    146152       q=f_q(ind) 
    147153       dulon=f_dulon(ind) 
    148154       dulat=f_dulat(ind) 
    149        CALL unpack_physics(pack_info(ind), ps, theta_rhodz, q, dulon, dulat) 
     155       CALL unpack_physics(pack_info(ind), ps, temp, q, dulon, dulat) 
    150156    END DO 
     157    CALL temperature2theta_rhodz(f_ps,f_temp,f_theta_rhodz) 
    151158 
    152159    ! Transfer dulon, dulat 
     
    166173  END SUBROUTINE physics_column 
    167174 
    168   SUBROUTINE pack_physics(info, phis, ps, theta_rhodz, ue, q) 
     175  SUBROUTINE pack_physics(info, phis, ps, temp, ue, q) 
    169176    USE icosa 
    170177    USE wind_mod 
     
    176183    REAL(rstd) :: phis(iim*jjm) 
    177184    REAL(rstd) :: ps(iim*jjm) 
    178     REAL(rstd) :: theta_rhodz(iim*jjm,llm) 
     185    REAL(rstd) :: temp(iim*jjm,llm) 
    179186    REAL(rstd) :: ue(3*iim*jjm,llm) 
    180187    REAL(rstd) :: q(iim*jjm,llm,nqtot) 
    181188 
    182189    REAL(rstd) :: p(iim*jjm,llm+1) 
    183     REAL(rstd) :: Temp(iim*jjm,llm) 
    184190    REAL(rstd) :: uc(iim*jjm,3,llm) 
    185191    REAL(rstd) :: ulon(iim*jjm,llm) 
    186192    REAL(rstd) :: ulat(iim*jjm,llm) 
    187193 
     194!$OMP BARRIER 
    188195    CALL compute_pression(ps,p,0) 
    189     CALL compute_theta_rhodz2temperature(ps,theta_rhodz,Temp,0) 
     196!$OMP BARRIER 
    190197    CALL compute_wind_centered(ue,uc) 
    191198    CALL compute_wind_centered_lonlat_compound(uc, ulon, ulat) 
     
    199206  END SUBROUTINE pack_physics 
    200207 
    201   SUBROUTINE unpack_physics(info, ps,theta_rhodz, q, dulon, dulat) 
     208  SUBROUTINE unpack_physics(info, ps,temp, q, dulon, dulat) 
    202209    USE icosa 
    203210    USE physics_interface_mod 
     
    206213    TYPE(t_pack_info) :: info 
    207214    REAL(rstd) :: ps(iim*jjm) 
    208     REAL(rstd) :: theta_rhodz(iim*jjm,llm) 
    209     REAL(rstd) :: Temp(iim*jjm,llm) 
     215    REAL(rstd) :: temp(iim*jjm,llm) 
    210216    REAL(rstd) :: q(iim*jjm,llm,nqtot) 
    211217    REAL(rstd) :: dulon(iim*jjm,llm) 
     
    221227    q = q + physics_inout%dt_phys * dq 
    222228    Temp = Temp + physics_inout%dt_phys * dTemp 
    223     CALL compute_temperature2theta_rhodz(ps,Temp,theta_rhodz,0) 
     229!    CALL compute_temperature2theta_rhodz(ps,Temp,theta_rhodz,0) 
    224230  END SUBROUTINE unpack_physics 
    225231 
Note: See TracChangeset for help on using the changeset viewer.