NeoN
A framework for CFD software
Loading...
Searching...
No Matches
ddtOperator.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2023 - 2026 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
7#include <type_traits>
8
11#include "NeoN/core/input.hpp"
12#include "NeoN/dsl/operator.hpp"
15
17{
18
19enum class DdtScheme
20{
21 None,
23 BDF1,
24 BDF2
25};
26
27template<typename ValueType>
28class DdtOperator : public dsl::OperatorMixin<VolumeField<ValueType>>
29{
30
31public:
32
33 using VectorValueType = ValueType;
34
36
37 /* @brief Density-weighted temporal operator ddt(rho, field): the diagonal uses the
38 * current density rho and the rhs uses oldTime(rho), giving the conservative
39 * (rho_n*field - rho_o*field_o)/dt form (as opposed to the single-coefficient
40 * rho_n/dt*(field - field_o)). rho must carry an old-time collection.
41 */
44 );
45
47
49
51
53
55
56 /* @brief Implicit temporal assembly into a scalar-matrix / ValueType-rhs linear system
57 * (segregated vector-solve form). Only present when ValueType != scalar; for scalar
58 * fields the same-type overload above already covers LinearSystem<scalar, scalar>.
59 * The scalar diagonal entry scales every rhs component equally.
60 */
61 template<typename F = ValueType>
62 requires(!std::is_same_v<F, scalar>)
64
66
68
69 DdtScheme scheme() const noexcept { return scheme_; }
70
71 void read(const Input&);
72
73 std::string getName() const { return "DdtOperator"; }
74
75private:
76
77 // NOTE ddtOperator does not have a FactoryClass
78
79 DdtScheme scheme_ {DdtScheme::BDF1};
80
81 // Non-null → density-weighted form ddt(rho, field). Null → stock single-coefficient form.
82 VolumeField<scalar>* rho_ {nullptr};
83};
84
85
86} // namespace NeoN
A class to contain the data and executors for a field and define some basic operations.
Definition vector.hpp:27
void implicitOperation(la::LinearSystem< scalar, ValueType > &ls, scalar, scalar dt) const
void bdf1KernelScalarMtx(la::LinearSystem< scalar, ValueType > &ls, scalar t, scalar dt) const
void implicitOperation(la::LinearSystem< ValueType > &ls, scalar, scalar dt) const
void bdf2KernelScalarMtx(la::LinearSystem< scalar, ValueType > &ls, scalar t, scalar dt) const
DdtOperator(dsl::Operator::Type termType, VolumeField< scalar > &rho, VolumeField< ValueType > &field)
void explicitOperation(Vector< ValueType > &source, scalar t, scalar dt) const
DdtOperator(dsl::Operator::Type termType, VolumeField< ValueType > &field)
void bdf2Kernel(la::LinearSystem< ValueType > &ls, scalar t, scalar dt) const
void bdf1Kernel(la::LinearSystem< ValueType > &ls, scalar t, scalar dt) const
Represents a volume field in a finite volume method.
A class representing a linear system of equations.
std::variant< Dictionary, TokenList > Input
Definition input.hpp:15
float scalar
Definition scalar.hpp:17