Skip to content

Commit

Permalink
Fix diffusion of scalars (#1669)
Browse files Browse the repository at this point in the history
* 1) bug fix: correct which-time cons array we send into Diffusion from rhs_post, 2)add cloud cover and integrated TKE diagnostics, 3) update BOMEX prob.cpp and input_Kessler

* fix misspellings only

* add Blocs to ignore-words

* more spelling fixes

* fix more spellings

* Dont try to write stress diagnostics at t=0
  • Loading branch information
asalmgren authored Jul 9, 2024
1 parent 98e8a56 commit ded446b
Show file tree
Hide file tree
Showing 61 changed files with 339 additions and 207 deletions.
7 changes: 5 additions & 2 deletions .codespell-ignore-words
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
latice
Blocs
BOUN
inout
parms
pres
ptd
rime
wth
2 changes: 1 addition & 1 deletion Docs/sphinx_doc/Applications_Requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ These standards should be articulated at a sufficient level of detail to guide c
Implementation Details for Specific Code Components
===================================================

This section provides detailed information on core elements of the ERF code that enable its required functionality. Details of both the formulation of methods and their implementation and useability within the code will be added to the existing higher-level descriptions as the project progresses.
This section provides detailed information on core elements of the ERF code that enable its required functionality. Details of both the formulation of methods and their implementation and usability within the code will be added to the existing higher-level descriptions as the project progresses.

1. Governing Equation Set
-------------------------
Expand Down
6 changes: 3 additions & 3 deletions Docs/sphinx_doc/BoundaryConditions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ As an example,
xlo.theta = 300.
xlo.scalar = 2.

sets the boundary condtion type at the low x face to be an inflow with xlo.type = “Inflow”.
sets the boundary condition type at the low x face to be an inflow with xlo.type = “Inflow”.

xlo.velocity = 1. 0. 0. sets all three componentns the inflow velocity,
xlo.density = 1. sets the inflow density,
Expand Down Expand Up @@ -133,7 +133,7 @@ Couette regression test example, in which we specify
We also note that in the case of a "slipwall" boundary condition in a simulation with non-zero
viscosity specified, the "foextrap" boundary condition enforces zero strain at the wall.

The keywork "MOST" is an ERF-specific boundary type; see :ref:`sec:MOST` for more information.
The keyword "MOST" is an ERF-specific boundary type; see :ref:`sec:MOST` for more information.

It is important to note that external Dirichlet boundary data should be specified
as the value on the face of the cell bounding the domain, even for cell-centered
Expand Down Expand Up @@ -192,7 +192,7 @@ and :math:`n` is the minimum number of grid points from a lateral boundary.
Sponge zone domain BCs
----------------------

ERF provides the capability to apply sponge zones at the boundaries to prevent spurious reflections that otherwise occur at the domain boundaries if standard extrapolation boundary condition is used. The sponge zone is implemented as a source term in the governing equations, which are active in a volumteric region at the boundaries that is specified by the user in the inputs file. Currently the target condition to which the sponge zones should be forced towards is to be specifed by the user in the inputs file.
ERF provides the capability to apply sponge zones at the boundaries to prevent spurious reflections that otherwise occur at the domain boundaries if standard extrapolation boundary condition is used. The sponge zone is implemented as a source term in the governing equations, which are active in a volumteric region at the boundaries that is specified by the user in the inputs file. Currently the target condition to which the sponge zones should be forced towards is to be specified by the user in the inputs file.

.. math::
Expand Down
12 changes: 6 additions & 6 deletions Docs/sphinx_doc/Discretizations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,12 @@ The goal is to compute eddy viscosity at the *cell centers* and interpolated the
.. math::
\begin{matrix}
S_{12} = & \frac{1}{4}\left\lbrack S_{12i,j - \frac{1}{2}} + S_{12i,j + \frac{1}{2}} + S_{12i + 1,j - \frac{1}{2}} + S_{12i + 1,j + \frac{1}{2}} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrouding the cell}\end{smallmatrix} \\
S_{21} = & \frac{1}{4}\left\lbrack S_{21i - \frac{1}{2},j} + S_{21i + \frac{1}{2},j} + S_{21i - \frac{1}{2},j + 1} + S_{21i + \frac{1}{2},j + 1} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrouding the cell}\end{smallmatrix} \\
S_{13} = & \frac{1}{4}\left\lbrack S_{13i,k - \frac{1}{2}} + S_{13i,k + \frac{1}{2}} + S_{13i + 1,k - \frac{1}{2}} + S_{13i + 1,k + \frac{1}{2}} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrouding the cell}\end{smallmatrix} \\
S_{31} = & \frac{1}{4}\left\lbrack S_{31i - \frac{1}{2},k} + S_{31i + \frac{1}{2},k} + S_{31i - \frac{1}{2},k + 1} + S_{31i + \frac{1}{2},k + 1} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrouding the cell}\end{smallmatrix} \\
S_{23} = & \frac{1}{4}\left\lbrack S_{23j,k - \frac{1}{2}} + S_{23j,k + \frac{1}{2}} + S_{23j + 1,k - \frac{1}{2}} + S_{23j + 1,k + \frac{1}{2}} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrouding the cell}\end{smallmatrix} \\
S_{32} = & \frac{1}{4}\left\lbrack S_{32j - \frac{1}{2},k} + S_{32j + \frac{1}{2},k} + S_{32j - \frac{1}{2},k + 1} + S_{32j + \frac{1}{2},k + 1} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrouding the cell}\end{smallmatrix}
S_{12} = & \frac{1}{4}\left\lbrack S_{12i,j - \frac{1}{2}} + S_{12i,j + \frac{1}{2}} + S_{12i + 1,j - \frac{1}{2}} + S_{12i + 1,j + \frac{1}{2}} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrounding the cell}\end{smallmatrix} \\
S_{21} = & \frac{1}{4}\left\lbrack S_{21i - \frac{1}{2},j} + S_{21i + \frac{1}{2},j} + S_{21i - \frac{1}{2},j + 1} + S_{21i + \frac{1}{2},j + 1} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrounding the cell}\end{smallmatrix} \\
S_{13} = & \frac{1}{4}\left\lbrack S_{13i,k - \frac{1}{2}} + S_{13i,k + \frac{1}{2}} + S_{13i + 1,k - \frac{1}{2}} + S_{13i + 1,k + \frac{1}{2}} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrounding the cell}\end{smallmatrix} \\
S_{31} = & \frac{1}{4}\left\lbrack S_{31i - \frac{1}{2},k} + S_{31i + \frac{1}{2},k} + S_{31i - \frac{1}{2},k + 1} + S_{31i + \frac{1}{2},k + 1} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrounding the cell}\end{smallmatrix} \\
S_{23} = & \frac{1}{4}\left\lbrack S_{23j,k - \frac{1}{2}} + S_{23j,k + \frac{1}{2}} + S_{23j + 1,k - \frac{1}{2}} + S_{23j + 1,k + \frac{1}{2}} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrounding the cell}\end{smallmatrix} \\
S_{32} = & \frac{1}{4}\left\lbrack S_{32j - \frac{1}{2},k} + S_{32j + \frac{1}{2},k} + S_{32j - \frac{1}{2},k + 1} + S_{32j + \frac{1}{2},k + 1} \right\rbrack = \begin{smallmatrix} \text{Average of the 4 edges} \\ \text{surrounding the cell}\end{smallmatrix}
\end{matrix}
Note that:
Expand Down
4 changes: 2 additions & 2 deletions Docs/sphinx_doc/Inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ Notes
* | If **erf.fixed_mri_dt_ratio** is specified but is not an even positive integer
* | If **erf.fixed_dt** and **erf.fast_fixed_dt** are specified and the ratio of **fixed_dt** to **fast_fixed_dt**
is not an even positive integer
* | If **erf.fixed_dt** and **erf.fast_fixed_dt** and **erf.fixed_mri_dt_ratio** are all specified but are inconsitent
* | If **erf.fixed_dt** and **erf.fast_fixed_dt** and **erf.fixed_mri_dt_ratio** are all specified but are inconsistent

* | Once the slow timestep is set and the inputs are allowed per the above criteria,
the fast timestep is computed in one of several ways:
Expand Down Expand Up @@ -568,7 +568,7 @@ List of Parameters
+-------------------------------+------------------+----------------+----------------+
| **erf.profile_int** | Interval (number)| Integer | -1 |
| | of steps between | | |
| | ouputs | | |
| | outputs | | |
+-------------------------------+------------------+----------------+----------------+
| **erf.interp_profiles_to_cc** | Interpolate all | Boolean | true |
| | outputs to cell | | |
Expand Down
6 changes: 3 additions & 3 deletions Docs/sphinx_doc/MOST.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MOST Boundaries
Monin-Obukhov similarity theory (MOST) is used to describe the atmospheric surface layer (ASL), the lowest part of the atmospheric boundary layer. The implementation of MOST in ERF follows that in `AMR-Wind <https://github.com/Exawind/amr-wind/>`_, which is based on the surface layer profiles presented in
`P. van der Laan, et al., Wind Energy, 2017 <https://onlinelibrary.wiley.com/doi/10.1002/we.2017>`_ and
`D. Etling, "Modeling the vertical ABL structure", 1999 <https://www.worldscientific.com/doi/abs/10.1142/9789814447164_0003>`_.
MOST theory assumes that the ASL is in a steady state and horizontally homogenous, and kinematic fluxes due to turbulent transport (:math:`\overline{u^{'}w^{'}}`, :math:`\overline{v^{'}w^{'}}`, and :math:`\overline{\theta^{'}w^{'}}`) are constant with height.
MOST theory assumes that the ASL is in a steady state and horizontally homogeneous, and kinematic fluxes due to turbulent transport (:math:`\overline{u^{'}w^{'}}`, :math:`\overline{v^{'}w^{'}}`, and :math:`\overline{\theta^{'}w^{'}}`) are constant with height.
:math:`\Phi_m` and :math:`\Phi_h` are the nondimensional wind shear and temperature gradient, respectively, which are assumed to follow universal similarity laws based on dimensional arguments.
With these assumptions, the MOST theory can be written as:

Expand Down Expand Up @@ -120,7 +120,7 @@ In ERF, when the MOST boundary condition is applied, velocity and temperature in
of the velocity terms from the form of the
equations presented in Moeng to match the form implemented in AMR-Wind.

#. These local flux values are used to populate values in the ghost cells that will lead to appropiate fluxes, assuming the fluxes are computed from the turbulent transport coefficients (in the vertical direction, if applicable) :math:`K_{m,v}` and :math:`K_{\theta,v}` as follows:
#. These local flux values are used to populate values in the ghost cells that will lead to appropriate fluxes, assuming the fluxes are computed from the turbulent transport coefficients (in the vertical direction, if applicable) :math:`K_{m,v}` and :math:`K_{\theta,v}` as follows:

.. math::
Expand All @@ -143,7 +143,7 @@ In ERF, when the MOST boundary condition is applied, velocity and temperature in
(\rho \theta)_{z} = \frac{(\rho \theta)_{i,j,1} - (\rho \theta)_{i,j,0}}{\Delta z}
(\rho \theta)_{i,j,-n} = (\rho \theta)_{i,j,0} - (\rho \theta)_{z} n \Delta z .
Finally, it must be noted that complex terrain will modify the surface normal and tangent vectors. Consequently, the MOST implentation with terrain will require local vector rotations. While the ERF dycore accounts for
Finally, it must be noted that complex terrain will modify the surface normal and tangent vectors. Consequently, the MOST implementation with terrain will require local vector rotations. While the ERF dycore accounts for
terrain metrics when computing fluxes (e.g. for advection, diffusion, etc.), the impact of terrain metrics on MOST is still a work in progress. Therefore, running with terrain (``erf.use_terrain = true``) and with MOST
(``zlo.type = "Most"``) should be cautioned.

Expand Down
4 changes: 2 additions & 2 deletions Docs/sphinx_doc/Visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ To open a plotfile

#. If you have run the ERF executable with terrain, then the mapped grid information will
be stored as nodal data. Choose the "point data" called "nu", then click on "Warp by Vector"
which can be found via Filters-->Alphabetical. This wil then plot data onto the mapped grid
which can be found via Filters-->Alphabetical. This will then plot data onto the mapped grid
locations.

#. Under the "Cell Arrays" field, select a variable (e.g., "x_velocity") and click
"Apply". Note that the default number of refinement levels loaded and vizualized is 1.
"Apply". Note that the default number of refinement levels loaded and visualized is 1.
Change to the required number of AMR level before clicking "Apply".

#. For "Representation" select "Surface".
Expand Down
2 changes: 1 addition & 1 deletion Docs/sphinx_doc/coc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Code of Conduct
Our Pledge
----------

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

Our Standards
-------------
Expand Down
2 changes: 1 addition & 1 deletion Docs/sphinx_doc/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Testing and Verification
------------------------

Testing and verfication of ERF can be performed using CTest, which is included in the CMake build system. If one builds ERF with CMake, the testing suite, and the verification suite, can be enabled during the CMake configure step.
Testing and verification of ERF can be performed using CTest, which is included in the CMake build system. If one builds ERF with CMake, the testing suite, and the verification suite, can be enabled during the CMake configure step.

An example ``cmake`` configure command performed in the ``Build`` directory in ERF is shown below with options relevant to the testing suite:

Expand Down
2 changes: 1 addition & 1 deletion Docs/sphinx_doc/theory/DNSvsLES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ respectively (Martin et al., Theoret. Comput. Fluid Dynamics (2000)).
compressible turbulence and scalar transport", PoF (1991); Martin et al., Subgrid-scale models for compressible
large-eddy simulations", Theoret. Comput. Fluid Dynamics (2000).

When substituted back into the filtered equtions, the gradient transport LES models take exactly the same form as the
When substituted back into the filtered equations, the gradient transport LES models take exactly the same form as the
molecular transport terms, but with the
constant molecular transport coefficients replaced by turbulent equivalents (e.g. :math:`\mu` becomes the turbulent viscosity,
:math:`\mu_{t}`). Therefore, when the code is run in LES mode, the :ref:`equation set<DryEquations>` remains the same,
Expand Down
8 changes: 4 additions & 4 deletions Docs/sphinx_doc/theory/PBLschemes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ coefficients are then computed:
K_{m,v} = l q S_m, K_{q,v} = 3 l q S_m, K_{\theta, v} = l q S_\theta
where :math:`S_m` and :math:`S_\theta` are stability parameters thaat
account for bouyancy effects. These
account for buoyancy effects. These
coefficients are then applied in evaluating the vertical component of turbulent
fluxes in a similar manner as is described for the
:ref:`Smagorinsky LES model<SmagorinskyModel>`. Computation of the stability parameters
Expand Down Expand Up @@ -172,12 +172,12 @@ where
- :math:`U = \sqrt{u^2 + v^2}` is the horizontal wind speed,
- :math:`\theta_s = \theta_{ma} + \theta_T` is the virtual temperature near the surface,
- :math:`\theta_T = a\frac{\overline{\left(w'\theta_m' \right)_0}}{w_{s0}}` is the excess virtual temperature near the surface,
- :math:`a` is a constant taken to be 6.8 per HND06 (matching the :math:`b` constant that appears elsehwere in the YSU model)
- :math:`a` is a constant taken to be 6.8 per HND06 (matching the :math:`b` constant that appears elsewhere in the YSU model)
- :math:`\overline{\left(w'\theta_m' \right)_0}` is the surface virtual heat flux (determined from the MOST surface layer model),
- :math:`w_{s}(z) = \left(u_*^3 + 8 k w_{*b}^3z/h \right)^{1/3}` is a representative velocity scale in the mixed layer, with :math:`w_{s0} = w_s(h/2)` (note this equation matches the WRF implementation and description in H10, but differs from HND06, where :math:`\phi_m` appears in place of the constant 8),
- :math:`u_*` is the surface frictional velocity scale determined from the MOST surface layer model,
- :math:`k = 0.4` is the von Karman constant
- :math:`w_{*b} = \left[ g/\theta_{ma} \overline{\left(w'\theta_m' \right)_0} h \right]^{1/3}` for :math:`\overline{\left(w'\theta_m' \right)_0} > 0`, :math:`w_{*b} = 0` otherwise, is a convective velcoity scale for moist air
- :math:`w_{*b} = \left[ g/\theta_{ma} \overline{\left(w'\theta_m' \right)_0} h \right]^{1/3}` for :math:`\overline{\left(w'\theta_m' \right)_0} > 0`, :math:`w_{*b} = 0` otherwise, is a convective velocity scale for moist air

In practice, an approximate value of :math:`h` is determined through a two-step process. First, :math:`\theta_T` is set to be zero
and a provisional value of :math:`h` is estimated. Then this provisional value of :math:`h` is used to compute :math:`\theta_T`,
Expand Down Expand Up @@ -228,7 +228,7 @@ The following references have informed the implementation of the YSU model in ER

- [NCHR03] `Noh, Cheon, Hong, and Raasch, Boundary-Layer Meteorology, 2003 <https://doi.org/10.1023/A:1022146015946>`_: Entrainment effects added to TM86

- [HP96] `Hong and Pan, Monthly Weather Review, 1996 <HP96_>`_: Largely an implementation and evluation of TM86
- [HP96] `Hong and Pan, Monthly Weather Review, 1996 <HP96_>`_: Largely an implementation and evaluation of TM86

- [TM86] `Troen and Mahrt, Boundary-Layer Meteorology, 1986 <https://doi.org/10.1007/BF00122760>`_: Initial incorporation of nonlocal counter-graident term in vertical diffusion model

Expand Down
4 changes: 2 additions & 2 deletions Docs/sphinx_doc/theory/WindFarmModels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ The following are the inputs required for simulations with Fitch, EWP models.
erf.windfarm_spec_table = "wind-turbine_1WT.tbl"
1. ``erf.windfarm_type`` has to be one of the supported models - ``Fitch``, ``EWP``.
2. ``erf.windfarm_loc_type`` is a variable to specify how the wind turbine locations in the wind farm is specified. If using the latitude and longitude of the turbine location, this has to be ``lat_lon`` or if using x and y co-ordinates to specify the turbine locations, this input is ``x_y``.
2. ``erf.windfarm_loc_type`` is a variable to specify how the wind turbine locations in the wind farm is specified. If using the latitude and longitude of the turbine location, this has to be ``lat_lon`` or if using x and y coordinates to specify the turbine locations, this input is ``x_y``.

- If using ``lat_lon`` format, ``erf.latitude_lo`` and ``erf.longitude_lo`` specifies the latitude and longitude of the lower bottom corner of the domain box. ie. if the domain box is specified as

Expand Down Expand Up @@ -185,7 +185,7 @@ The following are the inputs required for simulations with Fitch, EWP models.
36.0171171171 -99.0168 1
35.7828828829 -98.9705333333 1
- For the x-y format, an example is as below. Each line specifies the x and y co-ordinates of the wind turbine location in metres
- For the x-y format, an example is as below. Each line specifies the x and y coordinates of the wind turbine location in metres

.. code-block:: cpp
Expand Down
2 changes: 1 addition & 1 deletion Exec/DevTests/Bomex/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PRECISION = DOUBLE

# Profiling
PROFILE = FALSE
TINY_PROFILE = TRUE
TINY_PROFILE = FALSE
COMM_PROFILE = FALSE
TRACE_PROFILE = FALSE
MEM_PROFILE = FALSE
Expand Down
Loading

0 comments on commit ded446b

Please sign in to comment.