chombo-discharge
Loading...
Searching...
No Matches
CD_DataOps.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_DATAOPS_H
14#define CD_DATAOPS_H
15
16// Std includes
17#include <array>
18
19// Chombo includes
20#include <FaceIterator.H>
21#include <VoFIterator.H>
22
23// Our includes
24#include <CD_Average.H>
25#include <CD_EBAMRData.H>
26#include <CD_Decorations.H>
27#include <CD_MFInterfaceFAB.H>
28#include <CD_NamespaceHeader.H>
29
36{
37public:
43 template <typename T>
44 static void
46
52 template <typename T>
53 static int
54 sgn(const T a_value);
55
64 static void
68 const int a_tanGhosts,
70
79 static void
83 const int a_tanGhosts,
85
96 static void
101
114 static void
118 const int a_tanGhosts,
121 const Average& a_average,
123
135 static void
138 const ProblemDomain& a_domain,
139 const int a_tanGhosts,
142 const Average& a_average,
144
153 static void
158
167 static void
170 const ProblemDomain& a_domain,
172
181 static void
185 const Real a_a,
186 const Real a_b) noexcept;
187
195 static void
199
207 static void
211
219 static void
221
230 static void
232
241 static void
243 const EBAMRCellData& a_data1,
244 const EBAMRCellData& a_data2,
246
255 static void
260
270 static void
272 const EBCellFAB& a_data1,
273 const EBCellFAB& a_data2,
274 const Box& a_box,
276
287 static void
288 filterSmooth(EBAMRCellData& a_data, const Real a_alpha, const int a_stride, const bool a_zeroEB) noexcept;
289
300 static void
301 filterSmooth(LevelData<EBCellFAB>& a_data, const Real a_alpha, const int a_stride, const bool a_zeroEB) noexcept;
302
309 static void
310 incr(MFAMRCellData& a_lhs, const MFAMRCellData& a_rhs, const Real a_scale) noexcept;
311
318 static void
320
327 static void
328 incr(EBAMRCellData& a_lhs, const EBAMRCellData& a_rhs, const Real& a_scale) noexcept;
329
336 static void
338
345 static void
347
354 static void
356
363 static void
364 incr(EBFluxFAB& a_lhs, const EBFluxFAB& a_rhs, const Real& a_scale);
365
373 static void
375
383 static void
385
393 static void
395 const EBAMRIVData& a_rhs,
396 const Real& a_scale,
398
406 static void
409 const Real& a_scale,
411
418 static void
420
427 static void
429
438 static void
440 const EBAMRIVData& a_rhs,
441 const Real a_scale,
443
452 static void
455 const Real a_scale,
457
466 static void
468 const EBAMRCellData& a_rhs,
469 const Real a_scale,
471
480 static void
483 const Real a_scale,
485
491 static void
493
499 static void
501
507 static void
509
517 template <typename T>
518 static void
520
528 static void
529 divide(EBAMRCellData& a_lhs, const EBAMRCellData& a_rhs, const int a_lhsComp, const int a_rhsComp);
530
538 static void
540
546 static void
548
554 static void
556
564 static void
567 const Real a_fallback,
569
578 static void
581 const Real a_fallback,
583
591 static void
596
605 static void
610
618 static void
620
628 static void
630
637 static void
639
646 static void
648
656 static void
658
666 static void
668
675 static void
677
684 static void
686
694 static void
696 const EBAMRCellData& a_data1,
697 const EBAMRCellData& a_data2,
699
707 static void
712
722 static void
724 Real& min,
726 const int a_comp,
728
737 static void
739 Real& a_min,
741 const int a_comp,
743
753 static void
755 Real& a_min,
757 const int a_comp,
759
768 static void
770 Real& a_min,
772 const int a_comp,
774
782 static void
784
793 static void
795 Real& a_min,
798
806 static void
808
817 static void
819 Real& a_min,
822
830 static void
832
838 static void
840
847 static void
849
856 static void
858
864 static void
866
875 static void
879 const int a_comp,
881
887 static void
889
895 static void
897
904 static void
908
915 static void
919
925 static void
927
934 static void
936
943 static void
945
952 static void
954
961 static void
963
971 static void
973 const EBAMRIVData& a_rhs,
975
983 static void
987
994 static void
996
1003 static void
1005
1012 static void
1014 const EBAMRIVData& a_rhs,
1016
1023 static void
1027
1038 static Real
1041 const int a_p,
1043 const int a_comp = 0);
1044
1054 static void
1055 plus(EBAMRCellData& a_lhs, const EBAMRCellData& a_rhs, const int a_srcComp, const int a_dstComp, const int a_numComp);
1056
1066 static void
1069 const int a_srcComp,
1070 const int a_dstComp,
1071 const int a_numComp);
1072
1078 static void
1079 scale(MFAMRCellData& a_lhs, const Real& a_scale) noexcept;
1080
1086 static void
1087 scale(LevelData<MFCellFAB>& a_lhs, const Real& a_scale) noexcept;
1088
1094 static void
1096
1102 static void
1104
1111 static void
1113
1119 static void
1120 scale(EBAMRCellData& a_lhs, const Real a_scale) noexcept;
1121
1127 static void
1128 scale(LevelData<EBCellFAB>& a_lhs, const Real a_scale) noexcept;
1129
1135 static void
1137
1143 static void
1145
1152 static void
1154
1162 static void
1164
1172 static void
1175 const int a_comp,
1176 const Real a_value);
1177
1184 static void
1186
1193 static void
1195
1202 static void
1203 setCoveredValue(EBAMRFluxData& a_lhs, const int a_comp, const Real a_value) noexcept;
1204
1211 static void
1212 setCoveredValue(LevelData<EBFluxFAB>& a_lhs, const int a_comp, const Real a_value) noexcept;
1213
1219 static void
1221
1227 static void
1229
1236 static void
1238
1249 static void
1251 const std::function<Real(const RealVect)>& a_function,
1252 const RealVect& a_probLo,
1253 const Vector<Real>& a_dx,
1254 const int a_comp,
1257
1268 static void
1270 const std::function<Real(const RealVect)>& a_function,
1271 const RealVect a_probLo,
1272 const Real a_dx,
1273 const int a_comp,
1276
1286 static void
1288 const std::function<Real(const RealVect)>& a_function,
1289 const RealVect& a_probLo,
1290 const Vector<Real>& a_dx,
1291 const int a_comp,
1293
1303 static void
1305 const std::function<Real(const RealVect)>& a_function,
1306 const RealVect a_probLo,
1307 const Real a_dx,
1308 const int a_comp,
1310
1320 static void
1322 const std::function<Real(const RealVect)>& a_function,
1323 const RealVect& a_probLo,
1324 const Vector<Real>& a_dx,
1325 const int a_comp,
1327
1337 static void
1339 const std::function<Real(const RealVect)>& a_function,
1340 const RealVect a_probLo,
1341 const Real a_dx,
1342 const int a_comp,
1344
1354 static void
1356 const std::function<Real(const RealVect)>& a_function,
1357 const RealVect& a_probLo,
1358 const Vector<Real>& a_dx,
1359 const int a_comp,
1361
1371 static void
1373 const std::function<Real(const RealVect)>& a_function,
1374 const RealVect a_probLo,
1375 const Real a_dx,
1376 const int a_comp,
1378
1387 static void
1390 const RealVect& a_probLo,
1391 const Vector<Real>& a_dx,
1393
1402 static void
1405 const RealVect a_probLo,
1406 const Real a_dx,
1408
1414 static void
1416
1423 static void
1424 setValue(EBAMRCellData& a_lhs, const Real a_value, const int a_comp);
1425
1432 static void
1434
1440 static void
1442
1448 static void
1450
1456 static void
1458
1464 static void
1466
1472 static void
1474
1480 static void
1481 setValue(MFAMRCellData& a_lhs, const Real& a_value) noexcept;
1482
1488 static void
1489 setValue(LevelData<MFCellFAB>& a_lhs, const Real& a_value) noexcept;
1490
1496 static void
1498
1504 static void
1506
1512 static void
1514
1520 static void
1522
1528 static void
1530
1536 static void
1538
1543 static void
1544 sum(Real& a_value);
1545
1552 static void
1554
1561 static void
1563
1571 static void
1575
1583 static void
1587
1596 static void
1598 const EBAMRCellData& a_rhs,
1601
1610 static void
1615
1625 static void
1627 const EBCellFAB& a_rhs,
1628 const EBCellFAB& a_notCovered,
1629 const Box& box,
1631
1640 static void
1642 const EBAMRCellData& a_rhs,
1645
1654 static void
1659
1669 static void
1671 const EBCellFAB& a_rhs,
1672 const EBCellFAB& a_notCovered,
1673 const Box& box,
1675
1683 static void
1685
1693 static bool
1695
1702 static void
1704};
1705
1706#include <CD_NamespaceFooter.H>
1707
1708#include <CD_DataOpsImplem.H>
1709
1710#endif
Declaration of averaging methods.
Average
Various averaging methods.
Definition CD_Average.H:25
Implementation of CD_DataOps.H.
Declaration of various decoration macros.
Class for holding data across EBAMR hierarchies.
Declaration of a class that allocates irregular data holders over the interface between two phases.
Agglomeration of useful data operations.
Definition CD_DataOps.H:36
static void scale(MFAMRCellData &a_lhs, const Real &a_scale) noexcept
Scale data by factor.
Definition CD_DataOps.cpp:2503
static void floor(EBAMRCellData &a_lhs, const Real a_value, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Floor values in data holder. This sets all values below a_value to a_value.
Definition CD_DataOps.cpp:1465
static void getMaxMin(Real &max, Real &min, EBAMRCellData &a_data, const int a_comp, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Get maximum and minimum value of specified component.
Definition CD_DataOps.cpp:1711
static void averageFaceToCell(EBAMRCellData &a_cellData, const EBAMRFluxData &a_faceData, const Vector< ProblemDomain > &a_domains, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Average all components of face centered data to cell centers.
Definition CD_DataOps.cpp:362
static void volumeScale(EBAMRCellData &a_data, const Vector< Real > &a_dx)
Scale data by dx^SpaceDim.
Definition CD_DataOps.cpp:2236
static void vectorLength2(EBAMRCellData &a_lhs, const EBAMRCellData &a_rhs, const EBAMRCellData &a_notCovered, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Compute the squared vector length of a data holder. Sets a_lhs = |a_rhs|^2 where a_rhs contains Space...
Definition CD_DataOps.cpp:3594
static int sgn(const T a_value)
Sign function. Returns +/- if the value is > 0 or < 0.
Definition CD_DataOpsImplem.H:43
static void getMaxMinNorm(Real &a_max, Real &a_min, EBAMRCellData &data, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Get maximum and minimum value of normed data.
Definition CD_DataOps.cpp:1879
static void filterSmooth(EBAMRCellData &a_data, const Real a_alpha, const int a_stride, const bool a_zeroEB) noexcept
Apply a convolved filter phi = alpha * phi_i + 0.5*(1-alpha) * [phi_(i+s) + phi_(i-s)] in each direct...
Definition CD_DataOps.cpp:679
static void divide(EBAMRCellData &a_lhs, const EBAMRCellData &a_rhs, const int a_lhsComp, const int a_rhsComp)
Divide one data holder by another. Does specified components.
Definition CD_DataOps.cpp:1243
static void roof(EBAMRCellData &a_lhs, const Real a_value, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Roof values in data holder. This sets all values above a_value to a_value.
Definition CD_DataOps.cpp:1556
static void setInvalidValue(EBAMRCellData &a_lhs, const Vector< int > &a_refRat, const Real a_value)
Set value in cells that are covered by a finer grid.
Definition CD_DataOps.cpp:2771
static void shiftCorners(Vector< RealVect > &a_corners, const RealVect &a_distance)
Shift points by a specified distance.
Definition CD_DataOps.cpp:3771
static void divideByScalar(EBAMRCellData &a_lhs, const EBAMRCellData &a_rhs)
Divide all components in a data holder by a scalar value.
Definition CD_DataOps.cpp:1279
static void multiply(EBAMRCellData &a_lhs, const EBAMRCellData &a_rhs)
Multiply data holder by another data holder.
Definition CD_DataOps.cpp:2246
static void invert(EBAMRFluxData &a_data)
Invert data.
static void computeMinValidBox(RealVect &a_lo, RealVect &a_hi, const RealVect &a_normal, const RealVect &a_centroid)
Compute the tightest possible valid box around a cut-cell volume.
Definition CD_DataOps.cpp:3687
static void invert(EBFluxFAB &a_data)
Invert data.
static void sum(Real &a_value)
Compute the sum of the input value.
Definition CD_DataOps.cpp:3367
static void vectorLength(EBAMRCellData &a_lhs, const EBAMRCellData &a_rhs, const EBAMRCellData &a_notCovered, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Compute the vector length of a data holder. Sets a_lhs = |a_rhs| where a_rhs contains SpaceDim compon...
Definition CD_DataOps.cpp:3500
static void incr(MFAMRCellData &a_lhs, const MFAMRCellData &a_rhs, const Real a_scale) noexcept
Function which increments data in the form a_lhs = a_lhs + a_rhs*a_scale for all components.
Definition CD_DataOps.cpp:820
static Real norm(const LevelData< EBCellFAB > &a_data, const LevelData< EBCellFAB > &a_regularMask, const int a_p, LayoutData< VoFIterator > &a_vofIter, const int a_comp=0)
Compute specified norm of data.
Definition CD_DataOps.cpp:2418
static void kappaScale(EBAMRCellData &a_data, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter) noexcept
Scale data by volume fraction.
Definition CD_DataOps.cpp:2142
static void setValue(LevelData< MFInterfaceFAB< T > > &a_lhs, const T &a_value)
Set value in an MFInterfaceFAB data holder.
Definition CD_DataOpsImplem.H:24
static bool allCornersInsideEb(const Vector< RealVect > &a_corners, const RealVect &a_normal, const RealVect &a_centroid)
Check if all corners/points are inside an EB.
Definition CD_DataOps.cpp:3754
static void divideFallback(EBAMRCellData &a_numerator, const EBAMRCellData &a_denominator, const Real a_fallback, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Divide data. If the denominator is zero, set the value to a fallback option.
Definition CD_DataOps.cpp:1387
static void dotProduct(MFAMRCellData &a_result, const MFAMRCellData &a_data1, const MFAMRCellData &a_data2)
Compote the cell-wise dot product between two data holders.
Definition CD_DataOps.cpp:537
static void squareRoot(EBAMRFluxData &a_lhs, Vector< RefCountedPtr< LayoutData< std::array< FaceIterator, SpaceDim > > > > &a_faceIter)
Compute the square root of the input data.
Definition CD_DataOps.cpp:3384
static void setCoveredValue(EBAMRCellData &a_lhs, const EBAMRCellData &a_coveredMask, const int a_comp, const Real a_value)
Set value in covered cells. Does specified component.
Definition CD_DataOps.cpp:2655
static void max(EBAMRCellData &a_data, const EBAMRCellData &a_data1, const EBAMRCellData &a_data2, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter)
Make a_data = max(a_data1, a_data2).
Definition CD_DataOps.cpp:1645
static void kappaSum(Real &a_mass, const LevelData< EBCellFAB > &a_lhs, const LevelData< EBCellFAB > &a_regularMask, const int a_comp, LayoutData< VoFIterator > &a_vofIter)
Compute the kappa-weighted sum of the input data. Assumes one component.
Definition CD_DataOps.cpp:2087
static void compute(EBAMRCellData &a_data, const std::function< Real(const Real a_cellValue)> &a_func, const Vector< RefCountedPtr< LayoutData< VoFIterator > > > &a_vofIter) noexcept
Compute a new value given the old cell value.
Definition CD_DataOps.cpp:482
static void plus(EBAMRCellData &a_lhs, const EBAMRCellData &a_rhs, const int a_srcComp, const int a_dstComp, const int a_numComp)
General addition operator for adding together data. The user can choose which components to add.
Definition CD_DataOps.cpp:885
static void copy(MFAMRCellData &a_dst, const MFAMRCellData &a_src)
Copy data from one data holder to another.
Definition CD_DataOps.cpp:1201
static void averageCellVelocityToFaceVelocity(EBAMRFluxData &a_faceData, const EBAMRCellData &a_cellData, const Vector< ProblemDomain > &a_domains, const int a_tanGhosts, Vector< RefCountedPtr< LayoutData< std::array< FaceIterator, SpaceDim > > > > &a_faceIter)
Routine which computes the average of a cell-centered quantity on faces for the normal component only...
Definition CD_DataOps.cpp:28
static void averageCellToFace(EBAMRFluxData &a_faceData, const EBAMRCellData &a_cellData, const Vector< ProblemDomain > &a_domains, Vector< RefCountedPtr< LayoutData< std::array< FaceIterator, SpaceDim > > > > &a_faceIter)
Average all components of the cell-centered data to faces (arithmetic, no tangential ghost faces).
Definition CD_DataOps.cpp:148
static void multiplyScalar(EBAMRCellData &a_lhs, const EBAMRCellData &a_rhs)
Multiply data holder by another data holder.
Definition CD_DataOps.cpp:2341
static void axby(LevelData< EBCellFAB > &a_lhs, const LevelData< EBCellFAB > &a_x, const LevelData< EBCellFAB > &a_y, const Real a_a, const Real a_b) noexcept
Compute lhs = a * x + b * y.
Definition CD_DataOps.cpp:462
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:38
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:26