Nektar++
Loading...
Searching...
No Matches
DisContField.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: DisContField.h
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: Field definition in one-dimension for a discontinuous
32// LDG-H expansion
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD1D_H
37#define NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD1D_H
38
47#include <boost/algorithm/string.hpp>
48
50{
51
52/// This class is the abstractio n of a global discontinuous two-
53/// dimensional spectral/hp element expansion which approximates the
54/// solution of a set of partial differential equations.
55class DisContField : public ExpList
56{
57public:
60
61 /// Default constructor.
63
64 /// Constructs a 1D discontinuous field based on a mesh and boundary
65 /// conditions.
69 const std::string &variable, const bool SetUpJustDG = true,
70 const bool DeclareCoeffPhysArrays = true,
72 const std::string bcvariable = "NotSet");
73
74 /// Constructor for a DisContField from a List of subdomains
75 /// New Constructor for arterial network
79 const SpatialDomains::CompositeMap &domain,
81 const std::string &variable, const LibUtilities::CommSharedPtr &comm,
82 bool SetToOneSpaceDimensions = false,
85
86 /// Constructs a 1D discontinuous field based on an existing field.
88 const bool DeclareCoeffPhysArrays = true);
89
92 const std::string &variable, const bool SetUpJustDG = true,
93 const bool DeclareCoeffPhysArrays = true);
94
95 /// Constructs a 1D discontinuous field based on an
96 /// existing field. (needed in order to use ContField(
97 /// const ExpList &In) constructor
99
100 /// Destructor.
102
103 /// For a given key, returns the associated global linear system.
106
107 /// Check to see if expansion has the same BCs as In
109 const DisContField &In);
110
111 // Return the internal vector which directs whether the normal flux
112 // at the trace defined by Left and Right Adjacent elements
113 // is negated with respect to the segment normal
114 MULTI_REGIONS_EXPORT std::vector<bool> &GetNegatedFluxNormal(void);
115
117 L2_DGDeriv(const int dir, const Array<OneD, const NekDouble> &coeffs,
118 const Array<OneD, const NekDouble> &soln);
120 const Array<OneD, const NekDouble> &coeffs,
121 Array<OneD, NekDouble> &outarray);
122
128
133 &bndCond,
134 const Array<OneD, const ExpListSharedPtr> &BndCondExp);
135
140
141protected:
142 /// An array which contains the information about the boundary
143 /// condition structure definition on the different boundary regions.
145
146 /**
147 * @brief An object which contains the discretised boundary
148 * conditions.
149 *
150 * It is an array of size equal to the number of boundary
151 * regions and consists of entries of the type
152 * MultiRegions#ExpList. Every entry corresponds to the
153 * spectral/hp expansion on a single boundary region. The
154 * values of the boundary conditions are stored as the
155 * coefficients of the one-dimensional expansion.
156 */
158
160
161 /// Interfaces mapping for trace space.
163
164 /// Global boundary matrix.
166
167 /// Trace space storage for points between elements.
169
170 /// Local Elemental trace expansions
172
173 /// Local to global DG mapping for trace space.
175
176 /**
177 * @brief A set storing the global IDs of any boundary Verts.
178 */
179 std::set<int> m_boundaryTraces;
180
181 /**
182 * @brief A map which identifies groups of periodic vertices.
183 */
185
186 /**
187 * @brief A map which identifies pairs of periodic edges.
188 */
190
191 /**
192 * @brief A map which identifies pairs of periodic faces.
193 */
195
196 /**
197 * @brief A vector indicating degress of freedom which need to be
198 * copied from forwards to backwards space in case of a periodic
199 * boundary condition.
200 */
201 std::vector<int> m_periodicFwdCopy;
202 std::vector<int> m_periodicBwdCopy;
203
204 /*
205 * @brief A map identifying which traces are left- and
206 * right-adjacent for DG.
207 */
208 std::vector<bool> m_leftAdjacentTraces;
209
210 /**
211 * Map of local trace (the points at the edge,face of
212 * the element) to the trace space discretisation
213 */
215
216 /// Discretises the boundary conditions.
220 const std::string variable, const bool DeclareCoeffPhysArrays = true,
221 const Collections::ImplementationType ImpType =
223
224 /// Make copy of boundary conditions.
228 const std::string variable, const bool DeclareCoeffPhysArrays = true,
229 const Collections::ImplementationType ImpType =
231
232 /// Generate a associative map of periodic vertices in a mesh.
234 const std::string variable);
235
236 void SetUpDG(const std::string = "DefaultVar",
237 const Collections::ImplementationType ImpType =
239
240 bool IsLeftAdjacentTrace(const int n, const int e);
241
242 ExpListSharedPtr &v_GetTrace() override;
243
246
248 void) const override;
249
250 std::vector<bool> &v_GetLeftAdjacentTraces(void) override;
251
253 Array<OneD, NekDouble> &outarray) override;
254
257 Array<OneD, NekDouble> &outarray) override;
258
261 Array<OneD, NekDouble> &field) override;
262
264 Array<OneD, NekDouble> &outarray,
265 bool gridVelocity = false) override;
266
267 void v_ExtractTracePhys(Array<OneD, NekDouble> &outarray) override;
268
272 Array<OneD, NekDouble> &locTraceFwd,
273 Array<OneD, NekDouble> &locTraceBwd) override;
274
276 const std::string variable);
277
278 std::map<int, RobinBCInfoSharedPtr> v_GetRobinBCInfo() override;
279
281 v_GetBndCondExpansions() override;
282
284 v_GetBndConditions() override;
285
287
289 override;
290
292 Array<OneD, int> &TraceID) override;
293 void v_GetBndElmtExpansion(int i, std::shared_ptr<ExpList> &result,
294 const bool DeclareCoeffPhysArrays) override;
295
296 void v_Reset() override;
297
298 /// Evaluate all boundary conditions at a given time..
300 const NekDouble time = 0.0, const std::string varName = "",
302 const NekDouble x3_in = NekConstants::kNekUnsetDouble) override;
303
304 /// Solve the Helmholtz equation.
306 Array<OneD, NekDouble> &outarray,
307 const StdRegions::ConstFactorMap &factors,
308 const StdRegions::VarCoeffMap &varcoeff,
309 const MultiRegions::VarFactorsMap &varfactors,
310 const Array<OneD, const NekDouble> &dirForcing,
311 const bool PhysSpaceForcing) override;
312
314 Array<OneD, NekDouble> &Bwd) override;
316
318
321
323 Array<OneD, NekDouble> &weightjmp) override;
324
326 Array<OneD, NekDouble> &Bwd) override;
327
330 Array<OneD, NekDouble> &Bwd, bool FillBnd = true,
331 bool PutFwdInBwdOnBCs = false,
332 bool DoExchange = true) override;
333
336 bool PutFwdInBwdOnBCs) override;
337
341 &bndConditions,
342 const Array<OneD, const ExpListSharedPtr> &BndCondExpansions,
343 bool PutFwdInBwdOnBCs);
344
346
347 void v_SetBndCondBwdWeight(const int index, const NekDouble value) override;
348
349 void v_GetPeriodicEntities(PeriodicMap &periodicVerts,
350 PeriodicMap &periodicEdges,
351 PeriodicMap &periodicFaces) override;
352
354 const Array<OneD, const NekDouble> &FwdFlux,
355 const Array<OneD, const NekDouble> &BwdFlux,
356 Array<OneD, NekDouble> &outarray) override;
357
358 void Rotate(Array<OneD, Array<OneD, NekDouble>> &Bwd, const int dir,
359 const NekDouble angle, const int offset, const int npts);
360
361 void DeriveRotate(TensorOfArray3D<NekDouble> &Bwd, const int dir,
362 const NekDouble angle, const int offset, const int npts);
363
364private:
365 std::vector<bool> m_negatedFluxNormal;
366
368 const SpatialDomains::CompositeMap &domain,
370 const std::string &variable);
371};
372
373typedef std::shared_ptr<DisContField> DisContFieldSharedPtr;
374
375} // namespace Nektar::MultiRegions
376
377#endif // NEKTAR_LIBS_MULTIREGIONS_DISCONTFIELD1D_H
#define MULTI_REGIONS_EXPORT
This class is the abstractio n of a global discontinuous two- dimensional spectral/hp element expansi...
~DisContField() override
Destructor.
Array< OneD, SpatialDomains::BoundaryConditionShPtr > & v_UpdateBndConditions() override
void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray) override
Add trace contributions into elemental coefficient spaces.
void GenerateFieldBnd1D(SpatialDomains::BoundaryConditions &bcs, const std::string variable)
PeriodicMap m_periodicEdges
A map which identifies pairs of periodic edges.
void SetUpDG(const std::string="DefaultVar", const Collections::ImplementationType ImpType=Collections::eNoImpType)
Set up all DG member variables and maps.
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
std::set< int > m_boundaryTraces
A set storing the global IDs of any boundary Verts.
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
std::vector< bool > m_negatedFluxNormal
MultiRegions::ExpListSharedPtr m_locElmtTrace
Local Elemental trace expansions.
SpatialDomains::BoundaryConditionsSharedPtr GetDomainBCs(const SpatialDomains::CompositeMap &domain, const SpatialDomains::BoundaryConditions &Allbcs, const std::string &variable)
AssemblyMapDGSharedPtr m_traceMap
Local to global DG mapping for trace space.
void EvaluateHDGPostProcessing(const Array< OneD, const NekDouble > &coeffs, Array< OneD, NekDouble > &outarray)
Evaluate HDG post-processing to increase polynomial order of solution.
void v_GetPeriodicEntities(PeriodicMap &periodicVerts, PeriodicMap &periodicEdges, PeriodicMap &periodicFaces) override
Obtain a copy of the periodic edges and vertices for this field.
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
For a given key, returns the associated global linear system.
const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > & v_GetBndConditions() override
MultiRegions::ExpListSharedPtr & v_UpdateBndCondExpansion(int i) override
void v_PeriodicBwdRot(Array< OneD, Array< OneD, NekDouble > > &Bwd) override
void v_ExtractTracePhys(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool gridVelocity=false) override
This method extracts the trace (verts in 1D) from the field inarray and puts the values in outarray.
void v_SetBndCondBwdWeight(const int index, const NekDouble value) override
void v_PeriodicBwdCopy(const Array< OneD, const NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd) override
void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &TraceID) override
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph1D, const SpatialDomains::BoundaryConditions &bcs, const std::string variable, const bool DeclareCoeffPhysArrays=true, const Collections::ImplementationType ImpType=Collections::eNoImpType)
Discretises the boundary conditions.
void v_RotLocalBwdDeriveTrace(TensorOfArray3D< NekDouble > &Bwd) override
InterfaceMapDGSharedPtr & v_GetInterfaceMap(void) override
void v_RotLocalBwdTrace(Array< OneD, Array< OneD, NekDouble > > &Bwd) override
InterfaceMapDGSharedPtr m_interfaceMap
Interfaces mapping for trace space.
void v_GetBndElmtExpansion(int i, std::shared_ptr< ExpList > &result, const bool DeclareCoeffPhysArrays) override
void v_FillBwdWithBwdWeight(Array< OneD, NekDouble > &weightave, Array< OneD, NekDouble > &weightjmp) override
Fill the weight with m_bndCondBndWeight.
const Array< OneD, const NekDouble > & v_GetBndCondBwdWeight() override
const Array< OneD, const MultiRegions::ExpListSharedPtr > & v_GetBndCondExpansions() override
void FindPeriodicTraces(const SpatialDomains::BoundaryConditions &bcs, const std::string variable)
Generate a associative map of periodic vertices in a mesh.
Array< OneD, NekDouble > m_bndCondBndWeight
bool SameTypeOfBoundaryConditions(const DisContField &In)
Check to see if expansion has the same BCs as In.
ExpListSharedPtr & v_GetTrace() override
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition structure definition on the diff...
void v_EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="", const NekDouble x2_in=NekConstants::kNekUnsetDouble, const NekDouble x3_in=NekConstants::kNekUnsetDouble) override
Evaluate all boundary conditions at a given time..
void FillBwdWithBoundCond(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd, const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > &bndConditions, const Array< OneD, const ExpListSharedPtr > &BndCondExpansions, bool PutFwdInBwdOnBCs)
void GetFwdBwdTracePhys(const Array< OneD, const NekDouble > &field, Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd, const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > &bndCond, const Array< OneD, const ExpListSharedPtr > &BndCondExp)
This method extracts the "forward" and "backward" trace data from the array field and puts the data i...
void v_AddFwdBwdTraceIntegral(const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &outarray) override
Add trace contributions into elemental coefficient spaces.
const LocTraceToTraceMapSharedPtr & v_GetLocTraceToTraceMap(void) const override
void v_AddTraceIntegralToOffDiag(const Array< OneD, const NekDouble > &FwdFlux, const Array< OneD, const NekDouble > &BwdFlux, Array< OneD, NekDouble > &outarray) override
void Rotate(Array< OneD, Array< OneD, NekDouble > > &Bwd, const int dir, const NekDouble angle, const int offset, const int npts)
Rotate the slice [offset, offset + npts) of the 3D vector field in Bwd around the axis 'dir' by 'angl...
void v_FillBwdWithBoundCond(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd, bool PutFwdInBwdOnBCs) override
GlobalLinSysMapShPtr m_globalBndMat
Global boundary matrix.
void DeriveRotate(TensorOfArray3D< NekDouble > &Bwd, const int dir, const NekDouble angle, const int offset, const int npts)
Rotate the slice [offset, offset + npts) of the 3D vector field in Bwd around the axis 'dir' by 'angl...
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
ExpListSharedPtr m_trace
Trace space storage for points between elements.
void v_AddTraceQuadPhysToField(const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &field) override
void v_Reset() override
Reset this field, so that geometry information can be updated.
std::vector< bool > & GetNegatedFluxNormal(void)
DisContField()
Default constructor.
std::vector< bool > & v_GetLeftAdjacentTraces(void) override
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
GlobalLinSysKey v_HelmSolve(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::ConstFactorMap &factors, const StdRegions::VarCoeffMap &varcoeff, const MultiRegions::VarFactorsMap &varfactors, const Array< OneD, const NekDouble > &dirForcing, const bool PhysSpaceForcing) override
Solve the Helmholtz equation.
std::vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
bool IsLeftAdjacentTrace(const int n, const int e)
This routine determines if an element is to the "left" of the adjacent trace, which arises from the i...
std::vector< bool > m_leftAdjacentTraces
NekDouble L2_DGDeriv(const int dir, const Array< OneD, const NekDouble > &coeffs, const Array< OneD, const NekDouble > &soln)
Calculate the error of the derivative using the consistent DG evaluation of .
ExpListSharedPtr & GetLocElmtTrace()
void v_GetLocTraceFromTracePts(const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &locTraceFwd, Array< OneD, NekDouble > &locTraceBwd) override
void GetLocTraceToTraceMap(LocTraceToTraceMapSharedPtr &LocTraceToTraceMap)
AssemblyMapDGSharedPtr & v_GetTraceMap(void) override
void v_PeriodicDeriveBwdRot(TensorOfArray3D< NekDouble > &Bwd) override
std::map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo() override
void v_GetFwdBwdTracePhys(Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd) override
Base class for all multi-elemental spectral/hp expansions.
Definition ExpList.h:99
A helper class to deal with trace operations in the discontinuous Galerkin code.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition Comm.h:55
std::shared_ptr< AssemblyMapDG > AssemblyMapDGSharedPtr
std::shared_ptr< DisContField > DisContFieldSharedPtr
std::shared_ptr< InterfaceMapDG > InterfaceMapDGSharedPtr
std::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< LocTraceToTraceMap > LocTraceToTraceMapSharedPtr
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
std::shared_ptr< GlobalLinSysMap > GlobalLinSysMapShPtr
Pointer to a GlobalLinSys/key map.
static const NekDouble kNekUnsetDouble
std::shared_ptr< BoundaryConditions > BoundaryConditionsSharedPtr
Definition Conditions.h:327
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition MeshGraph.h:217
std::map< int, CompositeSharedPtr > CompositeMap
Definition MeshGraph.h:179
std::map< ConstFactorType, NekDouble > ConstFactorMap
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap