[3065] | 1 | ! |
---|
| 2 | ! $Id: climoz_mod.F90 3065 2017-11-10 13:25:09Z fairhead $ |
---|
| 3 | ! |
---|
| 4 | ! This module may contains all subroutine and function used |
---|
| 5 | ! for ozone climatology |
---|
| 6 | ! code re-design is needed |
---|
| 7 | |
---|
| 8 | MODULE climoz_mod |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | CONTAINS |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | SUBROUTINE create_climoz(read_climoz) |
---|
| 18 | USE mod_grid_phy_lmdz, ONLY : grid_type, unstructured |
---|
| 19 | USE regr_lat_time_climoz_m |
---|
| 20 | USE mod_phys_lmdz_para |
---|
| 21 | #ifdef CPP_XIOS |
---|
| 22 | USE XIOS |
---|
| 23 | #endif |
---|
| 24 | IMPLICIT NONE |
---|
| 25 | INTEGER, INTENT(IN) :: read_climoz |
---|
| 26 | |
---|
| 27 | !--- OZONE CLIMATOLOGY |
---|
| 28 | IF (grid_type==unstructured) THEN |
---|
| 29 | #ifdef CPP_XIOS |
---|
| 30 | IF(read_climoz>=1) THEN |
---|
| 31 | IF (is_master) CALL regr_lat_time_climoz(read_climoz,.FALSE.) |
---|
| 32 | IF (is_omp_master) THEN |
---|
| 33 | CALL xios_set_field_attr( "tro3_reg", enabled=.TRUE.) |
---|
| 34 | CALL xios_set_field_attr( "tro3_read", enabled=.TRUE.) |
---|
| 35 | IF (read_climoz==2) THEN |
---|
| 36 | CALL xios_set_field_attr( "tro3_daylight_reg", enabled=.TRUE.) |
---|
| 37 | CALL xios_set_field_attr( "tro3_daylight_read", enabled=.TRUE.) |
---|
| 38 | ENDIF |
---|
| 39 | ENDIF |
---|
| 40 | ENDIF |
---|
| 41 | #endif |
---|
| 42 | ENDIF |
---|
| 43 | |
---|
| 44 | END SUBROUTINE create_climoz |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | SUBROUTINE get_ozone_var(name,press_in_edg,paprs,v3) |
---|
| 49 | USE dimphy |
---|
| 50 | USE mod_phys_lmdz_para |
---|
| 51 | #ifdef CPP_XIOS |
---|
| 52 | USE xios |
---|
| 53 | #endif |
---|
| 54 | USE regr1_step_av_m, only: regr1_step_av |
---|
| 55 | IMPLICIT NONE |
---|
| 56 | CHARACTER(LEN=*), INTENT(in):: name(:) ! of the NetCDF variables |
---|
| 57 | REAL, INTENT(IN):: press_in_edg(:) ! edges of pressure intervals for input data, in Pa, in strictly ascending order |
---|
| 58 | REAL, INTENT(IN):: paprs(:, :) ! (klon, klev + 1) |
---|
| 59 | REAL, INTENT(OUT):: v3(:, :, :) ! (klon, klev, size(name)) |
---|
| 60 | |
---|
| 61 | REAL :: v1_mpi(klon_mpi, size(press_in_edg) - 1, size(v3,3)) |
---|
| 62 | REAL :: v1(klon, size(press_in_edg) - 1, size(v3,3)) |
---|
| 63 | INTEGER :: m,i |
---|
| 64 | |
---|
| 65 | #ifdef CPP_XIOS |
---|
| 66 | DO m=1,size(name) |
---|
| 67 | IF (is_omp_master) CALL xios_recv_field(name(m),v1_mpi(:,:,m)) |
---|
| 68 | CALL scatter_omp(v1_mpi,v1) |
---|
| 69 | ! Regrid in pressure at each horizontal position: |
---|
| 70 | DO i = 1, klon |
---|
| 71 | v3(i, klev:1:-1, m) = regr1_step_av(v1(i,:,m), press_in_edg, & |
---|
| 72 | paprs(i, klev+1:1:-1)) |
---|
| 73 | ! (invert order of indices because "paprs" is in descending order) |
---|
| 74 | END DO |
---|
| 75 | ENDDO |
---|
| 76 | #endif |
---|
| 77 | END SUBROUTINE get_ozone_var |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | END MODULE climoz_mod |
---|