Version 18 (modified by 12 years ago) ( diff ) | ,
---|
Setting up an accretion disk simulation in Astrobear 2.0
This tutorial is designed to teach you the essential knowledge needed to set up a Disk module in AstroBEAR 2.0
Modules and Files
These directions assume that you are able to compile a problem, in case you have never compiled AstroBEAR check the page How to Build AstroBEAR 2.0
In order to set up a simple accretion disk simulation proceed to select the BasicDisk problem in the modules folder, this can be done by typing the following commands in the astrobear root directory:
cd modules ln -s BasicDisk Problem
After compilation, you need to be able to run the AstroBEAR executable, a tutorial for this procedure can be found at How to Run AstroBEAR 2.0 page.
Warning: It is good practice to delete profile.data from the problem folder before executing AstroBEAR for the first time, failure to do so will likely result in execution errors.
Getting familiar with the module
After checking that the disk module compiles and runs without any issues, you can examine the chombo files created by the first run of this module.
If you have no experience on visualization tools, the page VisIt Basics is a good resource to learn the basics of it.
The following image is a density plot of the disk at time t=0, a log scale has been applied to the perpendicular and parallel slices.
At his point you should start to get familiar with some of the elements in the image above:
- GxBounds: the boundaries of the plot, namely the physical boundaries of the simulation
- Radius: the radius of the disk
- Height: the height of the disk
- Ambient: the blue portion of the plot, it represents the area around the disk
- PointGravity: a point mass located at the center of the disk
Note: Numerical values reported by Visit are in computational units, scales.data contains the scales values needed to translate computational units to physical units.
Initial Conditions
Now you can proceed to examine problem.data contained in the BasicDisk folder. The default problem.data file contains a list of initial conditions that can be changed depending on the user's needs, let's analyze some of them
ddensity=1d0 | disk density |
adensity=0.001d0 | ambient density |
dtemp=1d4 | disk temperature |
atemp=6d6 | ambient temperature |
radius=2e10 | disk radius |
height=5e9 | disk height |
mass=.6d-1 | central particle mass |
Note: for this specific module, problem.data no scaling operation is required from the user
Sometimes it can be useful to change the size of the physical boundaries of the simulation, this can be done by modifying the section below contained in global.data
GxBounds = -10.d0, ! Problem boundaries in computational units. -10.d0, ! format: (xlower, ylower, zlower, xupper, yupper, zupper) -10.d0, ! For 2D problems, set zlower and zupper to 0.d0. 10.d0, 10.d0, 10.d0
Scales
AstroBEAR makes use of scales to adapt physical values to a numerical simulation, scales can affect the behavior of a model
Physics.data contains a section dedicated to the setting of scales:
nScale = 0.0, ! number density scale parameter [particles/cc] rScale = 1d0, ! density scale [g/cc], nScale is ignored !!! NOTE: if = 0 then nScale is used to find rScale TempScale = 1000d0, ! temperature scale parameter [Kelvin] pScale = 0.0, ! pressure scale [dynes/cm^2], TempScale is ignored !!! NOTE: if = 0 then TempScale is used to find pScale lScale = .5e10 ! length scale parameter [cm] (defines 1 computational unit!!!)
In the values listed above the disk radius is set to 2e10cm, with that, we set our length scale parameter (lScale) to be .5e10cm
the resulting ratio Rdisk/lScale is 4.
For convenience purposes, a rule of thumb is to keep the Rdisk/lScale within about one order of magnitude from the value above:
for example, if we had 2e15 as Rdisk a good lScale would be .5e15 or 1e15.
Warning: Always make sure to check physics.data for
MinTemp = 1e-3, ! minimum allowed temperature for the system, without cooling, this should be zero. MinDensity = 1e-3 ! Minimum computational density
and set them to appropriate values depending on the chosen scales.
Softening
Softening is a numerical trick commonly used in simulations to prevent divergences when a value comes close to another and the force of gravity goes to infinity.
In our case, as the radius of the disk gets smaller, the force of gravity is approximated to a well defined value.
Problem.data provides a field in which the user can set the preferred softening parameter:
soft_radius=.333d0 !diks radii soft_function=2 !NOSOFT=0, SPLINESOFT=1, PLUMMERSOFT=2
The plot below shows 3 different scenarios:
- No Softening: the force of gravity goes to infinity as the radius decreases
- Softening enabled: the force of gravity has a well defined value at r=0
- Increased softening radius: the force of gravity has a lower value at r=0 compared to the previous case
Astrobear provides different softening techniques such as SplineSoft and PlummerSoft, the user can set the softening function depending on the simulation needs.
Warning: It is good practice to keep the soft_radius between .1 and .3. Failure to do so may result in undesired outcomes.
AMR
The resolution of the simulation can be changed by modifying the following fields contained in global.data:
MaxLevel = 2 ! Maximum level for this simulation. GmX = 32, ! number of cells in x direction 32, ! number of cells in y direction 32, ! number of cells in z direction (set to 1 for 2D problems).
MaxLevel regulates the maximum amount of AMR levels, while GmX sets the number of cells in a fixed grid array.
Warning: global.data contains another array entry, Domain%mGlobal which should usually be set to (1, 1, 1, GmX(1), GmX(2), GmX(3)), changing Gmx without modifying Domain%mGlobal as well could lead to instabilities.
In this specific module refining is accomplished by defining a region around the disk that will always be marked for refinement. For more information how this is done please visit Controlling Refinement in AstroBEAR 2.0.
Below is an image of what the mesh looks like in the default module:
A subroutine named ProblemSetErrFlag in problem.f90 is responsible for marking the regions for refinement in our Disk module and giving the Mesh the pattern seen above.
Depending on the initial conditions of a specific run it may be the case that a disk undergoes gravitational collapse and its boundaries can expand within reasonable limits. This event can cause a significant part of the disk to outflow the refined area, and a consequential loss of information.
ProblemSetErrFlag can be altered to address this issue, changing
if (sqrt((x-xloc(1))**2+(y-xloc(2))**2).le.radius/lScale+2d0*dx) Info%ErrFlag(i,j,k)=1
to
if (sqrt((x-xloc(1))**2+(y-xloc(2))**2).le.radius*1.2d0/lScale+2d0*dx) Info%ErrFlag(i,j,k)=1
the refined radius can be increased.
Here is a comparison of what the mesh looks like before and after we made this change in problem.f90
Note: You need to recompile AstroBEAR after making any changes to problem.f90
Mach Number
When setting up a new simulation it is good practice to check that the Mach values are below a certain threshold, in most of computational simulation this value is ~60.
Values above this threshold may create difficulties in evolving a model and therefore create computational errors.
To plot the Mach numbers in Visit you can check the Visit page and locate Mach in the Chombo expressions list
The plot below represents a disk simulation that respects the limits stated above:
Other parameters
Now that you have acquired the essential knowledge to set up a disk module, you should be capable to change other aspects of a simulation such as:
- Equation of state
- Solvers
- MHD
- Boundary conditions
- Self gravity
- Accretion
You are advised to analyze every .data file to familiarize with other aspects of this module that were not discussed in this tutorial.
Attachments (5)
- famil.png (92.0 KB ) - added by 12 years ago.
- fgrav.png (22.3 KB ) - added by 12 years ago.
- visit0040.png (20.2 KB ) - added by 12 years ago.
- refinement.png (29.0 KB ) - added by 12 years ago.
- mach.png (110.8 KB ) - added by 12 years ago.
Download all attachments as: .zip