Init_ExtrudedAMRController Subroutine

public subroutine Init_ExtrudedAMRController(this, model3d, surf, levels, bottomBC, topBC, refineThreshold, coarsenThreshold, ivar, maxLevel, nHalo, model2d, relativeEnergyFloor, energyWeights, significantEnergyFloor)

Attach the controller to an initialized 3-D model on an extruded mesh, and optionally to a 2-D model on the surface mesh.

  • model3d : runs on ExtrudedMesh(surf, ...) with nz = model3d%mesh%nLayers layers.
  • surf : the surface mesh the 3-D mesh was extruded from; it becomes the forest's base (level 0) and must outlive the controller.
  • levels : fills the level heights for a new surface mesh (see SELF_ExtrudedLevels).
  • bottomBC, topBC : the boundary condition ids of the column bottoms and tops, as passed to ExtrudedMesh.
  • refineThreshold > coarsenThreshold : sigma = log10 modal-energy-ratio cut-offs of the 3-D refinement indicator; ivar its driving variable (or SELF_AMR_ALLVARS).
  • maxLevel >= 0 caps the refinement depth; nHalo >= 0 the refine halo, in columns.
  • model2d (optional) : runs on surf, and is regridded and transferred with model3d.
  • relativeEnergyFloor, energyWeights, significantEnergyFloor : the indicator's amplitude gate, as for AMRController3D.

Arguments

TypeIntentOptionalAttributesName
class(ExtrudedAMRController), intent(out) :: this
class(DGModel3D_t), intent(in) :: model3d
type(Mesh2D), intent(in), target:: surf
procedure(SELF_ExtrudedLevels) :: levels
integer, intent(in) :: bottomBC
integer, intent(in) :: topBC
real(kind=prec), intent(in) :: refineThreshold
real(kind=prec), intent(in) :: coarsenThreshold
integer, intent(in) :: ivar
integer, intent(in) :: maxLevel
integer, intent(in) :: nHalo
class(DGModel2D_t), intent(in), optional :: model2d
real(kind=prec), intent(in), optional :: relativeEnergyFloor
real(kind=prec), intent(in), optional :: energyWeights(:)
real(kind=prec), intent(in), optional :: significantEnergyFloor

Calls

proc~~init_extrudedamrcontroller~~CallsGraph proc~init_extrudedamrcontroller Init_ExtrudedAMRController proc~initforestfromdecomposedmesh~2 InitForestFromDecomposedMesh proc~init_extrudedamrcontroller->proc~initforestfromdecomposedmesh~2 proc~allgatherperelemreals~2 AllgatherPerElemReals proc~initforestfromdecomposedmesh~2->proc~allgatherperelemreals~2 proc~allgatherperelemints~2 AllgatherPerElemInts proc~initforestfromdecomposedmesh~2->proc~allgatherperelemints~2 mpi_allgatherv mpi_allgatherv proc~allgatherperelemreals~2->mpi_allgatherv proc~allgatherperelemints~2->mpi_allgatherv

Contents


Source Code

  subroutine Init_ExtrudedAMRController(this,model3d,surf,levels,bottomBC,topBC, &
                                        refineThreshold,coarsenThreshold,ivar,maxLevel,nHalo, &
                                        model2d,relativeEnergyFloor,energyWeights, &
                                        significantEnergyFloor)
    !! Attach the controller to an initialized 3-D model on an extruded mesh, and optionally to
    !! a 2-D model on the surface mesh.
    !!
    !!  - model3d : runs on ExtrudedMesh(surf, ...) with nz = model3d%mesh%nLayers layers.
    !!  - surf : the surface mesh the 3-D mesh was extruded from; it becomes the forest's base
    !!    (level 0) and must outlive the controller.
    !!  - levels : fills the level heights for a new surface mesh (see SELF_ExtrudedLevels).
    !!  - bottomBC, topBC : the boundary condition ids of the column bottoms and tops, as
    !!    passed to ExtrudedMesh.
    !!  - refineThreshold > coarsenThreshold : sigma = log10 modal-energy-ratio cut-offs of the
    !!    3-D refinement indicator; ivar its driving variable (or SELF_AMR_ALLVARS).
    !!  - maxLevel >= 0 caps the refinement depth; nHalo >= 0 the refine halo, in columns.
    !!  - model2d (optional) : runs on surf, and is regridded and transferred with model3d.
    !!  - relativeEnergyFloor, energyWeights, significantEnergyFloor : the indicator's
    !!    amplitude gate, as for AMRController3D.
    implicit none
    class(ExtrudedAMRController),intent(out) :: this
    class(DGModel3D_t),intent(in) :: model3d
    type(Mesh2D),intent(in),target :: surf
    procedure(SELF_ExtrudedLevels) :: levels
    integer,intent(in) :: bottomBC
    integer,intent(in) :: topBC
    real(prec),intent(in) :: refineThreshold
    real(prec),intent(in) :: coarsenThreshold
    integer,intent(in) :: ivar
    integer,intent(in) :: maxLevel
    integer,intent(in) :: nHalo
    class(DGModel2D_t),intent(in),optional :: model2d
    real(prec),intent(in),optional :: relativeEnergyFloor
    real(prec),intent(in),optional :: energyWeights(:)
    real(prec),intent(in),optional :: significantEnergyFloor

    if(.not. associated(model3d%mesh)) then
      print*,__FILE__,':',__LINE__,' : Error : ExtrudedAMRController%Init requires an initialized 3-D model.'
      stop 1
    endif
    if(model3d%mesh%nLayers < 1) then
      print*,__FILE__,':',__LINE__,' : Error : ExtrudedAMRController%Init requires a model on an extruded mesh.'
      stop 1
    endif
    if(model3d%mesh%nElem /= model3d%mesh%nLayers*surf%nElem) then
      print*,__FILE__,':',__LINE__, &
        ' : Error : the 3-D model''s mesh was not extruded from the given surface mesh.'
      stop 1
    endif
    if(maxLevel < 0 .or. nHalo < 0) then
      print*,__FILE__,':',__LINE__,' : Error : ExtrudedAMRController%Init requires maxLevel >= 0 and nHalo >= 0.'
      stop 1
    endif
    if(present(model2d)) then
      if(.not. associated(model2d%mesh,surf)) then
        print*,__FILE__,':',__LINE__,' : Error : the 2-D model does not run on the given surface mesh.'
        stop 1
      endif
      if(model2d%geometry%x%interp%N /= model3d%geometry%x%interp%N) then
        print*,__FILE__,':',__LINE__,' : Error : the 2-D and 3-D models must use the same degree.'
        stop 1
      endif
      this%hasModel2D = .true.
      this%activeGeom2 => model2d%geometry
    endif

    this%levels => levels
    this%baseSurf => surf
    this%activeSurf => surf
    this%activeMesh => model3d%mesh
    this%activeGeom => model3d%geometry
    this%interp => model3d%geometry%x%interp
    this%ownsActive = .false.
    this%nz = model3d%mesh%nLayers
    this%bottomBC = bottomBC
    this%topBC = topBC
    this%ivar = ivar
    this%maxLevel = maxLevel
    this%nHalo = nHalo
    this%refineThreshold = refineThreshold
    this%coarsenThreshold = coarsenThreshold
    if(present(relativeEnergyFloor)) then
      this%relativeEnergyFloor = relativeEnergyFloor
      this%significantEnergyFloor = relativeEnergyFloor
    endif
    if(present(significantEnergyFloor)) this%significantEnergyFloor = significantEnergyFloor
    if(present(energyWeights)) then
      allocate(this%energyWeights(1:size(energyWeights)))
      this%energyWeights = energyWeights
    endif

    if(surf%decomp%nRanks > 1) then
      call InitForestFromDecomposedMesh(this%forest,surf)
    else
      call this%forest%Init(surf)
    endif
    call this%indicator%Init(this%interp,model3d%mesh%nElem,refineThreshold,coarsenThreshold)
    call this%ApplyIndicatorSettings()

  endsubroutine Init_ExtrudedAMRController