Constructor function for the domain object.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_type), | intent(in) | :: | grid | Input |
||
type(spectrum_type), | intent(in) | :: | spectrum | Input |
||
logical, | intent(in), | optional | :: | shallow_water_mode | Logical switch to enable shallow water solver |
type(domain_type) function constructor(grid,spectrum,shallow_water_mode) result(domain)
!! Constructor function for the domain object.
type(grid_type),intent(in) :: grid
!! Input `grid` instance
type(spectrum_type),intent(in) :: spectrum
!! Input `spectrum` instance
logical,intent(in),optional :: shallow_water_mode
!! Logical switch to enable shallow water solver
integer(kind=ik) :: i,j
if(present(shallow_water_mode))then
domain % shallow_water_mode = shallow_water_mode
else
domain % shallow_water_mode = .false.
endif
domain % type_name = 'domain_type'
domain % grid = grid
domain % lb = grid % getLowerBounds()
domain % ub = grid % getUpperBounds()
domain % dx = grid % getGridSpacingX()
domain % dy = grid % getGridSpacingY()
allocate(domain % spectrum(domain % lb(1):domain % ub(1),&
domain % lb(2):domain % ub(2)))
do concurrent(i = domain % lb(1):domain % ub(1),&
j = domain % lb(2):domain % ub(2))
domain % spectrum(i,j) = spectrum
enddo
allocate(domain % u(domain % lb(1):domain % ub(1),&
domain % lb(2):domain % ub(2)))
domain % u = 0
allocate(domain % v(domain % lb(1):domain % ub(1),&
domain % lb(2):domain % ub(2)))
domain % v = 0
allocate(domain % eta(domain % lb(1):domain % ub(1),&
domain % lb(2):domain % ub(2)))
domain % eta = 0
allocate(domain % depth(domain % lb(1):domain % ub(1),&
domain % lb(2):domain % ub(2)))
domain % nfreqs = size(spectrum % getFrequency())
domain % ndirs = size(spectrum % getDirections())
endfunction constructor