Version 2 (modified by 12 years ago) ( diff ) | ,
---|
Ambient Objects
Description
As its name implies, the Ambient
object contains information about the background for a simulation. Unlike the UniformRegion
object, the Ambient
object has no shape or physical extent. It essentially does what the InitAmbient
routine did using data from the modules.data
file. This however, prevented users from being able to calculate and specify the initial ambient values at run time. The Ambient
object allows for a simple interface for setting the background density, velocity, pressure, and magnetization. The object (if used) must be created during the ProglemModuleInit
subroutine.
Object Attributes
TYPE AmbientDef REAL(KIND=qPREC) :: density=1d0 REAL(KIND=qPREC) :: velocity(3)=0d0 REAL(KIND=qPREC) :: pressure=1d0 REAL(KIND=qPREC) :: B(3) = 0d0 ... END TYPE AmbientDef
The default values for density and pressure are both 1. The velocity and magnetization vectors are 0 - and there is no ambient tracer. To turn on an ambient tracer, the value of iTracer needs to be initialized to a valid tracer index using the AddTracer routine.
How to Use this Object
This object is perhaps the simplest to use since it has no shape. One only has to create the ambient object and modify its default values as necessary (and potentially add a tracer field).
A simple call initializes this object:
CreateAmbient(Ambient, [density, pressure])
Other attributes can be set directly by accessing this object after instantiation, below is a quick example:
... TYPE(AmbientDef), POINTER :: myAmbient !Pointer to ambient object CreateAmbient(myAmbient, 1d0, 2d0) !Creates an ambient instance with density=1, and pressure=2 Ambient%B(:)=(/0d0, 0d0, 0d0/) !Magnetic field settings Ambient%velocity(:)=(/0d0, 0d0, 0d0/) !Ambient velocity settings CALL AddTracer(Ambient%iTracer, 'Ambient Tracer') ...
Grids then will be initialized with the correct energy etc… before being passed into the various other grid initialization routines.
Ambient profiles
AstroBEAR offers the possibility of instantiating ambient objects with custom density and pressure profiles. To do this, it is necessary to associate an ambient object with a profile object.
TYPE(AmbientDef), POINTER :: myAmbient !ambient object pointer TYPE(ProfileDef), POINTER :: hydrostaticProfile !profile object pointer ... Ambient%profile => hydrostaticProfile !association ...