Changes between Version 20 and Version 21 of ModulesOnAstroBear
- Timestamp:
- 07/13/11 15:20:50 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ModulesOnAstroBear
v20 v21 77 77 Currently, AstroBEAR can only run 2D and 3D problems, but a 1D hydro or MHD problem can be simulated by defining a very narrow 2D problem domain and then making sure all the activity is defined in the x-direction (i.e., no {{{py}}} or {{{pz}}} components). 78 78 79 The ''core'' region of the {{{Info%q}}} array (which does not include ghost zones) is a {{{1:mx}}} by {{{1:my}}} by {{{1:mz}}} box. Mx, my, and mz denote the number of cells in the x, y, and z directions, respectively. In two dimensions, {{{mz}}} = 1, reducing the box to a rectangle. {{{Info%q}}} is cell-centered, so the values are assumed to be taken from the midpoint of the cell. Thus, the cell-to-space conversion is:79 The ''core'' region of the {{{Info%q}}} array (which does not include ghost zones) is a {{{1:mx}}} by {{{1:my}}} by {{{1:mz}}} box. mx, my, and mz denote the number of cells in the x, y, and z directions, respectively. In two dimensions, {{{mz}}} = 1, reducing the box to a rectangle. {{{Info%q}}} is cell-centered, so the values are assumed to be taken from the midpoint of the cell. Thus, the cell-to-space conversion is: 80 80 81 81 {{{ 82 82 x=(xlower + (REAL(i,xPrec)-half) * dx) 83 y=(ylower + (REAL(j,xPrec)-half) * dy) 84 z=(zlower + (REAL(k,xPrec)-half) * dz) 83 y=(ylower + (REAL(j,xPrec)-half) * dx) 84 z=(zlower + (REAL(k,xPrec)-half) * dx) 85 }}} 86 87 Note that {{{i, j, k, x, y, z, xlower, ylower, zlower, and dx}}} are user defined variables and are explained in further detail below. The variable {{{half}}} is used since the data is in the center of the cell, and {{{xPrec}}} is a type of precision. {{{half}}} and {{{xPrec}}} are already defined elsewhere and can be used if the following statement is at the beginning of {{{problem.f90}}}: 88 {{{ 89 USE GlobalDeclarations 85 90 }}} 86 91 … … 116 121 ==== Initializing a Grid ==== 117 122 118 Initializing a grid involves taking a spatially-constructed problem setup and discretizing it so that it fits nicely in an array. This process is easiest to explain by dissecting an example, such as the one below, where we are trying to initialize the grid with a density distribution given by {{{rho(x,y,z)}}}:119 120 Note that during the !ProblemGridInit routine, ghost zones do not need to be initialized (rmbc = 0) - however - during beforestep calculations they should be 123 Initializing a grid involves taking a spatially-constructed problem setup and discretizing it so that it fits nicely in an array. This process is easiest to explain by dissecting an example, such as the one below, where we are trying to initialize the grid with a general density distribution given by {{{rho(x,y,z)}}}: 124 125 Note that during the !ProblemGridInit routine, ghost zones do not need to be initialized (rmbc = 0) - however - during beforestep calculations they should be. 121 126 122 127 {{{ … … 140 145 DO i=1-rmbc, mx+rmbc 141 146 142 x=(xlower + (REAL(i )-half) * dx)143 y=(ylower + (REAL(j )-half) * dx)144 z=(zlower + (REAL(k )-half) * dx)147 x=(xlower + (REAL(i, xPrec)-half) * dx) 148 y=(ylower + (REAL(j, xPrec)-half) * dx) 149 z=(zlower + (REAL(k, xPrec)-half) * dx) 145 150 146 151 Info%q(i,j,k,irho) = rho(x,y,z)