Skip to main content

outram_foam_basic_lib/fields/
mod.rs

1// SPDX-License-Identifier: GPL-3.0-only
2// Copyright (C) 2026 OUTRAM PARK contributors
3// Derived from OpenFOAM (www.openfoam.com)
4// Copyright (C) 2004-2023 OpenFOAM Foundation
5// Copyright (C) 2016-2023 OpenCFD Ltd.
6//
7// This file is part of OUTRAM PARK.
8//
9// OUTRAM PARK is free software: you can redistribute it and/or modify it
10// under the terms of the GNU General Public License as published by the
11// Free Software Foundation, either version 3 of the License, or (at your
12// option) any later version.
13//
14// OUTRAM PARK is distributed in the hope that it will be useful, but
15// WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17// General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License along
20// with OUTRAM PARK.  If not, see <https://www.gnu.org/licenses/>.
21
22//! Field types: the discretised quantities carried on the mesh.
23//!
24//! This module holds the data containers the FV operators read and write:
25//!
26//! - [`Field`](crate::fields::field::Field) — a flat `Vec<T>` with element-wise arithmetic; the raw storage
27//!   with no mesh or dimension bookkeeping (mirrors `Foam::Field<Type>`).
28//! - [`boundary`](crate::fields::boundary) — boundary conditions
29//!   ([`BoundaryCondition`](crate::fields::boundary::bc::BoundaryCondition)) and
30//!   per-patch boundary values
31//!   ([`PatchField`](crate::fields::boundary::bc::PatchField)).
32//! - [`VolField`](crate::fields::vol_field::VolField) (and the `Vol*Field` aliases) — cell-centred volume fields:
33//!   one value per cell plus one `PatchField` per boundary patch.
34//! - [`SurfaceField`](crate::fields::surface_field::SurfaceField) (and the `Surface*Field` aliases) — face fields: one
35//!   value per internal face plus one `PatchField` per boundary patch.
36//! - [`vol_field_algebra`](crate::fields::vol_field_algebra) — pure per-element tensor algebra (`tr`, `symm`,
37//!   `dev`, …) lifted to whole volume fields.
38//! - [`parallel`](crate::fields::parallel) — the same element-wise algebra and
39//!   the field reductions, dispatched on
40//!   [`ComputeBackend`](crate::compute::ComputeBackend) so a large mesh can use
41//!   every CPU core. One entry point per operation; multi-threading is behind the
42//!   crate's `parallel` feature and the serial path is the trusted reference.
43//!
44//! Physical units are not tracked at this layer; a field simply carries `f64`,
45//! `Vector3`, `Tensor`, or `SymmTensor` values in whatever SI units the caller
46//! assigns them.
47
48pub mod boundary;
49pub mod field;
50pub mod parallel;
51pub mod surface_field;
52pub mod vol_field;
53pub mod vol_field_algebra;
54
55pub use boundary::*;
56pub use field::{Field, ScalarField, SymmTensorField, TensorField, VectorField};
57// Only the two uniquely-named policy items are re-exported. The kernels
58// themselves (`add`, `sum`, `scale`, …) are deliberately NOT glob-re-exported:
59// their names are generic verbs that would collide on sight, so they stay
60// path-qualified as `fields::parallel::add(backend, &a, &b)`.
61pub use parallel::{field_parallel_crossover, should_parallelise};
62pub use surface_field::*;
63pub use vol_field::*;