|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
#include "ERF.H"#include "ERF_Constants.H"#include "ERF_EOS.H"#include <AMReX_PlotFileUtil.H>#include <AMReX_VisMF.H>#include <algorithm>#include <array>#include <limits>#include <string>
The reflux of the pressure impulse on the faces of a coarse level that lie on the coarse/fine boundary and are normal to the momentum on them (erf.momentum_reflux, on by default where it is done; erf-model/ERF#5017).
The momenta live on faces, and the momentum flux of a face's control volume is at the cell centers on either side of it. Under two-way coupling the composite solution is the fine level where there is one and the coarse level elsewhere, and the control volume of a coarse/fine face then runs from the center of the uncovered coarse cell beside it to the center of the first fine cell, a width h = (dx_c + dx_f) / 2. The fine level does not evolve its coarse/fine faces (they are set from the coarse level), and its first interior face takes its flux at the center of the first fine cell. The coarse level, though, updates the coarse/fine face with its own flux at the center of the covered coarse cell, over its own width dx_c. What the fine interior gives up at its edge is not what the coarse/fine face receives, and nothing puts the difference back: the composite momentum is not conserved (#5017). In the cases there the difference is almost all pressure.
So each level adds up, over each coarse step of level 0, the pressure its x- and y-momenta saw in each cell: the stage pressure of the slow right-hand side and the acoustic part of the substeps, in the RK stage whose update the step ends with, each times the interval it is applied over. At the end of the step (post_timestep), for each such coarse/fine face of the coarse level, the impulse that the pressure difference across the composite control volume, from the uncovered coarse cell to the first fine cell, over h, would have given it, less the one the coarse level gave it, is
delta (rho u) = - (P_f - P_c(I-1)) / h + (P_c(I) - P_c(I-1)) / dx_c (fine level on the high side)
with P the time integral of the pressure and P_f that of the first fine cells, averaged over the face. The composite x-momentum (the control volume of each coarse/fine face being h wide) then changes, up to the approximations below, only by what crosses the domain boundary.
The impulse is not added to the momenta at once but as a momentum source on those faces of the coarse level, at a constant rate over its steps in the next coarse step of level 0; the fine level's coarse/fine faces follow the coarse level's as always. Added at once, it acts as an explicit acoustic update over a whole coarse step, at an acoustic Courant number far above one, and where the coarse/fine faces of two directions meet (the vertical edges of a patch) it grows from one step to the next. As a source, the acoustic substeps take it in. So the momentum at the end of a step is short by the impulse of that step, which the next step gives. That last impulse is written to checkpoints (Level_<lev>/MomRefluxX and MomRefluxY) and read back, so a restarted run gives it as the run that wrote the checkpoint does. It is dropped when the coarse level's grids change, and it is not made in a step in which the grids of either level change. A level that loses its fine level gives its last impulse once, in the next step, and none after that; the faces are then ordinary coarse faces, of width dx_c and not h, so the budget does not close across that regrid.
Only the pressure is refluxed: not the advective or diffusive momentum fluxes, nor the momentum sources on these faces, nor the momentum on coarse/fine faces parallel to it, nor (rho w) on the z-faces. The pressure is taken as a cell value: the acoustic part is gamma R_d pi (rho theta)'' with the Exner function pi of the cell, where the substep uses its average over the face, and the factor 1/(1+q_t) is that of the cell where the substep uses its face average. Both differences are of second order in the perturbation. Map factors are taken to be one. This is done for fully compressible levels on flat meshes, of constant or stretched dz, without EB. On a stretched mesh the fine levels split each coarse cell into equal layers (init_zlevels interpolates the z-levels linearly), so the plain average of the fine pressures across a coarse face is its area average.