[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 |
---|
[3470] | 67 | INTEGER :: ierr |
---|
[3435] | 68 | IF (grid_type==unstructured) THEN |
---|
| 69 | |
---|
| 70 | IF (is_master) CALL getin("iflag_phys",iflag_phys) |
---|
| 71 | CALL bcast(iflag_phys) |
---|
| 72 | |
---|
| 73 | IF (iflag_phys<100) THEN |
---|
| 74 | IF ( create_etat0_limit) THEN |
---|
| 75 | CALL create_etat0_unstruct |
---|
| 76 | CALL create_limit_unstruct |
---|
| 77 | IF (is_omp_master) THEN |
---|
| 78 | CALL xios_context_finalize() |
---|
| 79 | CALL xios_set_current_context("icosagcm") ! very bad, need to find an other solution |
---|
| 80 | CALL xios_context_finalize() |
---|
| 81 | CALL xios_finalize() |
---|
[3470] | 82 | #ifdef CPP_MPI |
---|
| 83 | CALL MPI_Finalize(ierr) |
---|
| 84 | #endif |
---|
| 85 | WRITE(lunout,*) 'create_etat0_limit_unstruct, Initial state file are created, all is fine' |
---|
| 86 | STOP 0 |
---|
[3435] | 87 | ENDIF |
---|
| 88 | !$OMP BARRIER |
---|
| 89 | STOP 'create_etat0_limit_unstruct, Initial state file are created, all is fine' |
---|
| 90 | ENDIF |
---|
| 91 | ELSE |
---|
| 92 | IF (create_etat0_limit) THEN |
---|
| 93 | CALL iniaqua(klon,iflag_phys) |
---|
| 94 | IF (is_omp_master) THEN |
---|
| 95 | CALL xios_context_finalize() |
---|
| 96 | CALL xios_set_current_context("icosagcm") ! very bad, need to find an other solution |
---|
| 97 | CALL xios_context_finalize() |
---|
| 98 | CALL xios_finalize() |
---|
[3470] | 99 | #ifdef CPP_MPI |
---|
| 100 | CALL MPI_Finalize(ierr) |
---|
| 101 | #endif |
---|
[3435] | 102 | ENDIF |
---|
| 103 | !$OMP BARRIER |
---|
[3470] | 104 | WRITE(lunout,*) 'create_etat0_limit_unstruct, Initial state file are created, all is fine' |
---|
| 105 | STOP 0 |
---|
[3435] | 106 | ENDIF |
---|
| 107 | ENDIF |
---|
| 108 | ENDIF |
---|
| 109 | |
---|
[3436] | 110 | #endif |
---|
[3435] | 111 | END SUBROUTINE create_etat0_limit_unstruct |
---|
| 112 | |
---|
| 113 | END MODULE etat0_limit_unstruct_mod |
---|
| 114 | |
---|