source: codes/icosagcm/devel/src/base/init_grid_param.j90 @ 1051

Last change on this file since 1051 was 1051, checked in by dubos, 4 years ago

devel : generate repetitive code with jinja2 macros

File size: 2.1 KB
Line 
1MODULE init_grid_param_mod
2
3  IMPLICIT NONE
4  PRIVATE
5  SAVE
6 
7  PUBLIC :: init_grid_param
8
9CONTAINS
10
11  SUBROUTINE init_grid_param(is_mpi_root)
12    USE grid_param
13    USE ioipsl, ONLY : getin
14    USE init_unstructured_mod, ONLY : open_local_mesh_file
15    LOGICAL :: is_mpi_root
16    CHARACTER(len=255) :: grid_type_var
17   
18    grid_type_var='icosahedral'
19    CALL getin("grid_type",grid_type_var)
20    SELECT CASE(grid_type_var)
21    CASE('icosahedral')
22       grid_type = grid_ico
23       IF (is_mpi_root) PRINT *,'DYNAMICO mesh is icosahedral.'
24       CALL getin('nbp',iim_glo)
25       IF(is_mpi_root) PRINT *, 'GETIN nbp = ',iim_glo
26       iim_glo=iim_glo+1
27       jjm_glo=iim_glo
28       CALL select_compute_hex
29    CASE('unstructured')
30       grid_type = grid_unst
31       !       is_omp_level_master=.TRUE.
32       !       omp_level_size=1
33       CALL open_local_mesh_file
34       IF (is_mpi_root) PRINT *,'DYNAMICO mesh is unstructured/LAM.'
35       CALL select_compute_unst
36    CASE DEFAULT
37       PRINT *, 'Invalid value of grid_type :',TRIM(grid_type_var)
38       PRINT *, 'Valid values are : <icosahedral> <unstructured>'
39       STOP
40    END SELECT
41   
42    nqtot=1
43    CALL getin('nqtot',nqtot)
44    CALL getin('llm',llm)
45    IF(is_mpi_root) THEN
46       PRINT *, 'GETIN llm = ',llm
47       PRINT *, 'GETIN nqtot = ',nqtot
48    END IF
49   
50  END SUBROUTINE  init_grid_param
51
52{%- set diags=('rhodz','pression','pression_mid','temperature','hydrostatic_pressure','vertical_interp',
53'pvort_only','theta','geopot','caldyn_fast','caldyn_slow_hydro','caldyn_coriolis') %}
54{% for grid in 'hex','unst' %}
55  SUBROUTINE select_compute_{{grid}}
56    USE compute_diagnostics_mod
57    USE compute_rhodz_mod
58    USE compute_pression_mod
59    USE compute_temperature_mod
60    USE vertical_interp_mod
61   
62    USE compute_caldyn_mod
63    USE compute_pvort_only_mod
64    USE compute_theta_mod
65    USE compute_geopot_mod
66    USE compute_caldyn_fast_mod
67    USE compute_caldyn_slow_hydro_mod
68    USE compute_caldyn_coriolis_mod
69    {%- for diag in diags %}
70    compute_{{diag}} => compute_{{diag}}_{{grid}}
71    {%- endfor %}
72  END SUBROUTINE select_compute_{{grid}}
73{% endfor %}
74
75END MODULE init_grid_param_mod
Note: See TracBrowser for help on using the repository browser.