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

Passive Scalars

Kyle Gerard Felker edited this page May 3, 2019 · 16 revisions

A passive scalar is a quantity that is transported by the fluid but does not alter the fluid's behavior. To configure the code to evolve one or more species of passive scalars, run the configure.py script with --nscalars=N. This will set the internal preprocessor macro NSCALARS to N. See Configuring page for more details.

As mentioned within the Problem Generators page, if NSCALARS > 0, the required implementation of void MeshBlock::ProblemGenerator(ParameterInput *pin) must initialize the conservative formulation AthenaArray<Real> PassiveScalar::s of each type of passive scalar on every MeshBlock. For example:

  Real d0 = 1.0;  // uniform fluid density across the mesh
  // initialize conserved variables
  for (int k=ks; k<=ke; k++) {
    for (int j=js; j<=je; j++) {
      pcoord->CellVolume(k, j, is, ie, vol);
      for (int i=is; i<=ie; i++) {
        // uniformly fill all scalars to have equal concentration
        constexpr int scalar_norm = NSCALARS > 0 ? NSCALARS : 1.0;
        if (NSCALARS > 0) {
          for (int n=0; n<NSCALARS; ++n) {
            pscalars->s(n,k,j,i) = 1.0/scalar_norm*cell_ave*d0;
          }
        // ... initialize Hydro conserved variables
        }
      }
    }
  }

When NSCALARS > 0, the Outputs that specify either cons or prim variables will automatically include the conservative or primitive formulation of each passive scalar species, respectively.

The treatment of passive scalars is also compatible with both Static Mesh Refinement and Adaptive Mesh Refinement.

Diffusion Processes are also supported for the passive scalars, and can be activated by setting a positive problem/nu_scalar_iso value in The Input File or when Overriding Input Parameters.

Example

> make clean; ./configure.py --prob=slotted_cylinder --eos=isothermal --nscalars=1 --nghost=4 -mpi -hdf5; make -j
> cd bin
> mpirun -n 8 ./athena -i ../inputs/hydro/athinput.slotted_cylinder2d_refined mesh/nx1=100 mesh/nx2=100 mesh/refinement=adaptive time/xorder=3 time/integrator=rk3

Figure 1: plot of the passive scalar advection of a 2D slotted cylinder profile at t=0.4 using RK3+PPM with AMR. 2D slotted cylinder

Figure 2: same result as shown in Figure 1 but zoomed-in near the sharp discontinuities around the slot. 2D slotted cylinder zoomed

Clone this wiki locally