Version 1 (modified by 12 years ago) ( diff ) | ,
---|
Additional Physics
AstroBEAR supports hydrodynamics and AMR by default. Other physical processes such as magnetic fields and source terms require extra overhead, so they must be enabled by the user.
MHD
Enabling MHD requires two changes to the data files:
- In
global.data
, set theMaintainAuxArrays
flag toT
. - In
physics.data
, setlMHD
toT
.
You will also need to initialize the aux
arrays in your module file. In fact, magnetic fields are often initialized by setting the aux
values first, and then calculating the cell-centered magnetic fields in q
by averaging the aux
values on either side of a cell:
Info%q(i,j,k,iBx) = half * (Info%aux(i,j,k,1) + Info%aux(i+1,j,k,1)) Info%q(i,j,k,iBy) = half * (Info%aux(i,j,k,1) + Info%aux(i,j+1,k,2)) Info%q(i,j,k,iBz) = half * (Info%aux(i,j,k,1) + Info%aux(i,j,k+1,3))
Cooling
Two things are required to turn on cooling: the lCooling
flag to indicate that cooling is active in this simulation, and iCooling
to specify the type of cooling to use. These values are usually included in the problem.data
file. The user must also create a cooling object in ProblemModuleInit()
to manage the cooling settings. An example of cooling object creation can be seen below:
IF(iCooling>0) THEN IF (.NOT. lRestart) THEN ! see sources/cooling.f90::CreateCoolingObject for ! default values of a cooling source term CALL CreateCoolingObject(coolingobj) ELSE coolingobj => firstcoolingobj END IF END IF coolingobj%iCooling=iCooling SELECT CASE(iCooling) ! cases defined in sources/cooling.f90 CASE(NoCool) CASE(AnalyticCool) coolingobj%alpha=alpha coolingobj%beta=beta CASE(DMCool) CASE(IICool) CASE DEFAULT END SELECT coolingobj%floortemp=1d0 coolingobj%mintemp=0.001
The .NOT. lRestart
conditional prevents AstroBEAR from creating a new cooling object on restarts; this is because the cooling objects will be read in from the restart files.
Self-Gravity
AstroBEAR uses the hypre library to solve the self-gravity equations. To use self-gravity:
- Look for the
HYPREFLAG
variable inMakefile.inc
and make sure that it is set to1
. - Set the
lSelfGravity
flag in yourphysics.data
file and set it toT
.
Hypre will automatically initialize the potential field using the density. The only caveat is that the initial density cannot be uniform. When the density is uniform, hypre produces a singular matrix that it can't solve. Fortunately, a small density perturbation takes care of this problem without substantially affecting the dynamics of the domain. AstroBEAR comes with a Perturbation object type that can be used for this.
Sink Particles
The ability to form sink particles in AstroBEAR is tied to self-gravity. To simply enable sink particles:
- Look for the
HYPREFLAG
variable inMakefile.inc
and make sure that it is set to1
. - Set the
lSelfGravity
flag in yourphysics.data
file and set it toT
.
If you just want your simulation to have the option of forming sink particles, no further action is required. If you want to start your simulation off with sink particles, then you will have to create one in problem.f90::ProblemModuleInit()
:
NAMELIST /ProblemData/ nParticles NAMELIST /ParticleData/ mass,xloc,vel OPEN(UNIT=PROBLEM_DATA_HANDLE, FILE='problem.data', STATUS="OLD") READ(PROBLEM_DATA_HANDLE,NML=ProblemData) IF (.NOT. lRestart) THEN DO i=1,nParticles READ(PROBLEM_DATA_HANDLE,NML=ParticleData) NULLIFY(Particle) CALL CreateParticle(Particle) Particle%mass=mass Particle%xloc=xloc Particle%vel=vel CALL AddSinkParticle(Particle) END DO CLOSE(PROBLEM_DATA_HANDLE) OPEN(UNIT=PROBLEM_DATA_HANDLE, FILE='restart.data', STATUS="UNKNOWN") WRITE(PROBLEM_DATA_HANDLE,NML=RestartData) CLOSE(PROBLEM_DATA_HANDLE) END IF
Depending on the features of your simulation, more objects might have to be declared in conjunction with the sink particle. The .NOT. lRestart
conditional is important, as it prevents AstroBEAR from adding the same particle again on a restart.
Attachments (2)
- Stencil.png (62.7 KB ) - added by 12 years ago.
- Stencil.odg (23.1 KB ) - added by 12 years ago.
Download all attachments as: .zip