This test shows how to easily transport extra variables using the finite volume solver. Extra variables are conserved scalars that are transported with the flow. Examples include zMix and other progresses variables.

compressibleFlow/extraVariableTransport.yaml

---
test:
  # a unique test name for this integration tests
  name: extraVariableTransport
  # the number of ranks to run with mpi
  ranks: 1
  # create a list of asserts to compare
  asserts:
    # create a default assert that compares the log file
    - "inputs/compressibleFlow/extraVariableTransport/extraVariableTransport.txt"
    - !testingResources::asserts::TextFileAssert
      expected: "inputs/compressibleFlow/extraVariableTransport/a.csv"
      actual: "a.csv"
    - !testingResources::asserts::TextFileAssert
      expected: "inputs/compressibleFlow/extraVariableTransport/b.csv"
      actual: "b.csv"
    - !testingResources::asserts::TextFileAssert
      expected: "inputs/compressibleFlow/extraVariableTransport/c.csv"
      actual: "c.csv"
    - !testingResources::asserts::TextFileAssert
      expected: "inputs/compressibleFlow/extraVariableTransport/rakeProbe/rakeProbe.txt"
      actual: "rakeProbe/rakeProbe.txt"
    - !testingResources::asserts::TextFileAssert
      expected: "inputs/compressibleFlow/extraVariableTransport/rakeProbe/rakeProbe.0.csv"
      actual: "rakeProbe/rakeProbe.0.csv"
    - !testingResources::asserts::TextFileAssert
      expected: "inputs/compressibleFlow/extraVariableTransport/rakeProbe/rakeProbe.1.csv"
      actual: "rakeProbe/rakeProbe.1.csv"
    - !testingResources::asserts::TextFileAssert
      expected: "inputs/compressibleFlow/extraVariableTransport/rakeProbe/rakeProbe.2.csv"
      actual: "rakeProbe/rakeProbe.2.csv"

# metadata for the simulation
environment:
  title: _extraVariableTransport
  tagDirectory: false
arguments:
  dm_plex_separate_marker: ""
# set up the time stepper responsible for marching in time
timestepper:
  # use io to save results to a file allowing visualization and restart
  io:
    interval: 0
  name: theMainTimeStepper
  # time stepper specific input arguments
  arguments:
    ts_type: rk
    ts_adapt_type: physics # overwrite and set the time step based upon the CFL constraint
    ts_max_steps: 20
    ts_adapt_safety: 1.0
  # the domain/mesh must be specified at the start of a simulation
  domain: !ablate::domain::BoxMesh
    name: simpleBoxField
    faces: [ 13, 13 ]
    lower: [ 0, 0 ]
    upper: [ 1, 1 ]
    boundary: [ "NONE", "NONE" ]
    simplex: false

    # specify any modifications to be performed to the mesh/domain
    modifiers:
      # if using mpi, this modifier distributes cells
      - !ablate::domain::modifiers::GhostBoundaryCells

      # if using a FVM ghost boundary cells must be added
      - !ablate::domain::modifiers::DistributeWithGhostCells

    fields:
      # all fields must be defined before solvers.  The ablate::finiteVolume::CompressibleFlowFields is a helper
      # class that creates the required fields for the compressible flow solver (rho, rhoE, rhoU, ...)
      - !ablate::finiteVolume::CompressibleFlowFields
        eos: !ablate::eos::PerfectGas &eos
          parameters:
            gamma: 1.4
            Rgas: 287

      # the solver class can take extraVariable arguments.  This defines the conserved and non-conserved field for each component
      - !ablate::finiteVolume::ExtraVariable
        components: [ "ev1", "ev2" ]

  initialization:
    # the ablate::finiteVolume::fieldFunctions::Euler helper can define the "euler" field (rho, rhoE, rhoU, rhoV) from more common inputs
    - !ablate::finiteVolume::fieldFunctions::Euler
      &eulerFlowFieldState
      state: &flowFieldState
        eos: *eos
        temperature: "300"
        pressure: "101325.0"
        velocity: "25., 25"
    # the density*ev field must be specified. The DensityExtraVariables class helps by computing density and each ev value using the specified list functions
    - !ablate::finiteVolume::fieldFunctions::DensityExtraVariables
      &densityEVFlowFieldState
      state: *flowFieldState
      # a list of functions used to describe the extra variable initialization
      functions:
        - .25 # ev1 is set to a constant value of 0.25
        - !ablate::mathFunctions::geom::Sphere
          # the sphere methFunction can be used to specify ev2 with a different number inside (1.5) and outside (0, by default)
          center: [ .25, .25 ]
          radius: .25
          insideValues: 1.5

# this problem uses a single solver (!ablate::finiteVolume::CompressibleFlowSolver)
solver: !ablate::finiteVolume::CompressibleFlowSolver
  id: evExample
  parameters:
    cfl: .5
  # a flux calculator must be specified to so solver for advection
  fluxCalculator: !ablate::finiteVolume::fluxCalculator::AusmpUp
    mInf: .3

  # the default transport object assumes constant values for k, mu, diff
  transport:
    diff: 1E-4
    k: 1E-4
    mu: 1E-4

  # share the existing eos with the compressible flow solver
  eos: *eos

  additionalProcesses:
    # the ArbitrarySource process was added to define a region of additional ev source
    - !ablate::finiteVolume::processes::ArbitrarySource
      densityEV:
        !ablate::mathFunctions::geom::Sphere
        radius: .1
        center: [ 0.75, 0.75 ]
        insideValues: "0.0, 100" # inside the sphere the ev1 gets no extra source while ev2 gets 100

  # using constant boundary condition values on all sides with the specified values for euler and densityFlow based upon the previous boundary values
  boundaryConditions:
    - !ablate::finiteVolume::boundaryConditions::EssentialGhost
      boundaryName: "walls"
      labelIds: [ 1, 2, 3, 4 ]
      boundaryValue: *eulerFlowFieldState
    - !ablate::finiteVolume::boundaryConditions::EssentialGhost
      boundaryName: "walls"
      labelIds: [ 1, 2, 3, 4 ]
      boundaryValue: *densityEVFlowFieldState

  monitors:
    # output the time and dt at each time step
    - !ablate::monitors::TimeStepMonitor

    # define a list of probes to record high frequency information
    - !ablate::monitors::Probes
      probes:
        - name: a
          location: [ .25, .25 ]
        - name: b
          location: [ .75, .25 ]
        - name: c
          location: [ .25, .75 ]
      bufferSize: 10
      variables: [ velocity, densityEV, EV, euler ] # these fields will be saved to a text file at the specified locations

    # define a probe using a rake, which uses a start/end location and a number of probes to compute initial probe locations
    - !ablate::monitors::Probes
      probes: !ablate::monitors::probes::Rake
        name: rakeProbe
        start: [ .75, .5 ]
        end: [ .25, 0.5 ]
        number: 3
      bufferSize: 10
      variables: [ velocity, densityEV, EV, euler ]  # these fields will be saved to a text file at the specified locations