Version 14 (modified by 12 years ago) ( diff ) | ,
---|
SUBROUTINE Protect(Info,nGhost)
Defined in:
contrib/astro/physics/i_protect.f90
Inputs:
NodeInfo
Info, nGhost
Description:
Protect does a variety of checks based on the iProtect switch in Physics.data.
- First, arrays are allocated and assigned for the current values of Pressure (Pre) and density (rho) on the grid.
- Tracer fields are protected by allowing them to not be limited by density. The assigned values depend of the value of iLTracer, set in physics.data.
- Species fields are then protected to ensure that their sum is never negative or 0. Then they are normalized by multiplying by the density and dividing by the total number of particles to yield a percentage by number of the total density.
- Next, both pressure and density protections are initialized. Where rho and/or pressure are less than the minimum tolerance (1e-14) each cell value is set to the value "infinity" (1e30). Where rho is set to infinity, pressure is also set to infinity.
- Density protect: A warning is printed for each cell. Then the surrounding 3x3x3 or 3x3x1 (in 2D) block is searched for the minimum value of density. If one is found, the center cell is set to that value, and momentum recalculated from the initial speed and new density. The tracer fields are also set to the values from the replacing cell. If no cell in this block is found with an acceptable value (non-"infinity"), then "No positive density neighbor found" is printed, and the program stops.
- Pressure protect: A warning is printed for each cell. Then the surrounding 3x3x3 or 3x3x1 (in 2D) block is searched for either the minimum value of Pressure/density (iProtect = 1) or the minimum value of Pressure (iProtect = 2). If no cell in this block is found with an acceptable value, a warning message is printed and the surrounding 5x5x5 or 5x5x1 block is then searched. If no acceptable value is found there, then "No positive pressure extended neighbor found" is printed, and the pressure is set to the minimum tolerance value (1e-14).
- If a density or pressure protection has been made, a check is performed to ensure that the speed and speed of sound waves (based on new values of pressure, density, and momentum) of the protected cell are not CFL limiting. If the current CFL of the cell in each direction is greater than 90% of the desired Courant number, then the momentum that particular direction is set to the greater of 0 or the value that makes the CFL of the cell exactly 90% of the desired Courant number (cflv(2)).
- Finally, the energy value for the new pressure and momentum of the cell is calculated.
Called In:
- problem.f90 in subroutine b4step, and again in subroutine afterfixup
Modules Used:
Cooling, only lProtectNeq, eos_vars
- Side note: The subroutine EOS_vars is not actually called, nor is the variable lProtectNeq actually used at this point. These could probably be eliminated.
Files Included:
None.
Note:
See TracWiki
for help on using the wiki.