advect2dRank2 Function

private pure function advect2dRank2(self, advection_method, halowidth) result(adv)

Computes the advective tendency for the domain instance given the desired advection method as an input function and the number of halo cells. This function works both when ndirs == 1 (omnidirectional) and when ndirs > 1 (directional).

This implementation accepts the methods that operate on spectrum arrays of rank 2 (directional) in 2-dimensional space:

  • advectUpwind1stOrder2dRank2
  • advectCentered2ndOrder2dRank2 function with the requested advection method

Arguments

Type IntentOptional AttributesName
class(domain_type), intent(in) :: self

domain instance

public pure function advection_method(f, u, v, dx, dy) result(tendency)
Arguments
Type IntentOptional AttributesName
real(kind=rk), intent(in), dimension(:,:,:,:):: f
real(kind=rk), intent(in), dimension(:,:,:,:):: u
real(kind=rk), intent(in), dimension(:,:,:,:):: v
real(kind=rk), intent(in), dimension(:,:):: dx
real(kind=rk), intent(in), dimension(:,:):: dy
Return Value real(kind=rk), dimension(:,:,:,:), allocatable
integer(kind=ik), intent(in), dimension(:):: halowidth

number of halo cells to use in the advection method

Return Value type(domain_type)

Calls

proc~~advect2drank2~~CallsGraph proc~advect2drank2 advect2dRank2 ub ub proc~advect2drank2->ub lb lb proc~advect2drank2->lb proc~getspectrumarray getSpectrumArray proc~advect2drank2->proc~getspectrumarray proc~getgroupspeed getGroupSpeed proc~advect2drank2->proc~getgroupspeed proc~getdirections getDirections proc~advect2drank2->proc~getdirections setspectrumarray setspectrumarray proc~advect2drank2->setspectrumarray proc~getgridspacingywithhalo getGridSpacingYWithHalo proc~advect2drank2->proc~getgridspacingywithhalo hw hw proc~advect2drank2->hw proc~getgridspacingxwithhalo getGridSpacingXWithHalo proc~advect2drank2->proc~getgridspacingxwithhalo proc~getspectrumarray->ub proc~getspectrumarray->lb proc~getspectrumarray->hw proc~getspectrum getSpectrum proc~getspectrumarray->proc~getspectrum spectrum spectrum proc~getspectrumarray->spectrum proc~getgroupspeed->ub proc~getgroupspeed->lb proc~getgroupspeed->proc~getgroupspeed proc~getgroupspeed->hw proc~getgroupspeed->spectrum proc~getdirections->proc~getdirections proc~getdirections->spectrum proc~getgridspacingywithhalo->ub proc~getgridspacingywithhalo->lb proc~getgridspacingywithhalo->hw proc~getgridspacingxwithhalo->ub proc~getgridspacingxwithhalo->lb proc~getgridspacingxwithhalo->hw
Help

Source Code


Source Code

pure type(domain_type) function advect2dRank2(self,advection_method,halowidth)&
  result(adv)
  !! Computes the advective tendency for the domain instance given the desired
  !! advection method as an input function and the number of halo cells. This 
  !! function works both when `ndirs == 1` (omnidirectional) and when 
  !! `ndirs > 1` (directional).
  !!
  !! This implementation accepts the methods that operate on spectrum arrays
  !! of rank 2 (directional) in 2-dimensional space:
  !!
  !!   * advectUpwind1stOrder2dRank2
  !!   * advectCentered2ndOrder2dRank2
  class(domain_type),intent(in) :: self
    !! `domain` instance
  interface
    pure function advection_method(f,u,v,dx,dy) result(tendency)
      import :: rk
      real(kind=rk),dimension(:,:,:,:),intent(in) :: f
      real(kind=rk),dimension(:,:,:,:),intent(in) :: u
      real(kind=rk),dimension(:,:,:,:),intent(in) :: v
      real(kind=rk),dimension(:,:),intent(in) :: dx
      real(kind=rk),dimension(:,:),intent(in) :: dy
      real(kind=rk),dimension(:,:,:,:),allocatable :: tendency
    endfunction advection_method
  endinterface
    !! function with the requested advection method
  integer(kind=ik),dimension(:),intent(in) :: halowidth
    !! number of halo cells to use in the advection method
  integer(kind=ik) :: idm,jdm,n
  real(kind=rk),dimension(:,:,:,:),allocatable :: f
  real(kind=rk),dimension(:,:,:),allocatable :: cg
  real(kind=rk),dimension(:,:,:,:),allocatable :: cgx
  real(kind=rk),dimension(:,:,:,:),allocatable :: cgy
  real(kind=rk),dimension(:,:),allocatable :: dx
  real(kind=rk),dimension(:,:),allocatable :: dy
  real(kind=rk),dimension(:),allocatable :: theta
  associate(lb => self % lb,ub => self % ub,hw => halowidth)
  theta = self % getDirections()
  adv = self
  idm = ub(1)-lb(1)+1+2*hw(1)
  jdm = ub(2)-lb(2)+1+2*hw(2)
  f = reshape(self % getSpectrumArray(hw,.true.),[self % nfreqs,self % ndirs,[idm,jdm]])
  allocate(cgx(self % nfreqs,self % ndirs,idm,jdm))
  allocate(cgy(self % nfreqs,self % ndirs,idm,jdm))
  cg = self % getGroupSpeed(hw,.true.)
  do concurrent(n = 1:self % ndirs)
    cgx(:,n,:,:) = cos(theta(n))*cg
    cgy(:,n,:,:) = sin(theta(n))*cg
  enddo
  dx = self % getGridSpacingXWithHalo(hw,.true.)
  dy = self % getGridSpacingYWithHalo(hw,.true.)
  call adv % setSpectrumArray(advection_method(f,cgx,cgy,dx,dy))
  deallocate(cgx,cgy)
  endassociate
endfunction advect2dRank2


advect1dRank1 advect1dRank2 advect2dRank2 advectCentered2ndOrder advectCentered2ndOrder1dRank0 advectCentered2ndOrder1dRank1 advectCentered2ndOrder1dRank2 advectCentered2ndOrder2dRank0 advectCentered2ndOrder2dRank1 advectCentered2ndOrder2dRank2 advectUpwind1stOrder advectUpwind1stOrder1dRank0 advectUpwind1stOrder1dRank1 advectUpwind1stOrder1dRank2 advectUpwind1stOrder2dRank0 advectUpwind1stOrder2dRank1 advectUpwind1stOrder2dRank2 assign_array_1d assign_array_2d assign_spectrum_array_1d assign_spectrum_array_2d backward_euler backward_euler_domain backward_euler_spectrum constructor constructor constructor_1d constructor_2d diff diff_1d diff_2d diff_periodic diff_periodic_1d diff_periodic_2d domain_add_domain domain_add_real domain_div_domain domain_div_real domain_mult_domain domain_mult_real domain_sub_domain domain_sub_real domain_type domain_unary_minus donelanHamiltonHui donelanHamiltonHuiDirectionalSpectrum donelanHamiltonHuiDirectionalSpreading elevation eq eq exact_exponential exact_exponential_domain exact_exponential_spectrum forward_euler forward_euler_domain forward_euler_spectrum frequencyMoment frequencyMoment ge getAirDensity getAirDensity getAmplitude getAxisX getAxisY getCurrent_u getCurrent_u getCurrent_v getCurrent_v getDepth getDepth getDepthLevels getDirections getDirections getDirections2d getElevation getElevation getFrequency getFrequency getFrequency2d getGravity getGravity getGrid getGridRotation getGridSpacingX getGridSpacingXWithHalo getGridSpacingY getGridSpacingYWithHalo getGroupSpeed getGroupSpeed getGroupSpeed2d getLatitude getLongitude getLowerBounds getLowerBounds getPhaseSpeed getPhaseSpeed getPhaseSpeed2d getSpectrum getSpectrum getSpectrumArray getSurfaceTension getSurfaceTension getUpperBounds getUpperBounds getWaterDensity getWaterDensity getWaveAction getWavelength getWavenumber getWavenumber2d getWavenumberSpacing gravityClairaut grid_type gt horizontalAcceleration horizontalVelocity integrate integrate_domain integrate_spectrum isAllocated isAllocated isMonochromatic isOmnidirectional jonswap jonswapPeakFrequency le lt meanPeriod meanPeriod meanPeriodZeroCrossing meanPeriodZeroCrossing meanSquareSlope meanSquareSlopeDirectional momentum_x momentum_y momentumFlux_xx momentumFlux_xy momentumFlux_yy neq neq nondimensionalDepth nondimensionalEnergy nondimensionalFetch nondimensionalFrequency nondimensionalRoughness_H1986 nondimensionalRoughness_S1974 nondimensionalTime omnidirectionalSpectrum ones ones_int ones_real peakedness peakFrequency peakFrequencyDiscrete phillips piersonMoskowitz piersonMoskowitzPeakFrequency pressure range range_int range_real readJSON real2d_mult_spectrum real_add_domain real_add_spectrum real_div_domain real_div_spectrum real_mult_domain real_mult_spectrum real_sub_domain real_sub_spectrum saturationSpectrum sbf_DCCM2012 sbf_JONSWAP sds_DCCM2012 sdt_DCCM2012 setAirDensity setAirDensity setCurrent1d setCurrent2d setDepth setDepth setElevation setElevation setGravity setGravity setSpectrum1d setSpectrum1d setSpectrum2d setSpectrum2d setSpectrumArray1d1d setSpectrumArray1d2d setSpectrumArray2d2d setSurfaceTension setSurfaceTension setWaterDensity setWaterDensity significantSurfaceOrbitalVelocity significantWaveHeight significantWaveHeight sin_DCCM2012 snl_DCCM2012 spectrum_add_real spectrum_add_spectrum spectrum_div_real spectrum_div_spectrum spectrum_mult_real spectrum_mult_real2d spectrum_mult_spectrum spectrum_sub_real spectrum_sub_spectrum spectrum_type spectrum_unary_minus stokesDrift stokesDrift2d tile tile_1d_int tile_1d_real tile_2d_int tile_2d_real tile_3d_int tile_3d_real ursellNumber verticalAcceleration verticalVelocity waveAge wavenumber wavenumberMoment wavenumberMoment wavenumberSpectrum writeJSON writeJSON zeros zeros_int zeros_real