Skip to content
Closed
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
63 changes: 47 additions & 16 deletions components/driver/source/driver_coordinates_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
!> @brief Module to assign the values of the coordinates of the mesh to a field.
module driver_coordinates_mod

use base_mesh_config_mod, only: geometry, &
geometry_planar, &
use base_mesh_config_mod, only: geometry_planar, &
geometry_spherical, &
topology, &
topology_fully_periodic, &
topology_non_periodic
use constants_mod, only: r_def, i_def, l_def, &
Expand Down Expand Up @@ -86,6 +84,8 @@ subroutine assign_coordinate_field(chi, panel_id, mesh)
integer(i_def) :: undf, ndf, nlayers
integer(i_def) :: undf_pid, ndf_pid, nlayers_pid
integer(i_def) :: nverts
integer(i_def) :: topology
integer(i_def) :: geometry

integer(i_def) :: alloc_error
integer(i_def) :: depth
Expand Down Expand Up @@ -153,8 +153,8 @@ subroutine assign_coordinate_field(chi, panel_id, mesh)

! Throw an error if stretching factor is not 1 and not on cubed-sphere
if ( abs(stretch_factor - 1.0_r_def) > eps .and. .not. &
(geometry == geometry_spherical .and. &
topology == topology_fully_periodic) ) then
(mesh%is_geometry_spherical() .and. &
mesh%is_topology_periodic()) ) then
call log_event( &
'driver_coordinates: Cannot determine coordinates if Schmidt ' // &
'stretching factor is not 1 and mesh is not cubed-sphere', &
Expand All @@ -165,7 +165,18 @@ subroutine assign_coordinate_field(chi, panel_id, mesh)
panel_id_proxy%data = 1.0_r_def

if ( coord_system == coord_system_xyz .or. &
geometry == geometry_planar ) then
mesh%is_geometry_planar() ) then

if (mesh%is_geometry_spherical()) then
geometry = geometry_spherical
else
geometry = geometry_planar
end if
if (mesh%is_topology_periodic()) then
topology = topology_fully_periodic
else
topology = topology_non_periodic
end if

do cell = 1,chi_proxy(1)%vspace%get_ncell()

Expand All @@ -174,7 +185,9 @@ subroutine assign_coordinate_field(chi, panel_id, mesh)
map_pid(:,cell), &
panel_id_proxy%data, &
global_dof_id, &
panel_ncells )
panel_ncells, &
geometry, &
topology )

call mesh%get_column_coords(cell,column_coords)

Expand All @@ -195,11 +208,13 @@ subroutine assign_coordinate_field(chi, panel_id, mesh)
panel_id_proxy%data, &
ndf_pid, &
undf_pid, &
map_pid(:,cell) )
map_pid(:,cell), &
geometry, &
topology )
end do

else if ( geometry == geometry_spherical .and. &
topology /= topology_fully_periodic ) then
else if ( mesh%is_geometry_spherical() .and. &
.not. mesh%is_topology_periodic() ) then

do cell = 1,chi_proxy(1)%vspace%get_ncell()

Expand All @@ -208,7 +223,9 @@ subroutine assign_coordinate_field(chi, panel_id, mesh)
map_pid(:,cell), &
panel_id_proxy%data, &
global_dof_id, &
panel_ncells )
panel_ncells, &
geometry_spherical, &
topology_non_periodic )

call mesh%get_column_coords(cell,column_coords)

Expand All @@ -231,8 +248,8 @@ subroutine assign_coordinate_field(chi, panel_id, mesh)
map_pid(:,cell) )
end do

else if ( geometry == geometry_spherical .and. &
topology == topology_fully_periodic ) then
else if ( mesh%is_geometry_spherical() .and. &
mesh%is_topology_periodic() ) then

do cell = 1,chi_proxy(1)%vspace%get_ncell()

Expand All @@ -241,7 +258,9 @@ subroutine assign_coordinate_field(chi, panel_id, mesh)
map_pid(:,cell), &
panel_id_proxy%data, &
global_dof_id, &
panel_ncells )
panel_ncells, &
geometry_spherical, &
topology_fully_periodic )

call mesh%get_column_coords(cell,column_coords)

Expand Down Expand Up @@ -294,13 +313,17 @@ end subroutine assign_coordinate_field
!> @param[out] panel_id Field (to be calculated) with the ID of cubed sphere panels
!> @param[in] global_dof_id Array of global id's
!> @param[in] panel_ncells Number of cells per cubed sphere panel
!> @param[in] geometry Mesh geometry
!> @param[in] topology Mesh topology
subroutine calc_panel_id( nlayers, &
ndf_pid, &
undf_pid, &
map_pid, &
panel_id, &
global_dof_id, &
panel_ncells )
panel_ncells, &
geometry, &
topology )

implicit none

Expand All @@ -309,6 +332,8 @@ subroutine calc_panel_id( nlayers, &
real(kind=r_def), intent(out) :: panel_id(undf_pid)
integer(kind=i_def), intent(in) :: global_dof_id(undf_pid)
integer(kind=i_def), intent(in) :: panel_ncells
integer(kind=i_def), intent(in) :: geometry
integer(kind=i_def), intent(in) :: topology

! Internal variables
integer(kind=i_def) :: vert, k
Expand Down Expand Up @@ -347,6 +372,8 @@ end subroutine calc_panel_id
!> @param[in] ndf_pid Number of DoFs per cell for panel_id space
!> @param[in] undf_pid Number of universal DoFs for panel_id space
!> @param[in] map_pid DoF map for panel_id space
!> @param[in] geometry Mesh geometry
!> @param[in] topology Mesh topology
subroutine assign_coordinate_xyz( nlayers, &
ndf, &
nverts, &
Expand All @@ -364,7 +391,9 @@ subroutine assign_coordinate_xyz( nlayers, &
panel_id, &
ndf_pid, &
undf_pid, &
map_pid )
map_pid, &
geometry, &
topology )

use reference_element_mod, only: SWB, SEB, NEB, NWB, SWT, SET, NET, NWT

Expand All @@ -380,6 +409,8 @@ subroutine assign_coordinate_xyz( nlayers, &
real(kind=r_def), intent(in) :: chi_hat_node(3,ndf), chi_hat_vert(nverts,3)
real(kind=r_def), intent(in) :: domain_x, domain_y
real(kind=r_def), intent(in) :: panel_id(undf_pid)
integer(kind=i_def), intent(in) :: geometry
integer(kind=i_def), intent(in) :: topology

! Internal variables
integer(kind=i_def) :: k, df, dfk, vert
Expand Down
13 changes: 4 additions & 9 deletions components/driver/source/driver_fem_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ module driver_fem_mod

use base_mesh_config_mod, only: prime_mesh_name, &
geometry, &
geometry_spherical, &
geometry_planar, &
topology, &
topology_non_periodic
topology
use sci_chi_transform_mod, only: init_chi_transforms, &
final_chi_transforms
use constants_mod, only: i_def, l_def, str_def
Expand Down Expand Up @@ -50,8 +47,6 @@ module driver_fem_mod
use mesh_mod, only: mesh_type
use mesh_collection_mod, only: mesh_collection_type

use base_mesh_config_mod, only: geometry, topology

implicit none

private
Expand Down Expand Up @@ -137,11 +132,11 @@ subroutine init_fem( mesh_collection, chi_inventory, panel_id_inventory )
case (coord_space_W0)
! Check domain/topology is valid
is_valid = ( &
geometry == geometry_spherical &
mesh%is_geometry_spherical() &
.and. coord_system == coord_system_xyz &
) .or. ( &
geometry == geometry_planar &
.and. topology == topology_non_periodic &
mesh%is_geometry_planar() &
.and. mesh%is_topology_non_periodic() &
)
if (.not. is_valid) then
call log_event( &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ contains
@Test
subroutine test_all( this )

use base_mesh_config_mod, only : geometry_planar, &
topology_fully_periodic
use driver_coordinates_mod, only : assign_coordinate_xyz

implicit none
Expand Down Expand Up @@ -117,7 +119,8 @@ contains
call assign_coordinate_xyz( nlayers, ndf, nverts, undf, map, dz, x, y, z, &
vertices_phys, nodal_coord, vertices_comp, &
2.0_r_def, 0.0_r_def, panel_id, ndf_pid, &
undf_pid, map_pid )
undf_pid, map_pid, geometry_planar, &
topology_fully_periodic )

@assertEqual( one, x(1), tol )
@assertEqual( one, y(1), tol )
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/source/mesh/mesh_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2588,7 +2588,7 @@ function is_topology_non_periodic( self ) result ( answer )

logical (l_def) :: answer

answer = self%local_mesh%is_topology_periodic()
answer = self%local_mesh%is_topology_non_periodic()

end function is_topology_non_periodic

Expand Down
Loading