NeoN
A framework for CFD software
Loading...
Searching...
No Matches
symmetry.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 <Kokkos_Core.hpp>
8
14
16{
17
18// Symmetry is a symmetry-plane boundary condition: scalar => zero-gradient, vector => tangential
19// projection + normal damping. It shares its implementation with Slip via
20// detail::setSlipSymmetryValue; they differ only in the registered name and in where they may be
21// applied. The optional "implicit" key selects the normal-damping treatment.
22template<typename ValueType>
23class Symmetry : public VolumeBoundaryFactory<ValueType>::template Register<Symmetry<ValueType>>
24{
26
27public:
28
29 using Base::correctBoundaryCondition;
30
32
33 Symmetry(const UnstructuredMesh& mesh, const Dictionary& dict, localIdx patchID)
34 : Base(
35 mesh,
36 dict,
37 patchID,
38 {.assignable = false,
39 .fixesValue = false,
40 .transformImplicit = detail::readTransformImplicit(dict)}
41 ),
42 mesh_(mesh), implicit_(detail::readTransformImplicit(dict))
43 {}
44
45 virtual void correctBoundaryCondition(Field<ValueType>& domainVector) final
46 {
48 domainVector, mesh_, this->range(), detail::normalDampingMode(implicit_)
49 );
50 }
51
52 static std::string name() { return "symmetry"; }
53
54 std::string getName() const override { return name(); }
55
56 static std::string doc()
57 {
58 return "Symmetry plane (scalar: zero-gradient; vector: tangential projection + normal "
59 "damping).";
60 }
61
62 static std::string schema() { return "none"; }
63
64 virtual std::unique_ptr<VolumeBoundaryFactory<ValueType>> clone() const final
65 {
66 return std::make_unique<Symmetry>(*this);
67 }
68
69private:
70
71 const UnstructuredMesh& mesh_;
72 bool implicit_;
73};
74
75} // namespace NeoN::finiteVolume::cellCentred::volumeBoundary
A class representing a dictionary that stores key-value pairs.
Represents the domain fields for a computational domain.
Definition field.hpp:34
Represents an unstructured mesh in NeoN.
virtual void correctBoundaryCondition(Field< ValueType > &domainVector) final
Definition symmetry.hpp:45
virtual std::unique_ptr< VolumeBoundaryFactory< ValueType > > clone() const final
Definition symmetry.hpp:64
Symmetry(const UnstructuredMesh &mesh, const Dictionary &dict, localIdx patchID)
Definition symmetry.hpp:33
A template class for registering derived classes with a base class.
NormalDamping normalDampingMode(bool implicit)
Map the implicit flag onto the NormalDamping mode.
void setSlipSymmetryValue(Field< ValueType > &domainVector, const UnstructuredMesh &mesh, std::pair< localIdx, localIdx > range, NormalDamping mode)
bool readTransformImplicit(const Dictionary &dict)
Read the "implicit" flag from a slip/symmetry patch dictionary.
int32_t localIdx
Definition label.hpp:50