Ignore:
Timestamp:
05/17/19 15:02:07 (5 years ago)
Author:
ymipsl
Message:

experimental : add smooth physics tendency for external physics.

Activated with param :

phys_smooth_tendency=y

To be tested...

YM

File:
1 edited

Legend:

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

    r713 r871  
    2020  CHARACTER(LEN=255),SAVE :: physics_type 
    2121!$OMP THREADPRIVATE(physics_type) 
     22  TYPE(t_message),SAVE :: req_theta0, req_ue0, req_q0 
    2223 
    2324  PUBLIC :: physics, init_physics, zero_du_phys 
     
    115116 
    116117    IF(is_mpi_root) PRINT *, 'phys_type = ',phys_type 
     118     
     119     
    117120!$OMP END PARALLEL 
    118121  END SUBROUTINE init_physics 
     
    159162    TYPE(t_field),POINTER :: f_wflux(:) 
    160163    TYPE(t_field),POINTER :: f_q(:) 
    161  
     164     
     165    LOGICAL,SAVE :: first=.TRUE. 
     166!$OMP THREADPRIVATE(first) 
     167     
    162168    LOGICAL:: firstcall,lastcall 
    163169    INTEGER :: ind 
    164170    TYPE(t_physics_inout) :: args 
    165171 
    166     IF(MOD(it,itau_physics)==0 .AND. phys_type/=phys_none) THEN 
    167  
    168        ! as a result of the the two calls to add_du_phys, 
    169        ! du_phys increases by u(after physics) - u (before physics) 
    170        CALL add_du_phys(-1., f_ue) 
    171  
    172        SELECT CASE(phys_type) 
    173        CASE(phys_HS94) 
    174           CALL held_suarez(f_ps,f_theta_rhodz,f_ue)  
    175        CASE (phys_lmdz_generic) 
    176          CALL physics_lmdz_generic(it ,f_phis, f_ps, f_theta_rhodz, f_ue, f_wflux, f_q) 
    177        CASE (phys_external) 
    178          CALL physics_external(it ,f_phis, f_ps, f_theta_rhodz, f_ue, f_wflux, f_q) 
    179        CASE(phys_LB2012) 
    180           CALL phys_venus(f_ps,f_theta_rhodz,f_ue)  
    181        CASE DEFAULT 
    182           CALL physics_column(it, f_phis, f_ps, f_theta_rhodz, f_ue, f_q) 
    183        END SELECT 
    184  
    185        CALL transfert_request(f_theta_rhodz,req_i0) 
    186        CALL transfert_request(f_ue,req_e0_vect) 
    187        CALL transfert_request(f_q,req_i0) 
    188  
    189        CALL add_du_phys(1., f_ue) 
    190     END IF 
    191  
    192     IF (mod(it,itau_out)==0 ) THEN 
    193        CALL write_physics_tendencies 
    194        CALL zero_du_phys 
    195        SELECT CASE(phys_type) 
    196        CASE (phys_DCMIP) 
    197           CALL write_physics_dcmip 
    198        CASE (phys_DCMIP2016) 
    199           CALL write_physics_dcmip2016 
    200        END SELECT 
    201     END IF 
     172    IF (first) THEN 
     173      CALL init_message(f_theta_rhodz, req_i0, req_theta0) 
     174      CALL init_message(f_ue, req_e0_vect, req_ue0) 
     175      CALL init_message(f_q, req_i0, req_q0) 
     176      first=.FALSE. 
     177    ENDIF 
     178 
     179 
     180    IF (phys_external) THEN 
     181     
     182      CALL physics_external(it ,f_phis, f_ps, f_theta_rhodz, f_ue, f_wflux, f_q) 
     183 
     184    ELSE 
     185     
     186      IF(MOD(it,itau_physics)==0 .AND. phys_type/=phys_none) THEN 
     187 
     188         ! as a result of the the two calls to add_du_phys, 
     189         ! du_phys increases by u(after physics) - u (before physics) 
     190         CALL add_du_phys(-1., f_ue) 
     191 
     192         SELECT CASE(phys_type) 
     193         CASE(phys_HS94) 
     194            CALL held_suarez(f_ps,f_theta_rhodz,f_ue)  
     195         CASE (phys_lmdz_generic) 
     196           CALL physics_lmdz_generic(it ,f_phis, f_ps, f_theta_rhodz, f_ue, f_wflux, f_q) 
     197         CASE(phys_LB2012) 
     198            CALL phys_venus(f_ps,f_theta_rhodz,f_ue)  
     199         CASE DEFAULT 
     200            CALL physics_column(it, f_phis, f_ps, f_theta_rhodz, f_ue, f_q) 
     201         END SELECT 
     202 
     203         CALL send_message(f_theta_rhodz, req_theta0) 
     204         CALL send_message(f_ue, req_ue0) 
     205         CALL send_message(f_q, req_q0) 
     206         CALL wait_message(req_theta0) 
     207         CALL wait_message(req_ue0) 
     208         CALL wait_message(req_q0) 
     209        
     210         CALL add_du_phys(1., f_ue) 
     211      END IF 
     212 
     213      IF (mod(it,itau_out)==0 ) THEN 
     214         CALL write_physics_tendencies 
     215         CALL zero_du_phys 
     216         SELECT CASE(phys_type) 
     217         CASE (phys_DCMIP) 
     218            CALL write_physics_dcmip 
     219         CASE (phys_DCMIP2016) 
     220            CALL write_physics_dcmip2016 
     221         END SELECT 
     222      END IF 
     223    ENDIF 
    202224     
    203225  END SUBROUTINE physics 
Note: See TracChangeset for help on using the changeset viewer.