Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions applications/adjoint_tests/example/configuration.nml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ n_coarsesmooth=4,
n_postsmooth=2,
n_presmooth=2,
smooth_relaxation=0.8,
coarsen_multigrid_tiles=.false.
max_tiled_multigrid_level=1
/
&esm_couple
l_esm_couple_test=.false.,
Expand All @@ -288,6 +290,9 @@ panel_decomposition='auto',
panel_xproc=1,
panel_yproc=1,
partitioner='cubedsphere',
inner_halo_tiles=.false.
tile_size_x=1
tile_size_y=1
/
&physics
bl_segment=0,
Expand Down
3 changes: 2 additions & 1 deletion applications/adjoint_tests/source/adjoint_tests.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ program adjoint_tests
call init_config( filename, gungho_required_namelists, &
config=modeldb%config )

call init_logger( modeldb%mpi%get_comm(), application_name )
call init_logger( modeldb%config, modeldb%mpi%get_comm(), &
application_name )

subroutine_timers = modeldb%config%io%subroutine_timers()
timer_output_path = modeldb%config%io%timer_output_path()
Expand Down
5 changes: 5 additions & 0 deletions applications/gravity_wave/example/configuration.nml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ smooth_relaxation = 0.8
n_presmooth = 2
n_postsmooth = 2
n_coarsesmooth = 4
coarsen_multigrid_tiles = .false.
max_tiled_multigrid_level = 1
/

&timestepping
Expand All @@ -198,6 +200,9 @@ partitioner = 'cubedsphere'
panel_decomposition = 'auto'
panel_xproc = 1
panel_yproc = 1
tile_size_x = 1
tile_size_y = 1
inner_halo_tiles = .false.
/

&boundaries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module gravity_wave_infrastructure_mod

use add_mesh_map_mod, only : assign_mesh_maps
use driver_modeldb_mod, only : modeldb_type
use constants_mod, only : i_def, &
use constants_mod, only : i_def, imdi, &
PRECISION_REAL, &
r_def, r_second, &
l_def, str_def
Expand All @@ -20,6 +20,7 @@ module gravity_wave_infrastructure_mod
use extrusion_mod, only : extrusion_type, &
uniform_extrusion_type, &
TWOD, PRIME_EXTRUSION
use multigrid_mod, only : get_multigrid_tile_size
use sci_geometric_constants_mod, &
only : get_chi_inventory, &
get_panel_id_inventory
Expand Down Expand Up @@ -77,17 +78,23 @@ subroutine initialise_infrastructure( program_name, &

logical(l_def) :: l_multigrid
logical(l_def) :: prepartitioned
logical :: apply_partition_check

logical(l_def) :: apply_partition_check
logical(l_def) :: inner_halo_tiles
integer(i_def) :: stencil_depth(1)

integer(i_def) :: geometry
integer(i_def) :: topology
integer(i_def) :: method
integer(i_def) :: number_of_layers
integer(i_def) :: tile_size_x
integer(i_def) :: tile_size_y

real(r_def) :: domain_bottom
real(r_def) :: domain_height
real(r_def) :: scaled_radius

integer(i_def), allocatable :: tile_size(:,:)
integer(i_def), allocatable :: multigrid_tile_size(:,:)

integer(i_def) :: i
integer(i_def), parameter :: one_layer = 1_i_def

Expand All @@ -101,12 +108,23 @@ subroutine initialise_infrastructure( program_name, &

prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name()
geometry = modeldb%config%base_mesh%geometry()
topology = modeldb%config%base_mesh%topology()
prepartitioned = modeldb%config%base_mesh%prepartitioned()
method = modeldb%config%extrusion%method()
domain_height = modeldb%config%extrusion%domain_height()
number_of_layers = modeldb%config%extrusion%number_of_layers()
scaled_radius = modeldb%config%planet%scaled_radius()

if (prepartitioned) then
inner_halo_tiles = .false.
tile_size_x = 1
tile_size_y = 1
else
inner_halo_tiles = modeldb%config%partitioning%inner_halo_tiles()
tile_size_x = modeldb%config%partitioning%tile_size_x()
tile_size_y = modeldb%config%partitioning%tile_size_y()
end if

!-------------------------------------------------------------------------
! Initialise infrastructure
!-------------------------------------------------------------------------
Expand Down Expand Up @@ -158,12 +176,12 @@ subroutine initialise_infrastructure( program_name, &
call log_event("Invalid geometry for mesh initialisation", LOG_LEVEL_ERROR)
end select
allocate( extrusion, source=create_extrusion( method, &
domain_height, &
domain_height, &
domain_bottom, &
number_of_layers, &
PRIME_EXTRUSION ) )

extrusion_2d = uniform_extrusion_type( domain_height, &
extrusion_2d = uniform_extrusion_type( domain_height, &
domain_bottom, &
one_layer, TWOD )

Expand All @@ -177,18 +195,49 @@ subroutine initialise_infrastructure( program_name, &
apply_partition_check = .true.
end if

if (allocated(tile_size)) deallocate(tile_size)
allocate(tile_size(2, size(base_mesh_names)))
tile_size(1,:) = tile_size_x
tile_size(2,:) = tile_size_y
if (l_multigrid) then
!print*, 'l_multigrid :', l_multigrid
!print*, 'tile_size_x:', tile_size_x
!print*, 'tile_size_y:', tile_size_y
!print*, 'pre-tile_size:', tile_size
!print*, 'base_mesh_names :', base_mesh_names
!print*, 'extrusion :', extrusion
multigrid_tile_size = get_multigrid_tile_size( modeldb%config, &
base_mesh_names, &
extrusion )
where (multigrid_tile_size /= imdi) tile_size = multigrid_tile_size
!print*, 'post-tile_size:', tile_size
end if

call init_mesh( modeldb%config, &
modeldb%mpi%get_comm_rank(), &
modeldb%mpi%get_comm_size(), &
base_mesh_names, &
extrusion, stencil_depth, &
base_mesh_names, extrusion, &
inner_halo_tiles, tile_size, &
stencil_depth, &
apply_partition_check )

allocate( twod_names, source=base_mesh_names )
do i=1, size(twod_names)
twod_names(i) = trim(twod_names(i))//'_2d'
end do

if (allocated(tile_size)) deallocate(tile_size)
allocate(tile_size(2, size(base_mesh_names)))
tile_size(1,:) = tile_size_x
tile_size(2,:) = tile_size_y
if (l_multigrid) then
multigrid_tile_size = get_multigrid_tile_size( modeldb%config, &
base_mesh_names, &
extrusion_2d )
where (multigrid_tile_size /= imdi) tile_size = multigrid_tile_size
end if
call create_mesh( base_mesh_names, extrusion_2d, &
inner_halo_tiles, tile_size, &
alt_name=twod_names )
call assign_mesh_maps(twod_names)

Expand All @@ -197,16 +246,17 @@ subroutine initialise_infrastructure( program_name, &
!=======================================================================
chi_inventory => get_chi_inventory()
panel_id_inventory => get_panel_id_inventory()
call init_fem( mesh_collection, chi_inventory, panel_id_inventory )
call init_fem( modeldb%config, chi_inventory, panel_id_inventory )
if ( l_multigrid ) then
call init_function_space_chains( mesh_collection, chain_mesh_tags )
call init_function_space_chains(chain_mesh_tags)
end if

!-------------------------------------------------------------------------
! Initialise aspects of output
!-------------------------------------------------------------------------
call init_io( program_name, prime_mesh_name, &
modeldb, chi_inventory, panel_id_inventory)
modeldb, chi_inventory, panel_id_inventory, &
geometry, topology )

!-------------------------------------------------------------------------
! Setup constants
Expand Down
3 changes: 2 additions & 1 deletion applications/gravity_wave/source/gravity_wave.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ program gravity_wave

deallocate( filename )

call init_logger( modeldb%mpi%get_comm(), program_name )
call init_logger( modeldb%config, modeldb%mpi%get_comm(), &
program_name )

subroutine_timers = modeldb%config%io%subroutine_timers()
timer_output_path = modeldb%config%io%timer_output_path()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ module initial_buoyancy_kernel_mod
use constants_mod, only: r_def, i_def
use kernel_mod, only: kernel_type

! Configuration modules
use base_mesh_config_mod, only: geometry, topology
use finite_element_config_mod, only: coord_system
use planet_config_mod, only: scaled_radius

implicit none

private
Expand Down Expand Up @@ -115,7 +120,10 @@ subroutine initial_buoyancy_code(nlayers, &
end do

call chi2xyz(chi_wt(1), chi_wt(2), chi_wt(3), &
ipanel, xyz(1), xyz(2), xyz(3))
ipanel, &
geometry, topology, &
coord_system, scaled_radius, &
xyz(1), xyz(2), xyz(3))

buoyancy(map_wt(df) + k) = analytic_buoyancy(xyz)
end do
Expand Down
5 changes: 5 additions & 0 deletions applications/gungho_model/example/configuration.nml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ n_coarsesmooth=4,
n_postsmooth=2,
n_presmooth=2,
smooth_relaxation=0.8,
coarsen_multigrid_tiles = .false.
max_tiled_multigrid_level = 1
/
&esm_couple
l_esm_couple_test=.false.,
Expand All @@ -217,6 +219,9 @@ panel_decomposition='auto',
panel_xproc=6,
panel_yproc=1,
partitioner='cubedsphere',
tile_size_x = 1
tile_size_y = 1
inner_halo_tiles = .false.
/
&physics
/
Expand Down
7 changes: 4 additions & 3 deletions applications/gungho_model/source/gungho_model.f90
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ program gungho_model
call init_config( filename, gungho_required_namelists, &
config=modeldb%config )

call init_logger( modeldb%mpi%get_comm(), application_name )
call init_logger( modeldb%config, modeldb%mpi%get_comm(), &
application_name )

subroutine_timers = modeldb%config%io%subroutine_timers()
timer_output_path = modeldb%config%io%timer_output_path()
Expand All @@ -85,7 +86,7 @@ program gungho_model

call init_collections()
call init_time( modeldb )
call init_counters( application_name )
call init_counters( modeldb%config, application_name )
deallocate( filename )

write( log_scratch_space, '("Initialise ", A, " ...")' ) application_name
Expand All @@ -108,7 +109,7 @@ program gungho_model
call log_event( 'Finalising '//application_name//' ...', log_level_trace )
call finalise( application_name, modeldb )

call final_counters( application_name )
call final_counters(modeldb%config, application_name)
call final_time( modeldb )
call final_collections()
call final_timing( application_name )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,21 @@ program algorithm_test
character(str_def) :: prime_mesh_name

logical(l_def) :: apply_partition_check
logical(l_def) :: inner_halo_tiles

integer(i_def) :: geometry
integer(i_def) :: stencil_depth(1)
integer(i_def) :: method
integer(i_def) :: number_of_layers
integer(i_def) :: tile_size_x
integer(i_def) :: tile_size_y

real(r_def) :: domain_bottom
real(r_def) :: domain_height
real(r_def) :: scaled_radius

integer(i_def), allocatable :: tile_size(:,:)

integer(i_def) :: i
integer(i_def), parameter :: one_layer = 1_i_def

Expand Down Expand Up @@ -153,6 +159,10 @@ program algorithm_test
number_of_layers = config%extrusion%number_of_layers()
scaled_radius = config%planet%scaled_radius()

tile_size_x = 1
tile_size_y = 1
inner_halo_tiles = .false.

!--------------------------------------
! 1.0 Create the meshes
!--------------------------------------
Expand Down Expand Up @@ -183,24 +193,31 @@ program algorithm_test
!-------------------------------------------------------------------------
! 1.2 Create the required meshes
!-------------------------------------------------------------------------
if (allocated(tile_size)) deallocate(tile_size)
allocate(tile_size(2, size(base_mesh_names)))
tile_size(1,:) = tile_size_x
tile_size(2,:) = tile_size_y
stencil_depth = 1
apply_partition_check = .false.
call init_mesh( config, local_rank, total_ranks, &
base_mesh_names, extrusion, stencil_depth, &
call init_mesh( config, local_rank, total_ranks, &
base_mesh_names, extrusion, &
inner_halo_tiles, tile_size, &
stencil_depth, &
apply_partition_check )

do i=1, size(twod_names)
twod_names(i) = trim(twod_names(i))//'_2d'
end do
call create_mesh( base_mesh_names, extrusion_2d, &
inner_halo_tiles, tile_size, &
alt_name=twod_names )
call assign_mesh_maps(twod_names)


!-------------------------------------------------------------------------
! Tests
!-------------------------------------------------------------------------
call test_algorithm_initialise(prime_mesh_name) ! fem
call test_algorithm_initialise(config, prime_mesh_name) ! fem

if ( do_test_jedi_lfric_increment_alg_mod ) then
call test_jedi_lfric_increment_alg(tolerance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
!>@brief Drives the execution of the da dev algorithms tests
module test_algorithm_mod

use config_mod, only : config_type
use constants_mod, only : i_def, r_def, str_def
use driver_fem_mod, only : init_fem, final_fem
use field_mod, only : field_type, field_proxy_type
Expand Down Expand Up @@ -40,14 +41,15 @@ contains
!> @brief Initialise module.
!> @details Initialises the fem & function space wtheta_fs
!> @param[in] mesh Mesh to be used
subroutine test_algorithm_initialise( mesh_name )
subroutine test_algorithm_initialise( config, mesh_name )

implicit none

type(config_type), intent(in) :: config
character(str_def), intent(in) :: mesh_name
type(mesh_type), pointer :: mesh => null()

call init_fem( mesh_collection, chi_inventory, panel_id_inventory )
call init_fem( config, chi_inventory, panel_id_inventory )
mesh => mesh_collection%get_mesh(mesh_name)
wtheta_fs => function_space_collection%get_fs( mesh, &
element_order_h, &
Expand Down Expand Up @@ -101,4 +103,4 @@ contains

end subroutine test_jedi_lfric_increment_alg

end module test_algorithm_mod
end module test_algorithm_mod
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ subroutine setup_io(self, config)

! Setup XIOS with the files defined by file_meta_data
context_name = "jedi_context"
call initialise_io( context_name, &
call initialise_io( config, &
context_name, &
self%get_mpi_comm(), &
file_meta_data, &
self%get_mesh_name(), &
Expand Down
Loading
Loading