G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsFlowBndEvaluators.h
Go to the documentation of this file.
1
12#pragma once
14
15
16namespace gismo
17{
18
26template<class T>
28{
29
30protected: // *** Class members ***
31
32 const gsFlowSolverParams<T>& m_params;
33 std::vector< std::pair<int, boxSide> > m_bndPart;
34 gsField<T> m_velocityField;
35 gsField<T> m_pressureField;
36 gsMapData<T> m_mapData;
37 index_t m_unkID; // the index of variable, from which the quantitiy is computed (0 - velocity, 1 - pressure)
38 T m_quantValue; // the resulting integral value
39
40
41public: // *** Constructor/destructor ***
42
46 m_params(params)
47 {
49 }
50
54 gsFlowBndEvaluator(const gsFlowSolverParams<T>& params, const std::vector< std::pair<int, boxSide> >& bndPart):
55 m_params(params), m_bndPart(bndPart)
56 {
58 }
59
60
61protected: // *** Member functions ***
62
65 {
66 m_unkID = 0;
67 m_mapData.flags = 0;
68 m_quantValue = 0.0;
69 }
70
76 virtual void evalOnElement(index_t patchID, boxSide side, const gsMatrix<T>& quNodes, const gsVector<T>& quWeights)
78
82 void evalOnPatchSide(index_t patchID, boxSide side);
83
84
85public: // *** Member functions ***
86
88 void evaluate()
89 {
90 m_quantValue = 0.0;
91
92 for(size_t i = 0; i < m_bndPart.size(); i++)
93 evalOnPatchSide(m_bndPart[i].first, m_bndPart[i].second);
94 }
95
96
97public: // *** Getters/setters ***
98
101 void setVelocityField(const gsField<T>& velocity)
102 { m_velocityField = velocity; }
103
106 void setPressureField(const gsField<T>& pressure)
107 { m_pressureField = pressure; }
108
112 void setSolutionFields(const gsField<T>& velocity, const gsField<T>& pressure)
113 {
114 m_velocityField = velocity;
115 m_pressureField = pressure;
116 }
117
120 void setBndPart(const std::vector< std::pair<int, boxSide> >& bndPart)
121 { m_bndPart = bndPart; }
122
125 { return m_quantValue; }
126
127
128}; // gsFlowBndEvaluator
129
130
131// ===================================================================================================================
132
133
136template<class T>
138{
139
140public:
142
143
144protected: // *** Base class members ***
145
146 using Base::m_unkID;
147 using Base::m_mapData;
148 using Base::m_quantValue;
149 using Base::m_velocityField;
150
151
152public: // *** Constructor/destructor ***
153
155 Base(params)
156 {
157 initMembers();
158 }
159
160 gsFlowBndEvaluator_flowRate(const gsFlowSolverParams<T>& params, const std::vector< std::pair<int, boxSide> >& bndPart):
161 Base(params, bndPart)
162 {
163 initMembers();
164 }
165
166
167protected: // *** Member functions ***
168
171 {
172 m_unkID = 0;
173 m_mapData.flags = NEED_VALUE | NEED_OUTER_NORMAL;
174 m_quantValue = 0.0;
175 }
176
182 virtual void evalOnElement(index_t patchID, boxSide side, const gsMatrix<T>& quNodes, const gsVector<T>& quWeights);
183
184}; // gsFlowBndEvaluator_flowRate
185
186
187} // namespace gismo
188
189#ifndef GISMO_BUILD_LIB
190#include GISMO_HPP_HEADER(gsFlowBndEvaluators.hpp)
191#endif
Struct which represents a certain side of a box.
Definition gsBoundary.h:85
A scalar of vector field defined on a m_parametric geometry.
Definition gsField.h:55
Flow rate evaluator.
Definition gsFlowBndEvaluators.h:138
virtual void evalOnElement(index_t patchID, boxSide side, const gsMatrix< T > &quNodes, const gsVector< T > &quWeights)
Evaluate the flow rate in one element of the boundary part.
Definition gsFlowBndEvaluators.hpp:55
void initMembers()
Initialize the class members.
Definition gsFlowBndEvaluators.h:170
A base class for boundary evaluators.
Definition gsFlowBndEvaluators.h:28
void setVelocityField(const gsField< T > &velocity)
Set the velocity field for evaluation.
Definition gsFlowBndEvaluators.h:101
void evaluate()
Evaluate the quantity, i.e., perform the integration over the given boundary part.
Definition gsFlowBndEvaluators.h:88
virtual void evalOnElement(index_t patchID, boxSide side, const gsMatrix< T > &quNodes, const gsVector< T > &quWeights)
Evaluate the quantity in one element of the boundary part.
Definition gsFlowBndEvaluators.h:76
void evalOnPatchSide(index_t patchID, boxSide side)
Evaluate the quantity over one patch side.
Definition gsFlowBndEvaluators.hpp:20
void setPressureField(const gsField< T > &pressure)
Set the pressure field for evaluation.
Definition gsFlowBndEvaluators.h:106
void setSolutionFields(const gsField< T > &velocity, const gsField< T > &pressure)
Set the velocity and pressure fields for evaluation.
Definition gsFlowBndEvaluators.h:112
gsFlowBndEvaluator(const gsFlowSolverParams< T > &params)
Constructor.
Definition gsFlowBndEvaluators.h:45
void initMembers()
Initialize the class members.
Definition gsFlowBndEvaluators.h:64
void setBndPart(const std::vector< std::pair< int, boxSide > > &bndPart)
Set the boundary part, over which the quantity will be integrated.
Definition gsFlowBndEvaluators.h:120
gsFlowBndEvaluator(const gsFlowSolverParams< T > &params, const std::vector< std::pair< int, boxSide > > &bndPart)
Constructor.
Definition gsFlowBndEvaluators.h:54
T getValue()
Get the computed value.
Definition gsFlowBndEvaluators.h:124
A class that holds all parameters needed by the incompressible flow solver.
Definition gsFlowSolverParams.h:34
the gsMapData is a cache of pre-computed function (map) values.
Definition gsFuncData.h:349
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define index_t
Definition gsConfig.h:32
#define GISMO_NO_IMPLEMENTATION
Definition gsDebug.h:129
A class that holds all parameters needed by the incompressible flow solver.
The G+Smo namespace, containing all definitions for the library.
@ NEED_VALUE
Value of the object.
Definition gsForwardDeclarations.h:72
@ NEED_OUTER_NORMAL
Outward normal on the boundary.
Definition gsForwardDeclarations.h:86