Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5c6e3a7
Port `FV::Div_par_mod` from Hermes-3
ZedThree Nov 6, 2025
3059d12
Port `FV::Div_par_fvv` from Hermes-3
ZedThree Nov 6, 2025
60f1946
Port `Div_par_K_Grad_par_mod` from Hermes-3
ZedThree Nov 6, 2025
f53b8f3
Add MMS tests for finite volume operators
ZedThree Nov 6, 2025
207802f
Add tests for all FV slope limiters
ZedThree Nov 7, 2025
a230642
Port `Superbee` finite volume limiter from Hermes-3
ZedThree Nov 7, 2025
30dc670
Fix clang-tidy warnings for fv_ops
ZedThree Nov 7, 2025
fcfe963
Move check up
dschwoerer Nov 12, 2025
b209a5a
Ensure FCI path is always used for FCI
dschwoerer Jan 20, 2026
e0480fc
FV_div_par_fvv seems to be reduced order due to slope limiting character
dschwoerer Feb 4, 2026
7ffc7fa
Add doc to option
dschwoerer Feb 4, 2026
aa8e5d4
Merge remote-tracking branch 'origin/hermitespline' into HEAD
dschwoerer Mar 11, 2026
2d922ec
Merge branch 'f3dparallel' into move-ops
dschwoerer Mar 18, 2026
1aedd28
Merge branch 'f3dparallel' into move-ops
dschwoerer Mar 19, 2026
04d3ab3
Merge branch 'f3dparallel' into move-ops
dschwoerer Mar 20, 2026
b2a7383
prek fixes
dschwoerer Mar 20, 2026
6400a1d
Merge branch 'next' of github.com:boutproject/BOUT-dev into move-ops
dschwoerer Jun 15, 2026
24c9992
Remove unused header
dschwoerer Jun 15, 2026
b3ccacb
Merge branch 'cell_area_volume' into move-ops-area
dschwoerer Jun 16, 2026
639808c
Use cell area and volumes for div_par_mod
dschwoerer Jun 16, 2026
5a2a3dc
Use cell area and volumes for Div_par_fvv
dschwoerer Jun 16, 2026
820e221
Use cell area and volumes for Div_par
dschwoerer Jun 16, 2026
3b0117e
Also fill the boundaries to the extend possible
dschwoerer Jun 17, 2026
8aeea3d
Merge branch 'next' of https://github.com/boutproject/BOUT-dev into m…
dschwoerer Jun 22, 2026
2e5367a
Move implementations to different file
dschwoerer Jun 23, 2026
7a1a902
Add to cmake file
dschwoerer Jun 23, 2026
392f842
Add implementation file
dschwoerer Jun 23, 2026
cee53db
Merge remote-tracking branch 'origin/next' into move-ops-area
dschwoerer Jun 24, 2026
381af95
Merge branch 'move-ops' into move-ops-area
dschwoerer Jun 24, 2026
e5ba73d
Improve code comments
dschwoerer Jun 24, 2026
f8a2469
Remove pre-C++20 fall back path
dschwoerer Jun 24, 2026
8f8e035
Apply clang-tidy fixes
dschwoerer Jun 24, 2026
bc980b1
Ensure calls to _compute_... are guarded
dschwoerer Jun 24, 2026
9ff3c73
Add comment about impl header
dschwoerer Jun 24, 2026
b98954f
Add comments about explicit instantiation
dschwoerer Jun 24, 2026
e68d165
Do not return from critical areas
dschwoerer Jun 24, 2026
a995360
Add missing header
dschwoerer Jun 24, 2026
5284cc1
Remove TRACE
dschwoerer Jun 24, 2026
1672208
Move critical section to compute functions
dschwoerer Jun 24, 2026
b89867d
Add DDY template for expression
dschwoerer Jun 24, 2026
e00a0a0
Merge pull request #3405 from boutproject/move-ops-impl
ZedThree Jun 24, 2026
d914903
Merge branch 'next' of https://github.com/boutproject/BOUT-dev into m…
dschwoerer Jun 26, 2026
586c06b
Merge branch 'move-ops' into move-ops-area
dschwoerer Jun 26, 2026
26876b7
Add missing used header
dschwoerer Jun 26, 2026
30f42fc
Merge pull request #3392 from boutproject/move-ops-area
dschwoerer Jun 26, 2026
bf5f01d
Remove unused headers
dschwoerer Jun 29, 2026
f893f3d
Fix nonorthogonal MMS test for hermes-3
dschwoerer Jul 2, 2026
6a0e276
Ensure fv_ops.hxx is parsed before fv_ops_impl.hxx
dschwoerer Jul 2, 2026
0b187d9
Coordinates::_compute_cell_area_z check _compute_cell_area_z
bendudson Jul 4, 2026
2c41fca
FV ops: Document diagnostics for FCI args
bendudson Jul 4, 2026
8fb81ad
Documentation of FV operators and metric caching
bendudson Jul 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ set(BOUT_SOURCES
./include/bout/fieldgroup.hxx
./include/bout/fieldperp.hxx
./include/bout/fv_ops.hxx
./include/bout/fv_ops_impl.hxx
./include/bout/generic_factory.hxx
./include/bout/globalfield.hxx
./include/bout/globalindexer.hxx
Expand Down
79 changes: 43 additions & 36 deletions include/bout/coordinates.hxx
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
/**************************************************************************
* Describes coordinate systems
*
* ChangeLog
* =========
*
* 2014-11-10 Ben Dudson <bd512@york.ac.uk>
* * Created by separating metric from Mesh
*
*
**************************************************************************
* Copyright 2014-2025 BOUT++ contributors
* Copyright 2014-2026 BOUT++ contributors
*
* Contact: Ben Dudson, dudson2@llnl.gov
*
Expand Down Expand Up @@ -116,101 +109,115 @@ public:
FieldMetric& g_22_yhigh();
// Cell Areas
const FieldMetric& cell_area_xlow() const {
if (!_cell_area_xlow.has_value()) {
_compute_cell_area_x();
if (_cell_area_xlow.has_value()) {
return *_cell_area_xlow;
}
_compute_cell_area_x();
ASSERT2(_cell_area_xlow.has_value());
return *_cell_area_xlow;
}
const FieldMetric& cell_area_xhigh() const {
if (!_cell_area_xhigh.has_value()) {
_compute_cell_area_x();
if (_cell_area_xhigh.has_value()) {
return *_cell_area_xhigh;
}
_compute_cell_area_x();
ASSERT2(_cell_area_xhigh.has_value());
return *_cell_area_xhigh;
}
const FieldMetric& cell_area_ylow() const {
if (!_cell_area_ylow.has_value()) {
_compute_cell_area_y();
if (_cell_area_ylow.has_value()) {
return *_cell_area_ylow;
}
_compute_cell_area_y();
ASSERT2(_cell_area_ylow.has_value());
return *_cell_area_ylow;
}
const FieldMetric& cell_area_yhigh() const {
if (!_cell_area_yhigh.has_value()) {
_compute_cell_area_y();
if (_cell_area_yhigh.has_value()) {
return *_cell_area_yhigh;
}
_compute_cell_area_y();
ASSERT2(_cell_area_yhigh.has_value());
return *_cell_area_yhigh;
}
const FieldMetric& cell_area_zlow() const {
if (!_cell_area_zlow.has_value()) {
_compute_cell_area_z();
if (_cell_area_zlow.has_value()) {
return *_cell_area_zlow;
}
_compute_cell_area_z();
ASSERT2(_cell_area_zlow.has_value());
return *_cell_area_zlow;
}
const FieldMetric& cell_area_zhigh() const {
if (!_cell_area_zhigh.has_value()) {
_compute_cell_area_z();
if (_cell_area_zhigh.has_value()) {
return *_cell_area_zhigh;
}
_compute_cell_area_z();
ASSERT2(_cell_area_zhigh.has_value());
return *_cell_area_zhigh;
}
FieldMetric& cell_area_xlow() {
if (!_cell_area_xlow.has_value()) {
_compute_cell_area_x();
if (_cell_area_xlow.has_value()) {
return *_cell_area_xlow;
}
_compute_cell_area_x();
ASSERT2(_cell_area_xlow.has_value());
return *_cell_area_xlow;
}
FieldMetric& cell_area_xhigh() {
if (!_cell_area_xhigh.has_value()) {
_compute_cell_area_x();
if (_cell_area_xhigh.has_value()) {
return *_cell_area_xhigh;
}
_compute_cell_area_x();
ASSERT2(_cell_area_xhigh.has_value());
return *_cell_area_xhigh;
}
FieldMetric& cell_area_ylow() {
if (!_cell_area_ylow.has_value()) {
_compute_cell_area_y();
if (_cell_area_ylow.has_value()) {
return *_cell_area_ylow;
}
_compute_cell_area_y();
ASSERT2(_cell_area_ylow.has_value());
return *_cell_area_ylow;
}
FieldMetric& cell_area_yhigh() {
if (!_cell_area_yhigh.has_value()) {
_compute_cell_area_y();
if (_cell_area_yhigh.has_value()) {
return *_cell_area_yhigh;
}
_compute_cell_area_y();
ASSERT2(_cell_area_yhigh.has_value());
return *_cell_area_yhigh;
}
FieldMetric& cell_area_zlow() {
if (!_cell_area_zlow.has_value()) {
_compute_cell_area_z();
if (_cell_area_zlow.has_value()) {
return *_cell_area_zlow;
}
_compute_cell_area_z();
ASSERT2(_cell_area_zlow.has_value());
return *_cell_area_zlow;
}
FieldMetric& cell_area_zhigh() {
if (!_cell_area_zhigh.has_value()) {
_compute_cell_area_z();
if (_cell_area_zhigh.has_value()) {
return *_cell_area_zhigh;
}
_compute_cell_area_z();
ASSERT2(_cell_area_zhigh.has_value());
return *_cell_area_zhigh;
}
// Cell Volume
const FieldMetric& cell_volume() const {
if (!_cell_volume.has_value()) {
_compute_cell_volume();
if (_cell_volume.has_value()) {
return *_cell_volume;
}
_compute_cell_volume();
ASSERT2(_cell_volume.has_value());
return *_cell_volume;
}
FieldMetric& cell_volume() {
if (!_cell_volume.has_value()) {
_compute_cell_volume();
if (_cell_volume.has_value()) {
return *_cell_volume;
}
_compute_cell_volume();
ASSERT2(_cell_volume.has_value());
return *_cell_volume;
}
Expand Down
8 changes: 8 additions & 0 deletions include/bout/derivs.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "bout/vector3d.hxx"

#include "bout/bout_types.hxx"
#include <type_traits>

////////// FIRST DERIVATIVES //////////

Expand Down Expand Up @@ -86,6 +87,13 @@ Field3D DDY(const Field3DParallel& f, CELL_LOC outloc = CELL_DEFAULT,
const std::string& method = "DEFAULT",
const std::string& region = "RGN_NOBNDRY");

template <typename E>
std::enable_if_t<is_expr_field3d_v<E> && !bout::utils::is_Field3D_v<E>, const Field3D>
DDY(const E& expr, CELL_LOC outloc = CELL_DEFAULT, const std::string& method = "DEFAULT",
const std::string& region = "RGN_NOBNDRY") {
return DDY(Field3D{expr}, outloc, method, region);
}

/// Calculate first partial derivative in Y
///
/// \f$\partial / \partial y\f$
Expand Down
33 changes: 19 additions & 14 deletions include/bout/difops.hxx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!******************************************************************************
* \file difops.hxx
*
*
* Differential operators
*
* Changelog:
*
* 2009-01 Ben Dudson <bd512@york.ac.uk>
* 2009-01 Ben Dudson <bd512@york.ac.uk>
* * Added two optional parameters which can be put in any order
* These determine the method to use (DIFF_METHOD)
* and CELL_LOC location of the result.
Expand All @@ -15,7 +15,7 @@
* Copyright 2010 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu
*
* Contact: Ben Dudson, bd512@york.ac.uk
*
*
* This file is part of BOUT++.
*
* BOUT++ is free software: you can redistribute it and/or modify
Expand All @@ -30,7 +30,7 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with BOUT++. If not, see <http://www.gnu.org/licenses/>.
*
*
*******************************************************************************/

#ifndef BOUT_DIFOPS_H
Expand Down Expand Up @@ -81,7 +81,7 @@ Field3D Grad_parP(const Field3D& apar, const Field3D& f);
* \f[
* v\mathbf{b}_0 \cdot \nabla f
* \f]
*
*
*
* @param[in] v The velocity in y direction
* @param[in] f The scalar field to be differentiated
Expand Down Expand Up @@ -175,7 +175,7 @@ inline Field3D Grad2_par2(const Field3D& f, CELL_LOC outloc, DIFF_METHOD method)

/*!
* Parallel divergence of diffusive flux, K*Grad_par
*
*
* \f[
* \nabla \cdot ( \mathbf{b}_0 kY (\mathbf{b}_0 \cdot \nabla) f )
* \f]
Expand All @@ -195,12 +195,17 @@ Field3D Div_par_K_Grad_par(const Field3D& kY, const Field2D& f,
Field3D Div_par_K_Grad_par(const Field3D& kY, const Field3D& f,
CELL_LOC outloc = CELL_DEFAULT);

/// Version with energy flow diagnostic
/// For FCI fields, `flow_ylow` is currently returned as zero.
Field3D Div_par_K_Grad_par_mod(const Field3D& k, const Field3D& f, Field3D& flow_ylow,
bool bndry_flux = true);

/*!
* Perpendicular Laplacian operator
*
* This version only includes terms in X and Z, dropping
* derivatives in Y. This is the inverse operation to
* the Laplacian inversion class.
* derivatives in Y. This is the inverse operation to
* the Laplacian inversion class.
*
* For the full perpendicular Laplacian, use Laplace_perp
*/
Expand All @@ -212,7 +217,7 @@ FieldPerp Delp2(const FieldPerp& f, CELL_LOC outloc = CELL_DEFAULT, bool useFFT
/*!
* Perpendicular Laplacian, keeping y derivatives
*
*
*
*/
Coordinates::FieldMetric
Laplace_perp(const Field2D& f, CELL_LOC outloc = CELL_DEFAULT,
Expand Down Expand Up @@ -246,18 +251,18 @@ Field2D Laplace_perpXY(const Field2D& A, const Field2D& f);

/*!
* Terms of form b0 x Grad(phi) dot Grad(A)
*
*
*/
Coordinates::FieldMetric b0xGrad_dot_Grad(const Field2D& phi, const Field2D& A,
CELL_LOC outloc = CELL_DEFAULT);

/*!
* Terms of form
* Terms of form
*
* \f[
* \mathbf{b}_0 \times \nabla \phi \cdot \nabla A
* \f]
*
*
* @param[in] phi The scalar potential
* @param[in] A The field being advected
* @param[in] outloc The cell location where the result is defined. By default the same as A.
Expand Down Expand Up @@ -291,13 +296,13 @@ constexpr BRACKET_METHOD BRACKET_CTU = BRACKET_METHOD::ctu;
* \f[
* [f, g] = (1/B) \mathbf{b}_0 \times \nabla f \cdot \nabla g
* \f]
*
*
* @param[in] f The potential
* @param[in] g The field being advected
* @param[in] method The method to use
* @param[in] outloc The cell location where the result is defined. Default is the same as g
* @param[in] solver Pointer to the time integration solver
*
*
*/
Coordinates::FieldMetric bracket(const Field2D& f, const Field2D& g,
BRACKET_METHOD method = BRACKET_STD,
Expand Down
Loading
Loading