chombo-discharge
Loading...
Searching...
No Matches
CD_LeastSquares.H
Go to the documentation of this file.
1/* chombo-discharge
2 * Copyright © 2021 SINTEF Energy Research.
3 * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4 */
5
12#ifndef CD_LeastSquares_H
13#define CD_LeastSquares_H
14
15// Chombo includes
16#include <Stencils.H>
17#include <EBISBox.H>
18#include <IntVectSet.H>
19#include <RealVect.H>
20#include <VolIndex.H>
21
22// Our includes
23#include <CD_VofUtils.H>
24#include <CD_Location.H>
25#include <CD_NamespaceHeader.H>
26
31{
32public:
36 LeastSquares() = delete;
37
41 ~LeastSquares() = delete;
42
47
60 static VoFStencil
64 const VolIndex& a_startVof,
65 const EBISBox& a_ebisbox,
66 const Real a_dx,
67 const int a_p,
68 const int a_radius,
69 const int a_order,
70 const bool a_addStartingVof);
71
85 static VoFStencil
89 const EBISBox& a_ebisbox,
90 const Real a_dx,
91 const int a_radius,
92 const int a_p,
93 const int a_order,
95
109 static VoFStencil
113 const EBISBox& a_ebisbox,
114 const Real a_dx,
115 const int a_radius,
116 const int a_p,
117 const int a_order,
119
134 static VoFStencil
138 const EBISBox& a_ebisbox,
139 const Real a_dx,
140 const int a_radius,
141 const int a_p,
142 const int a_order,
143 const bool a_addStartingVof);
144
151 static Real
152 sumWeights(const VoFStencil& a_stencil, const int a_variable);
153
159 static Real
161
169 static VoFStencil
171
182 static RealVect
184 const CellLocation a_to,
185 const VolIndex& a_fromVof,
186 const VolIndex& a_toVof,
187 const EBISBox& a_ebisbox,
188 const Real& a_dx);
189
200 static RealVect
202 const CellLocation a_toLoc,
203 const FaceIndex& a_fromFace,
204 const VolIndex& a_toVof,
205 const EBISBox& a_ebisbox,
206 const Real& a_dx);
207
220 static RealVect
222 const CellLocation a_to,
223 const VolIndex& a_fromVof,
224 const VolIndex& a_toVof,
225 const EBISBox& a_ebisboxFrom,
226 const EBISBox& a_ebisboxTo,
227 const Real& a_dxFrom,
228 const Real& a_dxTo);
229
239 static Vector<RealVect>
241 const CellLocation a_to,
242 const VolIndex& a_fromVof,
244 const EBISBox& a_ebisbox,
245 const Real& a_dx);
246
256 static Vector<RealVect>
258 const CellLocation a_to,
259 const FaceIndex& a_fromFace,
261 const EBISBox& a_ebisbox,
262 const Real& a_dx);
263
270 inline static Vector<Real>
272
283 static VoFStencil
286 const int a_p,
287 const int a_order,
289
301 static VoFStencil
304 const Vector<Real>& a_weights,
305 const int a_order,
307
313 static int
315
325 static VoFStencil
328 const int a_pow,
329 const int a_order);
330
341 static VoFStencil
344 const Vector<Real>& a_weights,
345 const int a_order);
346
370 const int a_p,
371 const int a_order);
372
397 const Vector<Real>& a_weights,
398 const int a_order);
399
423 template <typename T>
431 const int a_p,
432 const int a_order);
433
458 template <typename T>
468 const int a_order);
469};
470
471#include <CD_NamespaceFooter.H>
472
473#include <CD_LeastSquaresImplem.H>
474
475#endif
Declaration of cell positions.
Various functions for getting Vofs near cut-cells.
Static class containing useful routines for (weighted) least squares polynomial reconstruction.
Definition CD_LeastSquares.H:31
static std::map< IntVect, std::pair< VoFStencil, VoFStencil > > computeDualLevelStencils(const IntVectSet &a_derivs, const IntVectSet &a_knownTerms, const Vector< VolIndex > &a_fineVofs, const Vector< VolIndex > &a_coarVofs, const Vector< RealVect > &a_fineDisplacements, const Vector< RealVect > &a_coarDisplacements, const int a_p, const int a_order)
Compute a least squares interpolation to a specified order. This version separates the stencils into ...
Definition CD_LeastSquaresImplem.H:48
static Vector< RealVect > getDisplacements(const CellLocation a_from, const CellLocation a_to, const VolIndex &a_fromVof, const Vector< VolIndex > &a_toVofs, const EBISBox &a_ebisbox, const Real &a_dx)
Get displacement vectors from a cell position to another cell position for a list of Vofs,...
Definition CD_LeastSquares.cpp:278
static RealVect displacement(const CellLocation a_from, const CellLocation a_to, const VolIndex &a_fromVof, const VolIndex &a_toVof, const EBISBox &a_ebisbox, const Real &a_dx)
Computes the distance between two Vofs that are defined on the same grid level.
Definition CD_LeastSquares.cpp:232
static int getTaylorExpansionSize(const int a_order)
Get the size of a Taylor expansion for a given order.
Definition CD_LeastSquares.cpp:416
static VoFStencil computeInterpolationStencil(const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const int a_pow, const int a_order)
Compute an interpolation stencil to specified order by solving a least squares system.
Definition CD_LeastSquares.cpp:425
static VoFStencil computeGradSten(const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const int a_p, const int a_order, const IntVectSet a_knownTerms)
Get a least squares gradient stencil solution for computing the gradient at a point....
Definition CD_LeastSquares.cpp:317
static VoFStencil getGradSten(const VolIndex &a_vof, const CellLocation a_gradLocation, const CellLocation a_cellLocation, const EBISBox &a_ebisbox, const Real a_dx, const int a_radius, const int a_p, const int a_order, const IntVectSet a_knownTerms=IntVectSet())
Compute a least squares gradient stencil in a cell.
Definition CD_LeastSquares.cpp:57
static Real sumAllWeights(const VoFStencil &a_stencil)
Compute the sum of all weights in a stencil.
Definition CD_LeastSquares.cpp:404
static Real sumWeights(const VoFStencil &a_stencil, const int a_variable)
Return the sum of weights in the stencil, for a specific variable.
Definition CD_LeastSquares.cpp:388
static VoFStencil getInterpolationStencil(const CellLocation a_cellPos, const CellLocation a_otherCellsPos, const Connectivity a_connectivity, const VolIndex &a_startVof, const EBISBox &a_ebisbox, const Real a_dx, const int a_p, const int a_radius, const int a_order, const bool a_addStartingVof)
Get an interpolation stencil to a point in a cell with a specified order and radius.
Definition CD_LeastSquares.cpp:19
static VoFStencil projectGradSten(const VoFStencil &a_stencil, const RealVect &a_projection)
Assuming that a_stencil is a gradient stencil, project it along a direction.
Definition CD_LeastSquares.cpp:370
~LeastSquares()=delete
Static class, no destruction here.
static std::map< IntVect, VoFStencil > computeSingleLevelStencils(const IntVectSet &a_derivs, const IntVectSet &a_knownTerms, const Vector< VolIndex > &a_allVofs, const Vector< RealVect > &a_displacements, const int a_p, const int a_order)
Compute a least squares interpolation to a specified order.
Definition CD_LeastSquares.cpp:463
LeastSquares()=delete
Static class, no construction here.
static VoFStencil getBndryGradSten(const VolIndex &a_vof, const Neighborhood a_neighborhood, const CellLocation a_cellPositions, const EBISBox &a_ebisbox, const Real a_dx, const int a_radius, const int a_p, const int a_order, const bool a_addStartingVof)
Compute a least squares gradient stencil on the EB centroid with specified order.
Definition CD_LeastSquares.cpp:153
static Vector< Real > makeDiagWeights(const Vector< RealVect > &a_displacements, const int a_pow)
Create a list of weights. This routine returns a list of diagonal weights for a least squares system....
Definition CD_LeastSquaresImplem.H:22
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25
Neighborhood
Neighborhood type.
Definition CD_VofUtils.H:55
Connectivity
Class for specifying connectivity of Vofs.
Definition CD_VofUtils.H:42
Cell
Enum for distinguishing between cell locations.
Definition CD_Location.H:30
Face
Enum for distinguishing between face locations.
Definition CD_Location.H:40