chombo-discharge
Loading...
Searching...
No Matches
CD_PetscGrid.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_PETSCGRID_H
14#define CD_PETSCGRID_H
15
16#ifdef CH_USE_PETSC
17
18// Petsc includes
19#include "petsc.h"
20#include "petscis.h"
21
22// Chombo includes
23#include <DisjointBoxLayout.H>
24#include <EBCellFAB.H>
25#include <MFCellFAB.H>
26#include <EBISLayout.H>
27
28// Our includes
29#include <CD_DischargeIO.H>
30#include <CD_EBAMRData.H>
31#include <CD_MFLevelGrid.H>
32#include <CD_PetscDOF.H>
33#include <CD_PetscAMRCell.H>
34#include <CD_NamespaceHeader.H>
35
42class PetscGrid
43{
44public:
48 PetscGrid() noexcept;
49
53 virtual ~PetscGrid() noexcept;
54
71 virtual void
72 define(const Vector<RefCountedPtr<MFLevelGrid>>& a_levelGrids,
73 const Vector<RefCountedPtr<MFLevelGrid>>& a_levelGridsCoFi,
74 const Vector<RefCountedPtr<MFLevelGrid>>& a_levelGridsFiCo,
75 const Vector<RefCountedPtr<LevelData<BaseFab<bool>>>>& a_validCells,
76 const Vector<RefCountedPtr<LevelData<BaseFab<bool>>>>& a_coarHaloCF,
77 const Vector<RefCountedPtr<LevelData<BaseFab<bool>>>>& a_fineHaloCF,
78 const Vector<int>& a_refinementRatios,
79 const Vector<Real>& a_dx,
80 const int a_finestLevel,
81 const int a_numGhost) noexcept;
82
87 virtual void
88 clear() noexcept;
89
95 virtual void
96 create(Vec& x) noexcept;
97
103 virtual void
104 destroy(Vec& x) noexcept;
105
111 virtual void
112 setValue(Vec& a_x, const PetscScalar a_value) const noexcept;
113
119 virtual void
120 putChomboInPetsc(Vec& a_x, const MFAMRCellData& a_y) const noexcept;
121
127 virtual void
128 putPetscInChombo(MFAMRCellData& a_y, const Vec& a_x) const noexcept;
129
133 virtual void
134 dumpPetscGrid(const std::string& a_filename) const noexcept;
135
136protected:
140 bool m_isDefined;
141
145 bool m_verbose;
146
150 bool m_debug;
151
155 bool m_profile;
156
160 int m_finestLevel;
161
165 int m_numGhost;
166
170 int m_numPhases;
171
175 PetscInt m_numLocalRows;
176
180 PetscInt m_numGlobalRows;
181
185 PetscInt m_localRowBegin;
186
190 ISLocalToGlobalMapping m_localToGlobalIS;
191
195 Vector<PetscInt> m_numRowsPerRank;
196
200 Vector<RefCountedPtr<MFLevelGrid>> m_levelGrids;
201
205 Vector<RefCountedPtr<MFLevelGrid>> m_levelGridsCoFi;
206
210 Vector<RefCountedPtr<MFLevelGrid>> m_levelGridsFiCo;
211
215 Vector<RefCountedPtr<LevelData<BaseFab<bool>>>> m_validCells;
216
220 Vector<RefCountedPtr<LevelData<BaseFab<bool>>>> m_coarHaloCF;
221
225 Vector<RefCountedPtr<LevelData<BaseFab<bool>>>> m_fineHaloCF;
226
230 Vector<int> m_refRat;
231
235 Vector<Real> m_dx;
236
242 Vector<RefCountedPtr<LevelData<BaseFab<PetscAMRCell>>>> m_amrToPetsc;
243
249 Vector<RefCountedPtr<LevelData<BaseFab<PetscAMRCell>>>> m_amrToPetscCoFi;
250
256 Vector<RefCountedPtr<LevelData<BaseFab<PetscAMRCell>>>> m_amrToPetscFiCo;
257
262 Vector<RefCountedPtr<LayoutData<Vector<PetscDOF>>>> m_petscToAMR[2];
263
269 virtual void
270 defineAMRCells() noexcept;
271
278 virtual void
279 definePetscRows() noexcept;
280
284 virtual void
285 defineCoFiBuffers() noexcept;
286};
287
288#include <CD_NamespaceFooter.H>
289
290#endif
291
292#endif
Silly, but useful functions that override standard Chombo HDF5 IO.
Class for holding data across EBAMR hierarchies.
Declaration of a wrapper for wrapping multifluid EBLevelGrids.
Declaration of a cell type for indicating if a cell is covered, ghost, etc.
Declaration of a simple mapping between a PETSc index and an AMR cell.
Wrapper class for holding multifluid EBLevelGrids.
Definition CD_MFLevelGrid.H:30
Mapping between a PETSc local row index and an AMR grid cell.
Definition CD_PetscDOF.H:27