Skip to content

Commit

Permalink
The 2d grid block is done I think (fingers crossed) - need to finaliz…
Browse files Browse the repository at this point in the history
…e unit tests
  • Loading branch information
smillerc committed Oct 28, 2020
1 parent fe699a5 commit 26d1ca3
Show file tree
Hide file tree
Showing 30 changed files with 436 additions and 497 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ project(
HOMEPAGE_URL "https://github.com/smillerc/cato"
LANGUAGES Fortran C)

set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down
2 changes: 1 addition & 1 deletion include/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
GIT_HASH = "@GIT_SHA1@"
GIT_REF = "@GIT_REFSPEC@"
GIT_LOCAL_CHANGES = "@GIT_LOCAL_CHANGES@"
CATO_VERSION = "@CATO_VERSION_MAJOR@.@CATO_VERSION_MINOR@.@CATO_PATCH_VERSION@"
CATO_VERSION = "@CATO_VERSION_MAJOR@.@CATO_VERSION_MINOR@.@CATO_VERSION_PATCH@"
COMPILE_HOST = "@HOST_NAME@" !
COMPILE_OS = "@CMAKE_HOST_SYSTEM@"
BUILD_TYPE = "@CMAKE_BUILD_TYPE@"
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ add_library(
lib/io/mod_hdf5.f90
lib/io/mod_input.f90
lib/grid/grid_block.f90
lib/grid/grid_block_1d.f90
# lib/grid/grid_block_1d.f90
lib/grid/grid_block_2d.f90
lib/grid/grid_block_3d.f90
# lib/grid/grid_block_3d.f90
# lib/grid/grid_type.f90
# lib/grid/regular_2d_grid.f90
lib/grid/grid_factory.f90
Expand Down
4 changes: 2 additions & 2 deletions src/lib/boundary_conditions/bc_factory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
module mod_bc_factory
use iso_fortran_env, only: ik => int32
use mod_input, only: input_t
use mod_grid_block, only: grid_block_t
use mod_grid_block_2d, only: grid_block_2d_t
use mod_boundary_conditions, only: boundary_condition_t
use mod_periodic_bc, only: periodic_bc_t, periodic_bc_constructor
use mod_symmetry_bc, only: symmetry_bc_t, symmetry_bc_constructor
Expand All @@ -40,7 +40,7 @@ function bc_factory(bc_type, location, input, grid) result(bc)
character(len=2), intent(in) :: location !< Location (+x, -x, +y, or -y)
class(boundary_condition_t), pointer :: bc
class(input_t), intent(in) :: input
class(grid_block_t), intent(in) :: grid
class(grid_block_2d_t), intent(in) :: grid

select case(trim(bc_type))
case('periodic')
Expand Down
36 changes: 18 additions & 18 deletions src/lib/boundary_conditions/boundary_conditions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module mod_boundary_conditions
use mod_functional, only: operator(.reverse.)
use mod_field, only: field_2d_t
use mod_input, only: input_t
use mod_grid_block, only: grid_block_t
use mod_grid_block_2d, only: grid_block_2d_t

implicit none

Expand Down Expand Up @@ -85,7 +85,7 @@ subroutine set_indices(self, grid)
!< by the other procedures that apply the boundary conditions

class(boundary_condition_t), intent(inout) :: self
class(grid_block_t), intent(in) :: grid
class(grid_block_2d_t), intent(in) :: grid
integer(ik) :: i
! integer(ik), dimension(:, :), intent(in) :: ghost_layers
!< (ilo_layers(n), ihi_layers(n), jlo_layers(n), jhi_layers(n)); indices to the ghost layers.
Expand All @@ -106,31 +106,31 @@ subroutine set_indices(self, grid)
allocate(self%jhi_ghost(self%n_ghost_layers))

if(self%n_ghost_layers == 1) then
self%ilo_ghost = grid%cell_lbounds_halo(1)
self%ihi_ghost = grid%cell_ubounds_halo(1)
self%jlo_ghost = grid%cell_lbounds_halo(2)
self%jhi_ghost = grid%cell_ubounds_halo(2)
self%ilo = grid%cell_lbounds(1)
self%ihi = grid%cell_ubounds(1)
self%jlo = grid%cell_lbounds(2)
self%jhi = grid%cell_ubounds(2)
self%ilo_ghost = grid%lbounds_halo(1)
self%ihi_ghost = grid%ubounds_halo(1)
self%jlo_ghost = grid%lbounds_halo(2)
self%jhi_ghost = grid%ubounds_halo(2)
self%ilo = grid%lbounds(1)
self%ihi = grid%ubounds(1)
self%jlo = grid%lbounds(2)
self%jhi = grid%ubounds(2)
else if(self%n_ghost_layers > 1) then
do i = 1, self%n_ghost_layers
self%ilo_ghost(i) = grid%cell_lbounds_halo(1) + i - 1
self%ihi_ghost(i) = grid%cell_ubounds_halo(1) - i + 1
self%ilo_ghost(i) = grid%lbounds_halo(1) + i - 1
self%ihi_ghost(i) = grid%ubounds_halo(1) - i + 1

self%jlo_ghost(i) = grid%cell_lbounds_halo(2) + i - 1
self%jhi_ghost(i) = grid%cell_ubounds_halo(2) - i + 1
self%jlo_ghost(i) = grid%lbounds_halo(2) + i - 1
self%jhi_ghost(i) = grid%ubounds_halo(2) - i + 1
end do
self%ilo_ghost = .reverse.self%ilo_ghost
self%jlo_ghost = .reverse.self%jlo_ghost
self%ihi_ghost = .reverse.self%ihi_ghost
self%jhi_ghost = .reverse.self%jhi_ghost

self%ilo = grid%cell_lbounds(1)
self%ihi = grid%cell_ubounds(1)
self%jlo = grid%cell_lbounds(2)
self%jhi = grid%cell_ubounds(2)
self%ilo = grid%lbounds(1)
self%ihi = grid%ubounds(1)
self%jlo = grid%lbounds(2)
self%jhi = grid%ubounds(2)
else
error stop "Error in boundary_condition_t%set_indicies(), n_ghost_layers <= 0"
end if
Expand Down
4 changes: 2 additions & 2 deletions src/lib/boundary_conditions/periodic_bc.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module mod_periodic_bc
use mod_functional, only: reverse, operator(.reverse.)
use mod_field, only: field_2d_t
use mod_globals, only: enable_debug_print, debug_print
use mod_grid_block, only: grid_block_t
use mod_grid_block_2d, only: grid_block_2d_t
use mod_boundary_conditions, only: boundary_condition_t
use mod_input, only: input_t

Expand All @@ -46,7 +46,7 @@ contains
type(periodic_bc_t), pointer :: bc
character(len=2), intent(in) :: location !< Location (+x, -x, +y, or -y)
class(input_t), intent(in) :: input
class(grid_block_t), intent(in) :: grid
class(grid_block_2d_t), intent(in) :: grid

allocate(bc)
bc%name = 'periodic'
Expand Down
4 changes: 2 additions & 2 deletions src/lib/boundary_conditions/pressure_input_bc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module mod_pressure_input_bc
use, intrinsic :: iso_fortran_env, only: ik => int32, rk => real64, std_err => error_unit
use mod_globals, only: enable_debug_print, debug_print
use mod_field, only: field_2d_t
use mod_grid_block, only: grid_block_t
use mod_grid_block_2d, only: grid_block_2d_t
use mod_boundary_conditions, only: boundary_condition_t
use mod_nondimensionalization, only: p_0, rho_0, t_0
use mod_input, only: input_t
Expand Down Expand Up @@ -62,7 +62,7 @@ function pressure_input_bc_constructor(location, input, grid) result(bc)
type(pressure_input_bc_t), pointer :: bc
character(len=2), intent(in) :: location !< Location (+x, -x, +y, or -y)
class(input_t), intent(in) :: input
class(grid_block_t), intent(in) :: grid
class(grid_block_2d_t), intent(in) :: grid

allocate(bc)
bc%name = 'pressure_input'
Expand Down
4 changes: 2 additions & 2 deletions src/lib/boundary_conditions/symmetry_bc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module mod_symmetry_bc
use mod_globals, only: enable_debug_print, debug_print
use mod_field, only: field_2d_t
use mod_error, only: error_msg
use mod_grid_block, only: grid_block_t
use mod_grid_block_2d, only: grid_block_2d_t
use mod_boundary_conditions, only: boundary_condition_t
use mod_input, only: input_t

Expand Down Expand Up @@ -183,7 +183,7 @@ function symmetry_bc_constructor(location, input, grid) result(bc)
type(symmetry_bc_t), pointer :: bc
character(len=2), intent(in) :: location !< Location (+x, -x, +y, or -y)
class(input_t), intent(in) :: input
class(grid_block_t), intent(in) :: grid
class(grid_block_2d_t), intent(in) :: grid
allocate(bc)
bc%name = 'symmetry'
Expand Down
4 changes: 2 additions & 2 deletions src/lib/boundary_conditions/zero_gradient_bc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module mod_zero_gradient_bc
use, intrinsic :: iso_fortran_env, only: ik => int32, rk => real64
use mod_globals, only: enable_debug_print, debug_print
use mod_field, only: field_2d_t
use mod_grid_block, only: grid_block_t
use mod_grid_block_2d, only: grid_block_2d_t
use mod_boundary_conditions, only: boundary_condition_t
use mod_input, only: input_t

Expand All @@ -42,7 +42,7 @@ function zero_gradient_bc_constructor(location, input, grid) result(bc)
type(zero_gradient_bc_t), pointer :: bc
character(len=2), intent(in) :: location !< Location (+x, -x, +y, or -y)
class(input_t), intent(in) :: input
class(grid_block_t), intent(in) :: grid
class(grid_block_2d_t), intent(in) :: grid

allocate(bc)
bc%name = 'zero_gradient'
Expand Down
6 changes: 4 additions & 2 deletions src/lib/error.f90
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ subroutine error_msg(message, module_name, class_name, procedure_name, file_name
logical, intent(in), optional :: error_stop

if(present(class_name)) then
write(std_err, '(a, i0)') "Error: "//trim(message)//"; in "//module_name &
write(std_out, '(a, i0)') "Error: "//trim(message)//"; in "//module_name &
//"::"//class_name//"%"//procedure_name// &
"() in "//file_name//":", line_number
else
write(std_err, '(a, i0)') "Error: "//trim(message)//"; in "//module_name &
write(std_out, '(a, i0)') "Error: "//trim(message)//"; in "//module_name &
//"::"//procedure_name//"() in "//file_name//":", line_number
end if


! Catch-all error code
if(present(error_stop)) then
if(error_stop) error stop 1
else
error stop 1
end if
flush(std_err)
end subroutine error_msg

end module mod_error
6 changes: 3 additions & 3 deletions src/lib/evolution_operator/local_evo_operator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module mod_local_evo_operator
use mod_input, only: input_t
use mod_mach_cone_collection, only: mach_cone_collection_t

use mod_grid_block, only: grid_block_t, C1, M1, C2, M2, C3, M3, C4, M4
use mod_grid_block_2d, only: grid_block_2d_t, C1, M1, C2, M2, C3, M3, C4, M4
use mod_abstract_reconstruction, only: abstract_reconstruction_t

implicit none
Expand All @@ -47,7 +47,7 @@ module mod_local_evo_operator
!< operator will inherit from this class. Most of the attributes are the same, just that the
!< implementation varies between those who inherit this class

class(grid_block_t), pointer :: grid => null()
class(grid_block_2d_t), pointer :: grid => null()
!< pointer to the grid object

real(rk), dimension(:, :, :), pointer :: reconstructed_rho => null()
Expand Down Expand Up @@ -79,7 +79,7 @@ module mod_local_evo_operator
subroutine initialize(self, dt, grid_target, recon_operator_target)
!< Constructor for the FVLEG operator
class(local_evo_operator_t), intent(inout) :: self
class(grid_block_t), intent(in), target :: grid_target
class(grid_block_2d_t), intent(in), target :: grid_target
real(rk), intent(in) :: dt !< timestep
class(abstract_reconstruction_t), intent(in), target :: recon_operator_target
Expand Down
Loading

0 comments on commit 26d1ca3

Please sign in to comment.