Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Boundary Conditions

Chris White edited this page Mar 27, 2016 · 34 revisions

Input File

The boundary condition flags must be specified in the input file.

<mesh>
ix1_bc     = user          # inner-X1 boundary flag
ox1_bc     = user          # outer-X1 boundary flag
ix2_bc     = outflow       # inner-X2 boundary flag
ox2_bc     = outflow       # outer-X2 boundary flag
ix3_bc     = periodic      # inner-X3 boundary flag 
ox3_bc     = periodic      # outer-X3 boundary flag

The following flags are available:

  • outflow : outflowing (zero-gradient) boundary condition
  • reflecting : reflecting boundary condition
  • periodic : periodic boundary condition
  • polar : geometric boundary condition at the pole, available only for the x2-direction in spherical polar and similar coordinates
  • user : user-defined boundary condition

For cylindrical- and spherical-like coordinates one often has the azimuthal angle run from 0 to 2π with periodic boundaries. In addition, spherical-like coordinates often have the polar angle run from 0 to π with polar boundaries. See the next section for restrictions on polar boundary conditions.

Polar Boundary Conditions

While Athena++ supports having a reflecting wall or even outflow conditions along the polar axes in spherical-like coordinates, it also supports physically connecting the domain across the axes, allowing fluid to flow from one side to the other with no artificial boundary. This is done by specifying "polar" as the boundary condition for the polar angle. The following restrictions affect this mode:

  • The polar angle must extend to exactly 0 if connecting across the inner (North) pole, and to exactly π (3.141592653589793) if connecting across the outer (South) pole.
  • The azimuthal angle must extend from 0 to 2π (6.283185307179586), and it must have both inner and outer boundaries be periodic, if any polar boundary is used.
  • There must be an even number of cells in the azimuthal direction.
  • The number of MeshBlocks in the azimuthal direction must be either 1 or an even number.
  • All MeshBlocks touching a given pole, no matter at what radius, must be at the same level of refinement.

The last condition is not currently checked by the code. Polar boundaries work with static mesh refinement, but the user must make sure the refinement scheme does not violate the same-level requirement. Currently adaptive mesh refinement does not protect against the grid evolving to an invalid refinement state.

User-Defined Boundary Conditions

In order to use the user-defined boundary conditions, the user-defined boundary conditions must be enrolled in Mesh::InitUserMeshProperties in the problem generator file.

First, the boundary condition function must be defined. This function has a certain prototype:

void MyBoundary_ix1(MeshBlock *pmb, Coordinates *pco, AthenaArray<Real> &a, FaceField &b,
                    int is, int ie, int js, int je, int ks, int ke);

And then enroll it:

  EnrollUserBoundaryFunction(INNER_X1, MyBoundary_ix1);

For details, see the Programmer Guide.

Clone this wiki locally