Nektar++
Loading...
Searching...
No Matches
NeuBndCondOp.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: NeuBndCondOp.hpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description:
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
38
40{
41
42// Neuman boundary condition operator base class
43// Defines the apply operator to enforce apply parameter types
44template <typename TData> class NeuBndCondOp : public Operator<TData>
45{
46public:
47 static std::shared_ptr<NeuBndCondOp<TData>> Create(
48 const MultiRegions::ExpListSharedPtr &expansionList,
49 const std::vector<std::string> &components,
50 const std::string &execStr = "")
51 {
52 return Operator<TData>::template Create<NeuBndCondOp>(
53 expansionList, components, execStr);
54 }
55
56 static inline const std::string name = "NeuBndCond";
57
62
67
68 void UpdateBndCoeffs(const TData &time = 0.0)
69 {
71 {
72 return;
73 }
76 }
77
78 // Number of boundary coefficients (summed over all components and
79 // execution blocks) with a Neumann condition on this rank, i.e. the
80 // number of dofs actually accumulated into by Apply(). Mainly intended
81 // for profiling/introspection. Collective over the row communicator if
82 // the operator has not been used yet: an implementation may build its
83 // regions on first use.
85 {
86 return v_GetNumBndDofs();
87 }
88
89 /**
90 * @brief Add the surface integral of the Neumann boundary values on
91 * this rank, per component, as of their last update, to data[c] for
92 * component c, or data[c * nHomo + p] for plane p of a field with nHomo
93 * homogeneous planes, in the memory space of the operator's execution
94 * space.
95 *
96 * @details
97 * A singular (all-Neumann or periodic) system is solvable only when the
98 * domain integral of its forcing matches this surface integral. The sum
99 * is local to the rank and is not read back to the host, so that a
100 * caller reduces it across ranks and reads it back. Each block of boundary
101 * values is summed on the stream that wrote it.
102 */
107
108 /**
109 * @brief Leave the boundary regions whose Neumann condition has
110 * USERDEFINEDTYPE @p userDefinedType, compared without regard to case,
111 * to another operator, which supplies their Neumann value: this
112 * operator no longer applies them.
113 *
114 * @details
115 * Collective over the row communicator: every rank calls it, with the
116 * same @p userDefinedType. Called before the operator is first used, it
117 * only records the type.
118 */
119 void ExcludeUserDefinedType(const std::string &userDefinedType)
120 {
121 v_ExcludeUserDefinedType(userDefinedType);
122 }
123
124protected:
127
129 const std::vector<std::string> &components)
130 : Operator<TData>(expansionList, components)
131 {
132 }
133
134 ~NeuBndCondOp() override = default;
135
136 virtual void v_Apply(
138
139 virtual void v_UpdateBndCoeffs(const TData &time) = 0;
140
141 virtual size_t v_GetNumBndDofs() = 0;
142
145
147 const std::string &userDefinedType) = 0;
148};
149
150} // namespace Nektar::MultiRegions
Whole-field operator base class and factory machinery shared by every operator family in the MultiReg...
A Field represents expansion data to be operated on.
A MemoryRegion represents a memory region.
static const std::string name
virtual void v_Apply(LibUtilities::Field< TData, FieldState::Coeff > &inout)=0
void operator()(LibUtilities::Field< TData, FieldState::Coeff > &inout)
NeuBndCondOp(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
void ExcludeUserDefinedType(const std::string &userDefinedType)
Leave the boundary regions whose Neumann condition has USERDEFINEDTYPE userDefinedType,...
virtual void v_ExcludeUserDefinedType(const std::string &userDefinedType)=0
virtual void v_AddNeumannSurfaceIntegral(LibUtilities::MemoryRegion< TData > &data)=0
void AddNeumannSurfaceIntegral(LibUtilities::MemoryRegion< TData > &data)
Add the surface integral of the Neumann boundary values on this rank, per component,...
virtual void v_UpdateBndCoeffs(const TData &time)=0
void Apply(LibUtilities::Field< TData, FieldState::Coeff > &inout)
static std::shared_ptr< NeuBndCondOp< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="")
void UpdateBndCoeffs(const TData &time=0.0)
virtual size_t v_GetNumBndDofs()=0
Common base class of the operator family interfaces: holds the expansion list, component names and da...
Definition Operator.hpp:100
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.