PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
ibpm.cpp
Go to the documentation of this file.
1
10#include <petscviewerhdf5.h>
11
12#include <petibm/delta.h>
13#include <petibm/io.h>
14
15#include "ibpm.h"
16
17IBPMSolver::IBPMSolver(const MPI_Comm &world,
18 const YAML::Node &node)
19{
20 init(world, node);
21} // IBPMSolver
22
24{
25 PetscErrorCode ierr;
26 PetscBool finalized;
27
28 PetscFunctionBeginUser;
29
30 ierr = PetscFinalized(&finalized); CHKERRV(ierr);
31 if (finalized) return;
32
33 ierr = destroy(); CHKERRV(ierr);
34} // ~IBPMSolver
35
36// manual destroy data
37PetscErrorCode IBPMSolver::destroy()
38{
39 PetscErrorCode ierr;
40
41 PetscFunctionBeginUser;
42
43 bodies.reset();
44 ierr = ISDestroy(&isDE[0]); CHKERRQ(ierr);
45 ierr = ISDestroy(&isDE[1]); CHKERRQ(ierr);
46 ierr = VecResetArray(P); CHKERRQ(ierr);
47 ierr = VecDestroy(&P); CHKERRQ(ierr);
48 ierr = PetscViewerDestroy(&forcesViewer); CHKERRQ(ierr);
49 ierr = NavierStokesSolver::destroy(); CHKERRQ(ierr);
50
51 PetscFunctionReturn(0);
52} // destroy
53
54PetscErrorCode IBPMSolver::init(const MPI_Comm &world, const YAML::Node &node)
55{
56 PetscErrorCode ierr;
57
58 PetscFunctionBeginUser;
59
60 // create a pack of immersed bodies
61 PetscInt dim = node["mesh"].size();
63 world, dim, node, bodies); CHKERRQ(ierr);
64
65 ierr = NavierStokesSolver::init(world, node); CHKERRQ(ierr);
66
67 ierr = PetscLogStagePush(stageInitialize); CHKERRQ(ierr);
68
69 // create an ASCII PetscViewer to output the body forces
71 config["output"].as<std::string>() +
72 "/forces-" + std::to_string(ite) + ".txt",
73 FILE_MODE_WRITE, forcesViewer); CHKERRQ(ierr);
74
75 // register additional logging stage
76 ierr = PetscLogStageRegister(
77 "integrateForces", &stageIntegrateForces); CHKERRQ(ierr);
78
79 ierr = PetscLogStagePop(); CHKERRQ(ierr);
80
81 PetscFunctionReturn(0);
82} // init
83
84// write solution fields, linear solvers info, and body forces to files
85PetscErrorCode IBPMSolver::write()
86{
87 PetscErrorCode ierr;
88
89 PetscFunctionBeginUser;
90
91 ierr = NavierStokesSolver::write(); CHKERRQ(ierr);
92
93 // write body forces
94 ierr = writeForcesASCII(); CHKERRQ(ierr);
95
96 PetscFunctionReturn(0);
97} // write
98
99// create the linear operators of the solver (PETSc Mat objects)
101{
102 PetscErrorCode ierr;
103
104 PetscFunctionBeginUser;
105
106 Mat R, MHat, BN, GH[2], DE[2]; // temporary operators
107 Vec RDiag, MHatDiag; // temporary vectors
108 IS is[2]; // temporary index sets
109
110 // create the divergence operator: D
112 mesh, bc, DE[0], DCorrection, PETSC_FALSE); CHKERRQ(ierr);
113
114 // create the gradient operator: G
116 mesh, GH[0], PETSC_FALSE); CHKERRQ(ierr);
117
118 // create the Laplacian operator: L
120 mesh, bc, L, LCorrection); CHKERRQ(ierr);
121
122 // create the operator for the convective terms: N
124 mesh, bc, N); CHKERRQ(ierr);
125
126 // create the implicit operator for the velocity system: A
127 ierr = MatDuplicate(L, MAT_COPY_VALUES, &A); CHKERRQ(ierr);
128 ierr = MatScale(A, -diffCoeffs->implicitCoeff * nu); CHKERRQ(ierr);
129 ierr = MatShift(A, 1.0 / dt); CHKERRQ(ierr);
130
131 // create diagonal matrix R and hold the diagonal in a PETSc Vec object
132 ierr = petibm::operators::createR(mesh, R); CHKERRQ(ierr);
133 ierr = MatCreateVecs(R, nullptr, &RDiag); CHKERRQ(ierr);
134 ierr = MatGetDiagonal(R, RDiag); CHKERRQ(ierr);
135
136 // create diagonal matrix MHat and hold the diagonal in a PETSc Vec object
137 ierr = petibm::operators::createMHead(mesh, MHat); CHKERRQ(ierr);
138 ierr = MatCreateVecs(MHat, nullptr, &MHatDiag); CHKERRQ(ierr);
139 ierr = MatGetDiagonal(MHat, MHatDiag); CHKERRQ(ierr);
140
141 // create a Delta operator and its transpose (equal to H)
142 ierr = bodies->updateMeshIdx(mesh); CHKERRQ(ierr);
143 const YAML::Node &node = config["parameters"];
144 std::string name = node["delta"].as<std::string>("ROMA_ET_AL_1999");
146 PetscInt kernelSize;
147 ierr = petibm::delta::getKernel(name, kernel, kernelSize); CHKERRQ(ierr);
149 mesh, bc, bodies, kernel, kernelSize, DE[1]); CHKERRQ(ierr);
150 ierr = MatTranspose(DE[1], MAT_INITIAL_MATRIX, &GH[1]); CHKERRQ(ierr);
151
152 // create the regularization operator: E
153 ierr = MatDiagonalScale(DE[1], nullptr, RDiag); CHKERRQ(ierr);
154 ierr = MatDiagonalScale(DE[1], nullptr, MHatDiag); CHKERRQ(ierr);
155 ierr = VecDestroy(&RDiag); CHKERRQ(ierr);
156 ierr = VecDestroy(&MHatDiag); CHKERRQ(ierr);
157 ierr = MatDestroy(&R); CHKERRQ(ierr);
158 ierr = MatDestroy(&MHat); CHKERRQ(ierr);
159
160 // create the opposite of the spreading operator: -H
161 ierr = MatScale(GH[1], -1.0); CHKERRQ(ierr);
162
163 // get combined operator G; R is used temporarily
164 ierr = MatCreateNest(
165 comm, 1, nullptr, 2, nullptr, GH, &R); CHKERRQ(ierr);
166 ierr = MatConvert(R, MATAIJ, MAT_INITIAL_MATRIX, &G); CHKERRQ(ierr);
167 ierr = MatDestroy(&R); CHKERRQ(ierr);
168 ierr = MatDestroy(&GH[0]); CHKERRQ(ierr);
169 ierr = MatDestroy(&GH[1]); CHKERRQ(ierr);
170
171 // get combined operator D; R is used temporarily; also get ISs
172 ierr = MatCreateNest(
173 comm, 2, nullptr, 1, nullptr, DE, &R); CHKERRQ(ierr);
174 ierr = MatConvert(R, MATAIJ, MAT_INITIAL_MATRIX, &D); CHKERRQ(ierr);
175 ierr = MatNestGetISs(R, is, nullptr); CHKERRQ(ierr);
176 ierr = ISDuplicate(is[0], &isDE[0]); CHKERRQ(ierr);
177 ierr = ISDuplicate(is[1], &isDE[1]); CHKERRQ(ierr);
178 ierr = ISCopy(is[0], isDE[0]); CHKERRQ(ierr);
179 ierr = ISCopy(is[1], isDE[1]); CHKERRQ(ierr);
180 ierr = MatDestroy(&R); CHKERRQ(ierr);
181 ierr = MatDestroy(&DE[0]); CHKERRQ(ierr);
182 ierr = MatDestroy(&DE[1]); CHKERRQ(ierr);
183
184 // create the projection operator: BNG
185 PetscInt N; // order of the truncate Taylor series expansion
186 N = config["parameters"]["BN"].as<PetscInt>(1);
188 L, dt, diffCoeffs->implicitCoeff * nu, N, BN); CHKERRQ(ierr);
189 ierr = MatMatMult(
190 BN, G, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &BNG); CHKERRQ(ierr);
191
192 // create the modified Poisson operator
193 ierr = MatMatMult(
194 D, BNG, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &DBNG); CHKERRQ(ierr);
195
196 // set the nullspace of the modified Poisson system
197 ierr = setNullSpace(); CHKERRQ(ierr);
198
199 // destroy temporary operator
200 ierr = MatDestroy(&BN); CHKERRQ(ierr);
201
202 PetscFunctionReturn(0);
203} // createOperators
204
205// create the vectors of the solver (PETSc Vec objects)
207{
208 PetscErrorCode ierr;
209
210 PetscFunctionBeginUser;
211
212 Vec temp;
213 const PetscReal *data;
214
215 // create the vector of the couple (pressure field, Lagrangian forces)
216 ierr = MatCreateVecs(G, &P, nullptr); CHKERRQ(ierr);
217
218 // swap pGlobal and P to reuse functions from the Navier-Stokes solver
219 temp = solution->pGlobal;
220 solution->pGlobal = P;
221 P = temp;
222 temp = PETSC_NULL;
223
224 // destroy P's underlying raw array but keep all other information
225 ierr = VecReplaceArray(P, nullptr); CHKERRQ(ierr);
226
227 // reset the underlying data of P to the pressure portion in pGlobal
228 ierr = VecGetSubVector(solution->pGlobal, isDE[0], &temp); CHKERRQ(ierr);
229 ierr = VecGetArrayRead(temp, &data); CHKERRQ(ierr);
230 ierr = VecPlaceArray(P, data); CHKERRQ(ierr);
231 ierr = VecRestoreArrayRead(temp, &data); CHKERRQ(ierr);
232 ierr = VecRestoreSubVector(
233 solution->pGlobal, isDE[0], &temp); CHKERRQ(ierr);
234
235 // create remaining vectors
236 ierr = NavierStokesSolver::createVectors(); CHKERRQ(ierr);
237
238 PetscFunctionReturn(0);
239} // createVectors
240
241// set the nullspace of the modified Poisson system
243{
244 PetscErrorCode ierr;
245
246 PetscFunctionBeginUser;
247
248 std::string type;
249 ierr = pSolver->getType(type); CHKERRQ(ierr);
250
251 if (type == "PETSc KSP")
252 {
253 Vec n, phiPortion;
254 MatNullSpace nsp;
255 ierr = MatCreateVecs(DBNG, &n, nullptr); CHKERRQ(ierr);
256 ierr = VecSet(n, 0.0); CHKERRQ(ierr);
257 ierr = VecGetSubVector(n, isDE[0], &phiPortion); CHKERRQ(ierr);
258 ierr = VecSet(phiPortion, 1.0 / std::sqrt(mesh->pN)); CHKERRQ(ierr);
259 ierr = VecRestoreSubVector(n, isDE[0], &phiPortion); CHKERRQ(ierr);
260 ierr = MatNullSpaceCreate(
261 comm, PETSC_FALSE, 1, &n, &nsp); CHKERRQ(ierr);
262 ierr = MatSetNullSpace(DBNG, nsp); CHKERRQ(ierr);
263 ierr = MatSetNearNullSpace(DBNG, nsp); CHKERRQ(ierr);
264 ierr = VecDestroy(&n); CHKERRQ(ierr);
265 ierr = MatNullSpaceDestroy(&nsp); CHKERRQ(ierr);
266 isRefP = PETSC_FALSE;
267 }
268 else if (type == "NVIDIA AmgX")
269 {
270 PetscInt row[1] = {0};
271 ierr = MatZeroRowsColumns(
272 DBNG, 1, row, 1.0, nullptr, nullptr); CHKERRQ(ierr);
273 isRefP = PETSC_TRUE;
274 }
275 else
276 {
277 SETERRQ1(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONG,
278 "Could not recognize the type of linear solver: %s\n",
279 type.c_str());
280 }
281
282 PetscFunctionReturn(0);
283} // setNullSpace
284
285// assemble the right-hand side vector of the modified Poisson system
287{
288 PetscErrorCode ierr;
289
290 PetscFunctionBeginUser;
291
292 ierr = PetscLogStagePush(stageRHSPoisson); CHKERRQ(ierr);
293
294 // compute the divergence of the intermediate velocity field
295 ierr = MatMult(D, solution->UGlobal, rhs2); CHKERRQ(ierr);
296
297 // note: bc2 is a subset of rhs2
298 Vec bc2;
299 ierr = VecGetSubVector(rhs2, isDE[0], &bc2); CHKERRQ(ierr);
300 ierr = MatMultAdd(DCorrection, solution->UGlobal, bc2, bc2); CHKERRQ(ierr);
301 ierr = VecRestoreSubVector(rhs2, isDE[0], &bc2); CHKERRQ(ierr);
302
303 if (isRefP) // if the pressure is pinned at one point
304 {
305 ierr = VecSetValue(rhs2, 0, 0.0, INSERT_VALUES); CHKERRQ(ierr);
306 ierr = VecAssemblyBegin(rhs2); CHKERRQ(ierr);
307 ierr = VecAssemblyEnd(rhs2); CHKERRQ(ierr);
308 }
309
310 ierr = PetscLogStagePop(); CHKERRQ(ierr);
311
312 PetscFunctionReturn(0);
313} // assembleRHSPoisson
314
315// write the solution fields into a HDF5 file
316PetscErrorCode IBPMSolver::writeSolutionHDF5(const std::string &filePath)
317{
318 PetscErrorCode ierr;
319
320 PetscFunctionBeginUser;
321
322 Vec temp = PETSC_NULL;
323
324 // let solution->pGlobal point to P, so that we can use solution->write
325 temp = solution->pGlobal;
326 solution->pGlobal = P;
327
328 ierr = NavierStokesSolver::writeSolutionHDF5(filePath); CHKERRQ(ierr);
329
330 // restore pointers
331 solution->pGlobal = temp;
332 temp = PETSC_NULL;
333
334 PetscFunctionReturn(0);
335} // writeSolutionHDF5
336
337// write all data required to restart a simulation into a HDF5 file
338PetscErrorCode IBPMSolver::writeRestartDataHDF5(const std::string &filePath)
339{
340 PetscErrorCode ierr;
341
342 PetscFunctionBeginUser;
343
344 ierr = NavierStokesSolver::writeRestartDataHDF5(filePath); CHKERRQ(ierr);
345
346 // write forces
347 Vec f;
348 ierr = VecGetSubVector(solution->pGlobal, isDE[1], &f); CHKERRQ(ierr);
350 comm, filePath, "/", {"force"}, {f}, FILE_MODE_APPEND); CHKERRQ(ierr);
351 ierr = VecRestoreSubVector(solution->pGlobal, isDE[1], &f); CHKERRQ(ierr);
352
353 PetscFunctionReturn(0);
354} // writeRestartDataHDF5
355
356// read all data required to restart a simulation into a HDF5 file
357PetscErrorCode IBPMSolver::readRestartDataHDF5(const std::string &filePath)
358{
359 PetscErrorCode ierr;
360
361 PetscFunctionBeginUser;
362
363 Vec temp = PETSC_NULL;
364
365 // let solution->pGlobal point to P, so that we can use solution->write
366 temp = solution->pGlobal;
367 solution->pGlobal = P;
368
369 ierr = NavierStokesSolver::readRestartDataHDF5(filePath); CHKERRQ(ierr);
370
371 // restore pointers
372 solution->pGlobal = temp;
373 temp = PETSC_NULL;
374
375 // write forces
376 std::vector<Vec> f(1);
377 ierr = VecGetSubVector(solution->pGlobal, isDE[1], &f[0]); CHKERRQ(ierr);
379 comm, filePath, "/", {"force"}, f); CHKERRQ(ierr);
380 ierr = VecRestoreSubVector(
381 solution->pGlobal, isDE[1], &f[0]); CHKERRQ(ierr);
382
383 PetscFunctionReturn(0);
384} // readRestartDataHDF5
385
386// integrate the forces and output to ASCII file
388{
389 PetscErrorCode ierr;
391
392 PetscFunctionBeginUser;
393
394 ierr = PetscLogStagePush(stageIntegrateForces); CHKERRQ(ierr);
395
396 // get sub section f and calculate averaged forces
397 Vec f;
398 ierr = VecGetSubVector(solution->pGlobal, isDE[1], &f); CHKERRQ(ierr);
399 ierr = bodies->calculateAvgForces(f, fAvg); CHKERRQ(ierr);
400 ierr = VecRestoreSubVector(solution->pGlobal, isDE[1], &f); CHKERRQ(ierr);
401
402 ierr = PetscLogStagePop(); CHKERRQ(ierr);
403
404 ierr = PetscLogStagePush(stageWrite); CHKERRQ(ierr);
405
406 // write the time value
407 ierr = PetscViewerASCIIPrintf(forcesViewer, "%10.8e\t", t); CHKERRQ(ierr);
408
409 // write forces for each immersed body
410 for (int i = 0; i < bodies->nBodies; ++i)
411 {
412 for (int d = 0; d < mesh->dim; ++d)
413 {
414 ierr = PetscViewerASCIIPrintf(
415 forcesViewer, "%10.8e\t", fAvg[i][d]); CHKERRQ(ierr);
416 }
417 }
418 ierr = PetscViewerASCIIPrintf(forcesViewer, "\n"); CHKERRQ(ierr);
419
420 ierr = PetscLogStagePop(); CHKERRQ(ierr);
421
422 PetscFunctionReturn(0);
423} // writeForcesASCII
virtual PetscErrorCode writeRestartDataHDF5(const std::string &filePath)
Write data required to restart a simulation into a HDF5 file.
Definition: ibpm.cpp:338
virtual PetscErrorCode createOperators()
Create operators.
Definition: ibpm.cpp:100
PetscErrorCode init(const MPI_Comm &world, const YAML::Node &node)
Initialize the IBPM solver.
Definition: ibpm.cpp:54
~IBPMSolver()
Default destructor.
Definition: ibpm.cpp:23
virtual PetscErrorCode writeForcesASCII()
Write the forces acting on the bodies into an ASCII file.
Definition: ibpm.cpp:387
PetscLogStage stageIntegrateForces
Log stage for integrating the Lagrangian forces.
Definition: ibpm.h:70
virtual PetscErrorCode createVectors()
Create vectors.
Definition: ibpm.cpp:206
virtual PetscErrorCode readRestartDataHDF5(const std::string &filePath)
Read data required to restart a simulation from a HDF5 file.
Definition: ibpm.cpp:357
PetscErrorCode write()
Write solution, forces, and solvers info to files.
Definition: ibpm.cpp:85
PetscErrorCode destroy()
Manually destroy data.
Definition: ibpm.cpp:37
IBPMSolver()=default
Default constructor.
virtual PetscErrorCode assembleRHSPoisson()
Assemble the RHS vector of the Poisson system.
Definition: ibpm.cpp:286
virtual PetscErrorCode writeSolutionHDF5(const std::string &filePath)
Write the solution fields into a HDF5 file.
Definition: ibpm.cpp:316
virtual PetscErrorCode setNullSpace()
Set Poisson nullspace or pin pressure at a reference point.
Definition: ibpm.cpp:242
IS isDE[2]
Global index sets for pressure field and Lagrangian forces.
Definition: ibpm.h:67
petibm::type::BodyPack bodies
Pack of immersed bodies.
Definition: ibpm.h:61
Vec P
PETSc Vec object with pressure field and Lagrangian forces.
Definition: ibpm.h:64
PetscViewer forcesViewer
ASCII PetscViewer object to output the forces.
Definition: ibpm.h:73
Vec rhs2
Right-hand side vector of the Poisson system.
Definition: navierstokes.h:173
petibm::type::Solution solution
Data object holding the velocity and pressure fields.
Definition: navierstokes.h:95
petibm::type::LinSolver pSolver
Poisson linear solver.
Definition: navierstokes.h:107
PetscReal nu
Viscous diffusion coefficient.
Definition: navierstokes.h:134
Mat L
Laplacian operator.
Definition: navierstokes.h:137
PetscReal t
Time value.
Definition: navierstokes.h:119
YAML::Node config
YAML configuration settings.
Definition: navierstokes.h:86
petibm::type::Boundary bc
Information about the domain boundaries.
Definition: navierstokes.h:92
virtual PetscErrorCode readRestartDataHDF5(const std::string &filePath)
Read data required to restart a simulation from a HDF5 file.
PetscLogStage stageInitialize
Log stage for the initialization phase.
Definition: navierstokes.h:185
virtual PetscErrorCode writeSolutionHDF5(const std::string &filePath)
Write the solution fields into a HDF5 file.
Mat A
Implicit operator for the velocity solver.
Definition: navierstokes.h:155
Mat G
Gradient operator.
Definition: navierstokes.h:143
PetscReal dt
Time-step size.
Definition: navierstokes.h:113
Mat N
Convective operator (matrix-free).
Definition: navierstokes.h:152
Mat LCorrection
Laplacian correction operator for boundary conditions.
Definition: navierstokes.h:140
MPI_Comm comm
MPI communicator.
Definition: navierstokes.h:77
virtual PetscErrorCode writeRestartDataHDF5(const std::string &filePath)
Write data required to restart a simulation into a HDF5 file.
PetscBool isRefP
True if we pin the pressure at a reference point.
Definition: navierstokes.h:182
petibm::type::TimeIntegration diffCoeffs
Time scheme for the diffusion terms.
Definition: navierstokes.h:101
Mat DCorrection
Divergence correction for boundary conditions.
Definition: navierstokes.h:149
PetscErrorCode write()
Write solution and solver info to files.
PetscErrorCode init(const MPI_Comm &world, const YAML::Node &node)
Initialize the Navier-Stokes solver.
PetscLogStage stageWrite
Log stage when write the solution fields.
Definition: navierstokes.h:203
PetscInt ite
Time-step index.
Definition: navierstokes.h:116
petibm::type::Mesh mesh
Structured Cartesian mesh object.
Definition: navierstokes.h:89
PetscLogStage stageRHSPoisson
Log stage for assembling the RHS of the Poisson system.
Definition: navierstokes.h:194
Mat BNG
Projection operator.
Definition: navierstokes.h:158
virtual PetscErrorCode createVectors()
Create vectors.
PetscErrorCode destroy()
Manually destroy data.
Mat D
Divergence operator.
Definition: navierstokes.h:146
virtual PetscErrorCode createPetscViewerASCII(const std::string &filePath, const PetscFileMode &mode, PetscViewer &viewer)
Create an ASCII PetscViewer.
Mat DBNG
Poisson operator.
Definition: navierstokes.h:161
Prototype of Delta functions.
PetscErrorCode createBodyPack(const MPI_Comm &comm, const PetscInt &dim, const YAML::Node &node, type::BodyPack &bodies)
Factory function to create a pack of bodies.
Definition: bodypack.cpp:326
PetscErrorCode writeHDF5Vecs(const MPI_Comm comm, const std::string &filePath, const std::string &loc, const std::vector< std::string > &names, const std::vector< Vec > &vecs, const PetscFileMode mode=FILE_MODE_WRITE)
Write a vector of Vec objects to a HDF5 file.
Definition: io.cpp:137
PetscErrorCode readHDF5Vecs(const MPI_Comm comm, const std::string &filePath, const std::string &loc, const std::vector< std::string > &names, std::vector< Vec > &vecs)
Read a vector of Vec objects from a HDF5 file.
Definition: io.cpp:243
PetscErrorCode createMHead(const type::Mesh &mesh, Mat &MHead)
Create a matrix of cell widths of velocity points, .
PetscErrorCode createDivergence(const type::Mesh &mesh, const type::Boundary &bc, Mat &D, Mat &DCorrection, const PetscBool &normalize=PETSC_TRUE)
Create a divergence operator, , and corresponding boundary correction, , for velocity fields.
PetscErrorCode createGradient(const type::Mesh &mesh, Mat &G, const PetscBool &normalize=PETSC_TRUE)
Create a gradient operator, , for pressure field.
PetscErrorCode createLaplacian(const type::Mesh &mesh, const type::Boundary &bc, Mat &L, Mat &LCorrection)
Create a Laplacian operator, , and boundary correction, for velocity fields.
PetscErrorCode createBnHead(const Mat &Op, const PetscReal &dt, const PetscReal &coeff, const PetscInt &n, Mat &BnHead)
Create non-normalized matrix of approximated , .
Definition: createbn.cpp:19
PetscErrorCode createConvection(const type::Mesh &mesh, const type::Boundary &bc, Mat &H)
Create a matrix-free Mat for convection operator, .
PetscErrorCode createDelta(const type::Mesh &mesh, const type::Boundary &bc, const type::BodyPack &bodies, const delta::DeltaKernel &kernel, const PetscInt &kernelSize, Mat &Op)
Create a Delta operator, .
Definition: createdelta.cpp:34
PetscErrorCode createR(const type::Mesh &mesh, Mat &R)
Create a matrix of flux areas, .
std::vector< RealVec1D > RealVec2D
2D std::vector holding PetscReal.
Definition: type.h:142
Definition of the class IBPMSolver.
Prototypes of I/O functions.
PetscErrorCode getKernel(const std::string &name, DeltaKernel &kernel, PetscInt &size)
Get the delta kernel and size providing the name.
Definition: delta.cpp:42
std::function< PetscReal(const PetscReal &r, const PetscReal &dr)> DeltaKernel
Typedef to choose the regularized delta kernel to use.
Definition: delta.h:47