wiki:UniformRegions

Version 5 (modified by trac, 12 years ago) ( diff )

Uniform Regions

Description

As its name implies, the UniformRegion object defines a region where the hydrodynamic variables are constant. The region itself is defined by a Shape object that is instantiated when UniformRegion is created. The UniformRegion can be used as a one-shot or it can be made persistent, in which case it would be renewed before every step (i.e., by a subroutine called in beforeStep()).


Object Attributes

TYPE UniformRegion {
    TYPE(ShapeDef), POINTER :: Shape
    REAL(KIND=qPREC), DIMENSION(:), ALLOCATABLE :: q
    INTEGER :: SubSample = 1
    LOGICAL :: PersistInBoundaries = .false.
    LOGICAL :: PersistInternal = .false.
}
  • *Shape: A pointer to a Shape object that defines the dimensions of the region this object will keep uniform.
  • q: A state vector containing the hydrodynamic variable values this object will enforce within the uniform region.
  • SubSample: An integer value used to determine the sub-sampling resolution. The default value for SubSample is 1.
  • PersistInBoundaries: Indicates whether the uniform region is persistent. Under this option, beforeStep() only enforces the uniform region up to a grid's physical boundaries. By default, this option is turned off.
  • PersistInternal: Indicates whether the uniform region is persistent. Under this option, beforeStep() will enforce the uniform region within a grid's ghost regions as well. By default, this option is turned off.


How to Use this Object

The uniform regions object contains a Shape object that defines where the uniform value q is to be applied. The SubSample defines how many sub cells in each direction are sampled. If PersistInBoundaries is true then anywhere the object overlaps with physical boundaries - the values are maintained during the simulation. If PersistInternal is true then the values are maintained wherever the object exists.

SUBROUTINE ProblemModuleInit()
  TYPE(UniformRegionDef), POINTER :: UniformRegion

  CALL CreateUniformRegion(UniformRegion) 

  UniformRegion%q(1:NrHydroVars)=qout(1:NrHydroVars)
  UniformRegion%q(1)=density

  CALL SetShapeType(UniformRegion%Shape, CIRCLE, radius)
  CALL SetShapeOrientation(UniformRegion%Shape, psi, theta, phi)
  SplitRegion%Shape%Position=position

  CALL SetShapeBounds(UniformRegion%Shape)
END SUBROUTINE ProblemModuleInit

When you call CreateUniformRegion() it instantiates all the pointer/allocatable attributes of a UniformRegion object and adds it to a global list of UniformRegion objects. The UniformRegion%q array is allocated with NrHydroVars elements.

As of revision 566, the user must manually set the values for UniformRegion%q (see the example above). Configuring the UniformRegion%Shape object is also the user's responsibility.

The setup above assumes that the uniform area is only an initial condition. To maintain the uniform area throughout the simulation, set one of the PersistIn attributes; either

UniformRegion%PersistInInternal = .TRUE.

or

UniformRegion%PersistInBoundaries = .TRUE.

Be sure to set only one flag at a time. PersistInBoundaries is a subset of PersistInInternal, so setting both flags will either make more cells uniform than you intended, or it will do unnecessary work.


Uniformity takes effect when PlaceUniformRegion(Info) is called in ProblemGridInit(Info). When this subroutine is called, all hydrodynamic variables in the region contained within UniformRegion%Shape are set to match UniformRegion%q.

The dimensions of Shape objects are derived from spatial coordinates, which means that a uniform region could wind up cutting across one or more cells. To compensate for this, PlaceUniformRegion() performs sub-sampling on each cell in the domain that overlaps the dimensions of the UniformRegion%Shape object. Individual cells have a degree of uniformity based on how much of their area lies within the uniform region. This means that interior cells (which lie entirely within the uniform region) are completely uniform, while boundary cells have varying degrees of uniformity.

Note: See TracWiki for help on using the wiki.