Attach the controller to an initialized model. The model's current mesh becomes the forest's base mesh (level 0); its geometry interpolant drives the indicator and the solution transfer. Thresholds are the sigma = log10 modal-energy-ratio cut-offs of the refinement indicator (refineThreshold > coarsenThreshold; see SELF_RefinementIndicator_2D). ivar is the driving solution variable (or SELF_AMR_ALLVARS). maxLevel >= 0 caps the refinement depth; nHalo >= 0 sets the refine-flag halo width in elements.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(AMRController2D), | intent(out) | :: | this | |||
| class(DGModel2D_t), | intent(in) | :: | model | |||
| real(kind=prec), | intent(in) | :: | refineThreshold | |||
| real(kind=prec), | intent(in) | :: | coarsenThreshold | |||
| integer, | intent(in) | :: | ivar | |||
| integer, | intent(in) | :: | maxLevel | |||
| integer, | intent(in) | :: | nHalo |
subroutine Init_AMRController2D(this,model,refineThreshold,coarsenThreshold,ivar, &
maxLevel,nHalo)
!! Attach the controller to an initialized model. The model's current mesh becomes the
!! forest's base mesh (level 0); its geometry interpolant drives the indicator and the
!! solution transfer. Thresholds are the sigma = log10 modal-energy-ratio cut-offs of the
!! refinement indicator (refineThreshold > coarsenThreshold; see
!! SELF_RefinementIndicator_2D). ivar is the driving solution variable (or
!! SELF_AMR_ALLVARS). maxLevel >= 0 caps the refinement depth; nHalo >= 0 sets the
!! refine-flag halo width in elements.
implicit none
class(AMRController2D),intent(out) :: this
class(DGModel2D_t),intent(in) :: model
real(prec),intent(in) :: refineThreshold
real(prec),intent(in) :: coarsenThreshold
integer,intent(in) :: ivar
integer,intent(in) :: maxLevel
integer,intent(in) :: nHalo
if(.not. associated(model%mesh)) then
print*,__FILE__,':',__LINE__, &
' : Error : AMRController2D%Init requires an initialized model.'
stop 1
endif
if(maxLevel < 0 .or. nHalo < 0) then
print*,__FILE__,':',__LINE__, &
' : Error : AMRController2D%Init requires maxLevel >= 0 and nHalo >= 0.'
stop 1
endif
this%baseMesh => model%mesh
this%activeMesh => model%mesh
this%activeGeom => model%geometry
this%interp => model%geometry%x%interp
this%ownsActive = .false.
this%ivar = ivar
this%maxLevel = maxLevel
this%nHalo = nHalo
this%refineThreshold = refineThreshold
this%coarsenThreshold = coarsenThreshold
! Rank-replicated forest: on one rank, straight from the mesh; on several, from the
! allgathered global base tables (every rank builds the identical forest).
if(model%mesh%decomp%nRanks > 1) then
call InitForestFromDecomposedMesh(this%forest,model%mesh)
else
call this%forest%Init(model%mesh)
endif
call this%indicator%Init(this%interp,model%mesh%nElem,refineThreshold,coarsenThreshold)
endsubroutine Init_AMRController2D