| [3435] | 1 | MODULE etat0_limit_unstruct_mod |
|---|
| 2 | |
|---|
| 3 | LOGICAL, SAVE :: create_etat0_limit |
|---|
| 4 | !$OMP THREADPRIVATE(create_etat0_limit) |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | CONTAINS |
|---|
| 10 | |
|---|
| 11 | SUBROUTINE init_etat0_limit_unstruct |
|---|
| [3436] | 12 | #ifdef CPP_XIOS |
|---|
| [3435] | 13 | USE xios |
|---|
| 14 | USE mod_phys_lmdz_para |
|---|
| 15 | USE mod_grid_phy_lmdz |
|---|
| 16 | USE ioipsl, ONLY : getin, ioget_year_len |
|---|
| 17 | USE time_phylmdz_mod, ONLY : annee_ref |
|---|
| [3465] | 18 | USE create_etat0_unstruct_mod |
|---|
| [3435] | 19 | IMPLICIT NONE |
|---|
| 20 | |
|---|
| 21 | INTEGER :: iflag_phys,i |
|---|
| 22 | INTEGER :: ndays |
|---|
| 23 | REAL,ALLOCATABLE :: value(:) |
|---|
| 24 | |
|---|
| 25 | IF (grid_type==unstructured) THEN |
|---|
| 26 | IF (is_master) CALL getin("iflag_phys",iflag_phys) |
|---|
| 27 | CALL bcast(iflag_phys) |
|---|
| 28 | |
|---|
| 29 | IF (is_master) CALL getin('create_etat0_limit',create_etat0_limit) |
|---|
| 30 | CALL bcast(create_etat0_limit) |
|---|
| 31 | |
|---|
| 32 | ndays=ioget_year_len(annee_ref) |
|---|
| 33 | ALLOCATE(value(ndays)) |
|---|
| 34 | DO i=1,ndays |
|---|
| 35 | value(i)=i-1 |
|---|
| 36 | ENDDO |
|---|
| 37 | |
|---|
| 38 | IF (is_omp_master) CALL xios_set_axis_attr("time_year",n_glo=ndays,value=value) |
|---|
| 39 | |
|---|
| 40 | IF (create_etat0_limit) THEN |
|---|
| 41 | IF (iflag_phys<100) THEN |
|---|
| 42 | IF (is_omp_master) CALL xios_set_fieldgroup_attr("etat0_limit_read",read_access=.TRUE.,enabled=.TRUE.) |
|---|
| 43 | IF (is_omp_master) CALL xios_set_filegroup_attr("etat0_limit_read",enabled=.TRUE.) |
|---|
| 44 | ENDIF |
|---|
| 45 | IF (is_omp_master) CALL xios_set_file_attr("limit_write",enabled=.TRUE.) |
|---|
| [3465] | 46 | CALL init_create_etat0_unstruct |
|---|
| [3435] | 47 | ENDIF |
|---|
| 48 | |
|---|
| 49 | ENDIF |
|---|
| 50 | |
|---|
| [3436] | 51 | #endif |
|---|
| [3435] | 52 | END SUBROUTINE init_etat0_limit_unstruct |
|---|
| 53 | |
|---|
| 54 | SUBROUTINE create_etat0_limit_unstruct |
|---|
| [3436] | 55 | #ifdef CPP_XIOS |
|---|
| [3435] | 56 | USE mod_grid_phy_lmdz |
|---|
| 57 | USE create_etat0_unstruct_mod |
|---|
| 58 | USE create_limit_unstruct_mod |
|---|
| 59 | USE phyaqua_mod |
|---|
| 60 | USE mod_phys_lmdz_para |
|---|
| 61 | USE ioipsl, ONLY : getin |
|---|
| 62 | USE dimphy |
|---|
| [3470] | 63 | USE xios |
|---|
| 64 | USE print_control_mod, ONLY: lunout |
|---|
| [3435] | 65 | IMPLICIT NONE |
|---|
| 66 | INTEGER :: iflag_phys |
|---|
| [3531] | 67 | INTEGER :: ierr |
|---|
| 68 | CHARACTER (LEN=20) :: modname='create_etat0_limit_unstruct' |
|---|
| 69 | CHARACTER (LEN=80) :: abort_message |
|---|
| 70 | |
|---|
| [3435] | 71 | IF (grid_type==unstructured) THEN |
|---|
| 72 | |
|---|
| 73 | IF (is_master) CALL getin("iflag_phys",iflag_phys) |
|---|
| 74 | CALL bcast(iflag_phys) |
|---|
| 75 | |
|---|
| 76 | IF (iflag_phys<100) THEN |
|---|
| 77 | IF ( create_etat0_limit) THEN |
|---|
| 78 | CALL create_etat0_unstruct |
|---|
| 79 | CALL create_limit_unstruct |
|---|
| 80 | IF (is_omp_master) THEN |
|---|
| 81 | CALL xios_context_finalize() |
|---|
| 82 | CALL xios_set_current_context("icosagcm") ! very bad, need to find an other solution |
|---|
| 83 | CALL xios_context_finalize() |
|---|
| 84 | CALL xios_finalize() |
|---|
| [3470] | 85 | #ifdef CPP_MPI |
|---|
| 86 | CALL MPI_Finalize(ierr) |
|---|
| 87 | #endif |
|---|
| [3531] | 88 | abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine' |
|---|
| 89 | CALL abort_physic(modname,abort_message,0) |
|---|
| [3543] | 90 | STOP 0 |
|---|
| [3435] | 91 | ENDIF |
|---|
| 92 | !$OMP BARRIER |
|---|
| [3532] | 93 | abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine' |
|---|
| 94 | CALL abort_physic(modname,abort_message,0) |
|---|
| [3435] | 95 | ENDIF |
|---|
| 96 | ELSE |
|---|
| 97 | IF (create_etat0_limit) THEN |
|---|
| 98 | CALL iniaqua(klon,iflag_phys) |
|---|
| 99 | IF (is_omp_master) THEN |
|---|
| 100 | CALL xios_context_finalize() |
|---|
| 101 | CALL xios_set_current_context("icosagcm") ! very bad, need to find an other solution |
|---|
| 102 | CALL xios_context_finalize() |
|---|
| 103 | CALL xios_finalize() |
|---|
| [3470] | 104 | #ifdef CPP_MPI |
|---|
| 105 | CALL MPI_Finalize(ierr) |
|---|
| 106 | #endif |
|---|
| [3435] | 107 | ENDIF |
|---|
| 108 | !$OMP BARRIER |
|---|
| [3531] | 109 | abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine' |
|---|
| 110 | CALL abort_physic(modname,abort_message,0) |
|---|
| [3543] | 111 | STOP 0 |
|---|
| [3435] | 112 | ENDIF |
|---|
| 113 | ENDIF |
|---|
| 114 | ENDIF |
|---|
| 115 | |
|---|
| [3436] | 116 | #endif |
|---|
| [3435] | 117 | END SUBROUTINE create_etat0_limit_unstruct |
|---|
| 118 | |
|---|
| 119 | END MODULE etat0_limit_unstruct_mod |
|---|
| 120 | |
|---|