PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
 
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
test_support.h File Reference

Shared declarations for the PICurv C test fixture and assertion layer. More...

#include <stddef.h>
#include "variables.h"
Include dependency graph for test_support.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PicurvTestCase
 Named test case descriptor consumed by PicurvRunTests. More...
 

Typedefs

typedef PetscErrorCode(* PicurvTestFn) (void)
 Signature for a single C unit-test entry point.
 
typedef struct PicurvTestCase PicurvTestCase
 Named test case descriptor consumed by PicurvRunTests.
 

Functions

PetscErrorCode PicurvRunTests (const char *suite_name, const PicurvTestCase *cases, size_t case_count)
 Executes a table of unit tests and reports aggregated pass/fail status.
 
PetscErrorCode PicurvCreateMinimalContexts (SimCtx **simCtx_out, UserCtx **user_out, PetscInt mx, PetscInt my, PetscInt mz)
 Creates minimal PETSc/solver contexts used by isolated kernel tests.
 
PetscErrorCode PicurvCreateMinimalContextsWithPeriodicity (SimCtx **simCtx_out, UserCtx **user_out, PetscInt mx, PetscInt my, PetscInt mz, PetscBool x_periodic, PetscBool y_periodic, PetscBool z_periodic)
 Creates minimal PETSc/solver contexts with optional periodic DM boundaries.
 
PetscErrorCode PicurvDestroyMinimalContexts (SimCtx **simCtx, UserCtx **user)
 Destroys contexts previously created by PicurvCreateMinimalContexts.
 
PetscErrorCode PicurvBuildTinyRuntimeContext (const char *bcs_contents, PetscBool enable_particles, SimCtx **simCtx_out, UserCtx **user_out, char *tmpdir, size_t tmpdir_len)
 Builds a tiny runtime context through the real setup path for behavior-level tests.
 
PetscErrorCode PicurvBuildTinyRuntimeContextWithOptions (const char *bcs_contents, PetscBool enable_particles, const char *extra_options, SimCtx **simCtx_out, UserCtx **user_out, char *tmpdir, size_t tmpdir_len)
 Builds the tiny runtime context with extra control-file options that override its defaults.
 
PetscErrorCode PicurvBuildMomentumPurityRuntimeContext (const char *bcs_contents, SimCtx **simCtx_out, UserCtx **user_out, char *tmpdir, size_t tmpdir_len)
 Builds the production-sized straight-duct fixture used by the opt-in residual-purity diagnostic.
 
PetscErrorCode PicurvDestroyRuntimeContext (SimCtx **simCtx_ptr)
 Finalizes and frees a runtime context built by PicurvBuildTinyRuntimeContext.
 
PetscErrorCode PicurvPopulateUniformCellCenters (UserCtx *user)
 Populates cell center coordinates for a uniform grid on [0,1]^3.
 
PetscErrorCode PicurvPopulateIdentityMetrics (UserCtx *user)
 Fills metric vectors with identity metrics for Cartesian-reference tests.
 
PetscErrorCode PicurvCreateSwarmPair (UserCtx *user, PetscInt nlocal, const char *post_field_name)
 Creates paired runtime/post swarms with optional extra post-processing field registration.
 
PetscErrorCode PicurvMakeTempDir (char *path, size_t path_len)
 Creates a unique temporary directory path and materializes the directory.
 
PetscErrorCode PicurvRemoveTempDir (const char *path)
 Recursively removes a temporary directory created by PicurvMakeTempDir.
 
PetscErrorCode PicurvEnsureDir (const char *path)
 Ensures a directory exists, creating it if required.
 
PetscErrorCode PicurvAssertRealNear (PetscReal expected, PetscReal actual, PetscReal tol, const char *context)
 Asserts two real values are within tolerance for test validation.
 
PetscErrorCode PicurvAssertIntEqual (PetscInt expected, PetscInt actual, const char *context)
 Asserts two integer values are exactly equal for test validation.
 
PetscErrorCode PicurvAssertBool (PetscBool value, const char *context)
 Asserts a boolean condition is true for test validation.
 
PetscErrorCode PicurvAssertFileExists (const char *path, const char *context)
 Asserts a filesystem path exists.
 
PetscErrorCode PicurvAssertVecConstant (Vec vec, PetscScalar expected, PetscReal tol, const char *context)
 Asserts every entry of a vector equals a constant within tolerance.
 

Detailed Description

Shared declarations for the PICurv C test fixture and assertion layer.

Definition in file test_support.h.


Data Structure Documentation

◆ PicurvTestCase

struct PicurvTestCase

Named test case descriptor consumed by PicurvRunTests.

Definition at line 17 of file test_support.h.

Data Fields
const char * name
PicurvTestFn fn

Typedef Documentation

◆ PicurvTestFn

typedef PetscErrorCode(* PicurvTestFn) (void)

Signature for a single C unit-test entry point.

Definition at line 14 of file test_support.h.

◆ PicurvTestCase

Named test case descriptor consumed by PicurvRunTests.

Function Documentation

◆ PicurvRunTests()

PetscErrorCode PicurvRunTests ( const char *  suite_name,
const PicurvTestCase *  cases,
size_t  case_count 
)

Executes a table of unit tests and reports aggregated pass/fail status.

Executes a table of unit tests and reports aggregated pass/fail status.

Definition at line 128 of file test_support.c.

129{
130 PetscFunctionBeginUser;
131
132 PetscCall(PetscPrintf(PETSC_COMM_WORLD, "==> Running %s (%zu tests)\n", suite_name, case_count));
133 for (size_t i = 0; i < case_count; ++i) {
134 PetscCall(PetscPrintf(PETSC_COMM_WORLD, " -> %s\n", cases[i].name));
135 /* Abort: a failure on some ranks would otherwise leave the others waiting in a collective. */
136 PetscCallAbort(PETSC_COMM_WORLD, cases[i].fn());
137 PetscCall(PetscPrintf(PETSC_COMM_WORLD, " [PASS] %s\n", cases[i].name));
138 }
139
140 PetscCall(PetscPrintf(PETSC_COMM_WORLD, "==> %s complete\n", suite_name));
141 PetscFunctionReturn(0);
142}
Here is the caller graph for this function:

◆ PicurvCreateMinimalContexts()

PetscErrorCode PicurvCreateMinimalContexts ( SimCtx **  simCtx_out,
UserCtx **  user_out,
PetscInt  mx,
PetscInt  my,
PetscInt  mz 
)

Creates minimal PETSc/solver contexts used by isolated kernel tests.

Creates minimal PETSc/solver contexts used by isolated kernel tests.

Definition at line 570 of file test_support.c.

571{
572 PetscFunctionBeginUser;
573 PetscCall(PicurvCreateMinimalContextsWithPeriodicity(simCtx_out, user_out, mx, my, mz, PETSC_FALSE, PETSC_FALSE, PETSC_FALSE));
574 PetscFunctionReturn(0);
575}
PetscErrorCode PicurvCreateMinimalContextsWithPeriodicity(SimCtx **simCtx_out, UserCtx **user_out, PetscInt mx, PetscInt my, PetscInt mz, PetscBool x_periodic, PetscBool y_periodic, PetscBool z_periodic)
Builds minimal SimCtx and UserCtx fixtures for C unit tests with configurable periodicity.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PicurvCreateMinimalContextsWithPeriodicity()

PetscErrorCode PicurvCreateMinimalContextsWithPeriodicity ( SimCtx **  simCtx_out,
UserCtx **  user_out,
PetscInt  mx,
PetscInt  my,
PetscInt  mz,
PetscBool  x_periodic,
PetscBool  y_periodic,
PetscBool  z_periodic 
)

Creates minimal PETSc/solver contexts with optional periodic DM boundaries.

Creates minimal PETSc/solver contexts with optional periodic DM boundaries.

Definition at line 330 of file test_support.c.

338{
339 SimCtx *simCtx = NULL;
340 UserCtx *user = NULL;
341 BoundingBox *boxes = NULL;
342 PetscInt da_mx = mx + 1;
343 PetscInt da_my = my + 1;
344 PetscInt da_mz = mz + 1;
345 DMBoundaryType x_boundary = x_periodic ? DM_BOUNDARY_PERIODIC : DM_BOUNDARY_NONE;
346 DMBoundaryType y_boundary = y_periodic ? DM_BOUNDARY_PERIODIC : DM_BOUNDARY_NONE;
347 DMBoundaryType z_boundary = z_periodic ? DM_BOUNDARY_PERIODIC : DM_BOUNDARY_NONE;
348 PetscInt stencil_width = (x_periodic || y_periodic || z_periodic) ? 3 : 1;
349
350 PetscFunctionBeginUser;
351 if (!simCtx_out || !user_out) {
352 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_NULL, "Output pointers cannot be NULL.");
353 }
354
355 PetscCall(PetscCalloc1(1, &simCtx));
356 PetscCall(PetscCalloc1(1, &user));
357
358 PetscCallMPI(MPI_Comm_rank(PETSC_COMM_WORLD, &simCtx->rank));
359 PetscCallMPI(MPI_Comm_size(PETSC_COMM_WORLD, &simCtx->size));
360 simCtx->block_number = 1;
361 simCtx->dt = 0.1;
362 simCtx->tiout = 2;
363 simCtx->forceScalingFactor = 1.0;
364 simCtx->LoggingFrequency = 1;
365 simCtx->exec_mode = EXEC_MODE_SOLVER;
367 simCtx->solutionConvergenceEnabled = PETSC_TRUE;
368 simCtx->poisson = 0;
369 simCtx->ren = 1.0;
370 PetscCall(LESConfigSetDefaults(&simCtx->les_config));
371 simCtx->schmidt_number = 1.0;
372 simCtx->StartStep = 0;
373 simCtx->StepsToRun = 1;
374 simCtx->step = 1;
375 simCtx->np = 0;
376 simCtx->i_periodic = x_periodic ? 1 : 0;
377 simCtx->j_periodic = y_periodic ? 1 : 0;
378 simCtx->k_periodic = z_periodic ? 1 : 0;
379 simCtx->initialConditionStaged = PETSC_FALSE;
381 PetscCall(PetscStrncpy(simCtx->initialConditionDirectory, "/tmp", sizeof(simCtx->initialConditionDirectory)));
382 /* Unit scales: the fixture is already non-dimensional, as a run without scaling is. */
383 simCtx->scaling.L_ref = 1.0;
384 simCtx->scaling.U_ref = 1.0;
385 simCtx->scaling.rho_ref = 1.0;
386 simCtx->scaling.P_ref = 1.0;
387 PetscCall(PetscStrncpy(simCtx->output_dir, "/tmp", sizeof(simCtx->output_dir)));
388 PetscCall(PetscStrncpy(simCtx->restart_dir, "/tmp", sizeof(simCtx->restart_dir)));
389 PetscCall(PetscStrncpy(simCtx->log_dir, "/tmp", sizeof(simCtx->log_dir)));
390 simCtx->mglevels = 1;
391 simCtx->usermg.mglevels = 1;
392 PetscCall(PetscCalloc1(1, &simCtx->usermg.mgctx));
393 simCtx->usermg.mgctx[0].thislevel = 0;
394 PetscCall(PetscCalloc1(simCtx->size, &simCtx->bboxlist));
395
396 user->simCtx = simCtx;
397 user->_this = 0;
398 user->thislevel = 0;
399 user->mglevels = 1;
400 user->IM = mx;
401 user->JM = my;
402 user->KM = mz;
403 user->Min_X = 0.0;
404 user->Min_Y = 0.0;
405 user->Min_Z = 0.0;
406 user->Max_X = 1.0;
407 user->Max_Y = 1.0;
408 user->Max_Z = 1.0;
409 user->rx = 1.0;
410 user->ry = 1.0;
411 user->rz = 1.0;
412 user->bbox.min_coords.x = 0.0;
413 user->bbox.min_coords.y = 0.0;
414 user->bbox.min_coords.z = 0.0;
415 user->bbox.max_coords.x = 1.0;
416 user->bbox.max_coords.y = 1.0;
417 user->bbox.max_coords.z = 1.0;
418 simCtx->usermg.mgctx[0].user = user;
419 for (PetscMPIInt rank_idx = 0; rank_idx < simCtx->size; ++rank_idx) {
420 simCtx->bboxlist[rank_idx].min_coords.x = 0.0;
421 simCtx->bboxlist[rank_idx].min_coords.y = 0.0;
422 simCtx->bboxlist[rank_idx].min_coords.z = 0.0;
423 simCtx->bboxlist[rank_idx].max_coords.x = 1.0;
424 simCtx->bboxlist[rank_idx].max_coords.y = 1.0;
425 simCtx->bboxlist[rank_idx].max_coords.z = 1.0;
426 }
427
428 PetscCall(DMDACreate3d(PETSC_COMM_WORLD,
429 x_boundary, y_boundary, z_boundary,
430 DMDA_STENCIL_BOX,
431 da_mx, da_my, da_mz,
432 PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE,
433 1, stencil_width,
434 NULL, NULL, NULL,
435 &user->da));
436 PetscCall(DMSetUp(user->da));
437 PetscCall(DMGetCoordinateDM(user->da, &user->fda));
438 /* The fixture builds the same DM set the real factory does, through the same
439 * helper, so a test cannot pass against a decomposition production never uses. */
440 PetscCall(CreateCompatibleBlockDM(user->da, 6, &user->fda6));
441
442 /* Post-processing staging pair, matching the factory's Group N. Production gates
443 * these on statistics being active; the fixture builds them unconditionally so a
444 * test can exercise the derived-output path without a resolved window list. */
445 PetscCall(DMCreateGlobalVector(user->da, &user->PostScalar));
446 PetscCall(VecSet(user->PostScalar, 0.0));
447 PetscCall(DMCreateLocalVector(user->da, &user->lPostScalar));
448 PetscCall(VecSet(user->lPostScalar, 0.0));
449 PetscCall(DMCreateGlobalVector(user->da, &user->PostScalarNodal));
450 PetscCall(VecSet(user->PostScalarNodal, 0.0));
451 PetscCall(DMCreateGlobalVector(user->fda, &user->PostVector));
452 PetscCall(VecSet(user->PostVector, 0.0));
453 PetscCall(DMCreateLocalVector(user->fda, &user->lPostVector));
454 PetscCall(VecSet(user->lPostVector, 0.0));
455 PetscCall(DMCreateGlobalVector(user->fda, &user->PostVectorNodal));
456 PetscCall(VecSet(user->PostVectorNodal, 0.0));
457 PetscCall(PetscObjectReference((PetscObject)user->fda));
458 PetscCall(DMDASetUniformCoordinates(user->da, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0));
459 PetscCall(DMGetCoordinates(user->da, &user->Coor));
460 PetscCall(DMGetCoordinatesLocal(user->da, &user->lCoor));
461 PetscCall(DMDAGetLocalInfo(user->da, &user->info));
462 PetscCall(ComputeLocalBoundingBox(user, &user->bbox));
463 PetscCall(GatherAllBoundingBoxes(user, &boxes));
464 PetscCall(BroadcastAllBoundingBoxes(user, &boxes));
465 for (PetscMPIInt rank_idx = 0; rank_idx < simCtx->size; ++rank_idx) {
466 simCtx->bboxlist[rank_idx] = boxes[rank_idx];
467 }
468 free(boxes);
469
470 PetscCall(CreateZeroedGlobalVector(user->da, &user->P));
471 PetscCall(CreateZeroedLocalVector(user->da, &user->lP));
472 PetscCall(CreateZeroedGlobalVector(user->da, &user->Phi));
473 PetscCall(CreateZeroedLocalVector(user->da, &user->lPhi));
474 PetscCall(CreateZeroedGlobalVector(user->da, &user->Nvert));
475 PetscCall(CreateZeroedLocalVector(user->da, &user->lNvert));
476 PetscCall(CreateZeroedGlobalVector(user->da, &user->ParticleCount));
477 PetscCall(CreateZeroedLocalVector(user->da, &user->lParticleCount));
478 PetscCall(CreateZeroedGlobalVector(user->da, &user->Psi));
479 PetscCall(CreateZeroedLocalVector(user->da, &user->lPsi));
480 PetscCall(CreateZeroedGlobalVector(user->da, &user->Qcrit));
481 PetscCall(CreateZeroedLocalVector(user->da, &user->lQcrit));
482 PetscCall(CreateZeroedGlobalVector(user->da, &user->Qcrit_nodal));
483 PetscCall(CreateZeroedGlobalVector(user->da, &user->P_nodal));
484 PetscCall(CreateZeroedGlobalVector(user->da, &user->Psi_nodal));
485 PetscCall(CreateZeroedGlobalVector(user->da, &user->Aj));
486 PetscCall(CreateZeroedLocalVector(user->da, &user->lAj));
487 PetscCall(CreateZeroedGlobalVector(user->da, &user->Diffusivity));
488 PetscCall(CreateZeroedLocalVector(user->da, &user->lDiffusivity));
489 PetscCall(CreateZeroedGlobalVector(user->da, &user->B));
490 PetscCall(CreateZeroedGlobalVector(user->da, &user->R));
491
492 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Ucat));
493 PetscCall(CreateZeroedLocalVector(user->fda, &user->lUcat));
494 /* Corner-staging workspace, mirroring the finest-level group the real
495 * vector factory creates, so catalog lookups resolve in fixtures too. */
496 PetscCall(CreateZeroedGlobalVector(user->da, &user->CellScalarAtCorner));
497 PetscCall(CreateZeroedLocalVector(user->da, &user->lCellScalarAtCorner));
498 PetscCall(CreateZeroedGlobalVector(user->fda, &user->CellVectorAtCorner));
499 PetscCall(CreateZeroedLocalVector(user->fda, &user->lCellVectorAtCorner));
500 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Ucont));
501 PetscCall(CreateZeroedLocalVector(user->fda, &user->lUcont));
502 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Csi));
503 PetscCall(CreateZeroedLocalVector(user->fda, &user->lCsi));
504 PetscCall(CreateZeroedDuplicate(user->Csi, &user->Eta));
505 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lEta));
506 PetscCall(CreateZeroedDuplicate(user->Csi, &user->Zet));
507 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lZet));
508 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Cent));
509 PetscCall(CreateZeroedLocalVector(user->fda, &user->lCent));
510 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Centx));
511 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Centy));
512 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Centz));
513 PetscCall(CreateZeroedLocalVector(user->fda, &user->lCentx));
514 PetscCall(CreateZeroedLocalVector(user->fda, &user->lCenty));
515 PetscCall(CreateZeroedLocalVector(user->fda, &user->lCentz));
516 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Ucat_nodal));
517 PetscCall(CreateZeroedGlobalVector(user->fda, &user->DiffusivityGradient));
518 PetscCall(CreateZeroedLocalVector(user->fda, &user->lDiffusivityGradient));
519 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Rhs));
520 PetscCall(CreateZeroedGlobalVector(user->fda, &user->dUcont));
521 PetscCall(CreateZeroedGlobalVector(user->fda, &user->pUcont));
522 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Bcs.Ubcs));
523 PetscCall(CreateZeroedGlobalVector(user->fda, &user->Bcs.Uch));
524
525 PetscCall(CreateZeroedDuplicate(user->Ucont, &user->Ucont_o));
526 PetscCall(CreateZeroedDuplicate(user->lUcont, &user->lUcont_o));
527 PetscCall(CreateZeroedDuplicate(user->Ucont, &user->Ucont_rm1));
528 PetscCall(CreateZeroedDuplicate(user->lUcont, &user->lUcont_rm1));
529 PetscCall(CreateZeroedDuplicate(user->Ucat, &user->Ucat_o));
530 PetscCall(CreateZeroedDuplicate(user->P, &user->P_o));
531 PetscCall(CreateZeroedDuplicate(user->Nvert, &user->Nvert_o));
532 PetscCall(CreateZeroedLocalVector(user->da, &user->lNvert_o));
533 PetscCall(CreateZeroedDuplicate(user->Csi, &user->ICsi));
534 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lICsi));
535 PetscCall(CreateZeroedDuplicate(user->Csi, &user->IEta));
536 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lIEta));
537 PetscCall(CreateZeroedDuplicate(user->Csi, &user->IZet));
538 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lIZet));
539 PetscCall(CreateZeroedDuplicate(user->Csi, &user->JCsi));
540 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lJCsi));
541 PetscCall(CreateZeroedDuplicate(user->Csi, &user->JEta));
542 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lJEta));
543 PetscCall(CreateZeroedDuplicate(user->Csi, &user->JZet));
544 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lJZet));
545 PetscCall(CreateZeroedDuplicate(user->Csi, &user->KCsi));
546 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lKCsi));
547 PetscCall(CreateZeroedDuplicate(user->Csi, &user->KEta));
548 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lKEta));
549 PetscCall(CreateZeroedDuplicate(user->Csi, &user->KZet));
550 PetscCall(CreateZeroedDuplicate(user->lCsi, &user->lKZet));
551 PetscCall(CreateZeroedDuplicate(user->Aj, &user->IAj));
552 PetscCall(CreateZeroedDuplicate(user->lAj, &user->lIAj));
553 PetscCall(CreateZeroedDuplicate(user->Aj, &user->JAj));
554 PetscCall(CreateZeroedDuplicate(user->lAj, &user->lJAj));
555 PetscCall(CreateZeroedDuplicate(user->Aj, &user->KAj));
556 PetscCall(CreateZeroedDuplicate(user->lAj, &user->lKAj));
557
558 PetscCall(PicurvPopulateUniformCellCenters(user));
559 PetscCall(PicurvPopulateIdentityMetrics(user));
560 PetscCall(MetricComputeFacePlanes(user)); // Tests that change the grid rebuild them
561
562 *simCtx_out = simCtx;
563 *user_out = user;
564 PetscFunctionReturn(0);
565}
PetscErrorCode MetricComputeFacePlanes(UserCtx *user)
Builds the block's particle face planes once, as catalogued per-face fields.
Definition Metric.c:208
PetscErrorCode BroadcastAllBoundingBoxes(UserCtx *user, BoundingBox **bboxlist)
Broadcasts the bounding box information collected on rank 0 to all other ranks.
Definition grid.c:1071
PetscErrorCode CreateCompatibleBlockDM(DM source, PetscInt dof, DM *result)
Creates a DMDA sharing a block's decomposition at a different degree of freedom.
Definition grid.c:81
PetscErrorCode ComputeLocalBoundingBox(UserCtx *user, BoundingBox *localBBox)
Computes the local bounding box of the grid on the current process.
Definition grid.c:869
PetscErrorCode GatherAllBoundingBoxes(UserCtx *user, BoundingBox **allBBoxes)
Gathers local bounding boxes from all MPI processes to rank 0.
Definition grid.c:1011
PetscErrorCode LESConfigSetDefaults(LESConfig *config)
Installs the shipped defaults for every LES closure parameter.
Definition setup.c:288
static PetscErrorCode CreateZeroedLocalVector(DM dm, Vec *vec)
Allocates and zeroes a local vector from the provided DM.
static PetscErrorCode CreateZeroedDuplicate(Vec src, Vec *vec)
Duplicates and zeroes a vector.
PetscErrorCode PicurvPopulateUniformCellCenters(UserCtx *user)
Populates cell center coordinates for a uniform grid on [0,1]^3.
static PetscErrorCode CreateZeroedGlobalVector(DM dm, Vec *vec)
Allocates and zeroes a global vector from the provided DM.
PetscErrorCode PicurvPopulateIdentityMetrics(UserCtx *user)
Populates identity metric vectors on the minimal grid fixture.
Vec lDiffusivityGradient
Definition variables.h:1201
Vec Qcrit_nodal
Q-criterion averaged to grid nodes; the field a .vts can place correctly.
Definition variables.h:1284
Vec lPostScalar
Definition variables.h:1219
Vec lCent
Definition variables.h:1244
Vec P_nodal
Definition variables.h:1281
UserCtx * user
Definition variables.h:768
PetscReal schmidt_number
Definition variables.h:1005
PetscMPIInt rank
Definition variables.h:919
PetscInt mglevels
Definition variables.h:1269
PetscInt block_number
Definition variables.h:1009
Vec lIEta
Definition variables.h:1254
Vec lIZet
Definition variables.h:1254
Vec lNvert
Definition variables.h:1197
LESConfig les_config
Parameters of the LES closure selected by les.
Definition variables.h:1046
PetscReal forceScalingFactor
Definition variables.h:1018
SimCtx * simCtx
Back-pointer to the master simulation context.
Definition variables.h:1160
Vec Centz
Definition variables.h:1252
PetscReal Min_X
Definition variables.h:1172
PetscInt KM
Definition variables.h:1171
PetscInt tiout
Definition variables.h:928
UserMG usermg
Definition variables.h:1082
PetscReal L_ref
Definition variables.h:898
PetscReal ren
Definition variables.h:965
Vec lUcont_rm1
Definition variables.h:1207
Cmpnts max_coords
Maximum x, y, z coordinates of the bounding box.
Definition variables.h:214
PetscInt _this
Definition variables.h:1175
Vec lKEta
Definition variables.h:1256
char output_dir[PETSC_MAX_PATH_LEN]
Definition variables.h:940
PetscBool solutionConvergenceEnabled
Definition variables.h:980
PetscReal dt
Definition variables.h:933
PetscReal ry
Definition variables.h:1176
PetscInt StepsToRun
Definition variables.h:927
PetscInt k_periodic
Definition variables.h:1010
Vec Ucat_nodal
Definition variables.h:1282
PetscInt np
Definition variables.h:1049
Vec PostScalarNodal
Definition variables.h:1219
PetscReal Max_Y
Definition variables.h:1172
PetscInt thislevel
Definition variables.h:769
Vec DiffusivityGradient
Definition variables.h:1201
Vec lJCsi
Definition variables.h:1255
Vec Ucont
Definition variables.h:1197
PetscInt StartStep
Definition variables.h:926
Cmpnts min_coords
Minimum x, y, z coordinates of the bounding box.
Definition variables.h:213
Vec PostScalar
Definition variables.h:1219
Vec Ubcs
Physical Cartesian velocity at boundary faces. Full 3D array but only boundary-face entries are meani...
Definition variables.h:172
@ MOMENTUM_SOLVER_EXPLICIT_RK
Definition variables.h:730
Vec Qcrit
Definition variables.h:1283
PetscScalar x
Definition variables.h:145
Vec CellScalarAtCorner
Definition variables.h:1212
Vec Centx
Definition variables.h:1252
Vec lParticleCount
Definition variables.h:1276
Vec lUcont_o
Definition variables.h:1204
Vec CellVectorAtCorner
Definition variables.h:1213
Vec Ucat_o
Definition variables.h:1204
PetscInt poisson
Definition variables.h:962
BoundingBox * bboxlist
Definition variables.h:1053
Vec lKZet
Definition variables.h:1256
char log_dir[PETSC_MAX_PATH_LEN]
Definition variables.h:941
PetscReal rz
Definition variables.h:1176
Vec lCellScalarAtCorner
Definition variables.h:1212
Vec lJEta
Definition variables.h:1255
PetscInt thislevel
Definition variables.h:1269
PetscScalar z
Definition variables.h:145
Vec pUcont
Definition variables.h:1207
Vec lKCsi
Definition variables.h:1256
Vec ParticleCount
Definition variables.h:1276
ScalingCtx scaling
Definition variables.h:1003
Vec Ucont_o
Definition variables.h:1204
PetscInt JM
Definition variables.h:1171
Vec lCenty
Definition variables.h:1253
Vec PostVectorNodal
Definition variables.h:1220
PetscInt mglevels
Definition variables.h:775
PetscReal Min_Z
Definition variables.h:1172
PetscInt mglevels
Definition variables.h:961
Vec lJZet
Definition variables.h:1255
Vec Nvert_o
Definition variables.h:1204
Vec lCoor
Definition variables.h:1243
Vec lCellVectorAtCorner
Definition variables.h:1213
char initialConditionDirectory[PETSC_MAX_PATH_LEN]
Definition variables.h:979
Vec Psi_nodal
Definition variables.h:1285
Vec lPostVector
Definition variables.h:1220
PetscReal Max_X
Definition variables.h:1172
Vec lCentx
Definition variables.h:1253
PetscBool initialConditionStaged
Definition variables.h:977
Vec Ucont_rm1
Definition variables.h:1207
PetscReal Min_Y
Definition variables.h:1172
PetscInt i_periodic
Definition variables.h:1010
Vec lUcont
Definition variables.h:1197
PetscInt step
Definition variables.h:924
Vec Diffusivity
Definition variables.h:1200
Vec lICsi
Definition variables.h:1254
DMDALocalInfo info
Definition variables.h:1169
Vec dUcont
Definition variables.h:1207
Vec lUcat
Definition variables.h:1197
PetscScalar y
Definition variables.h:145
@ IC_FIELD_UCAT
Definition variables.h:202
PetscMPIInt size
Definition variables.h:920
@ EXEC_MODE_SOLVER
Definition variables.h:888
PetscInt IM
Definition variables.h:1171
Vec PostVector
Definition variables.h:1220
Vec lQcrit
Cell-centred Q-criterion and its ghosted copy for nodal averaging.
Definition variables.h:1283
Vec Nvert
Definition variables.h:1197
MGCtx * mgctx
Definition variables.h:778
Vec lDiffusivity
Definition variables.h:1200
Vec lNvert_o
Definition variables.h:1204
Vec Centy
Definition variables.h:1252
PetscReal P_ref
Definition variables.h:901
PetscReal rx
Definition variables.h:1176
Vec lCentz
Definition variables.h:1253
InitialConditionField initialConditionField
Definition variables.h:978
ExecutionMode exec_mode
Definition variables.h:937
PetscReal rho_ref
Definition variables.h:900
BoundingBox bbox
Definition variables.h:1173
PetscReal Max_Z
Definition variables.h:1172
PetscReal U_ref
Definition variables.h:899
MomentumSolverType mom_solver_type
Definition variables.h:958
char restart_dir[PETSC_MAX_PATH_LEN]
Definition variables.h:939
PetscInt LoggingFrequency
Definition variables.h:1087
Vec Uch
Characteristic velocity for boundary conditions.
Definition variables.h:173
PetscInt j_periodic
Definition variables.h:1010
Defines a 3D axis-aligned bounding box.
Definition variables.h:212
The master context for the entire simulation.
Definition variables.h:916
User-defined context containing data specific to a single computational grid level.
Definition variables.h:1157
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PicurvDestroyMinimalContexts()

PetscErrorCode PicurvDestroyMinimalContexts ( SimCtx **  simCtx_ptr,
UserCtx **  user_ptr 
)

Destroys contexts previously created by PicurvCreateMinimalContexts.

Destroys contexts previously created by PicurvCreateMinimalContexts.

Definition at line 918 of file test_support.c.

919{
920 UserCtx *user = NULL;
921 SimCtx *simCtx = NULL;
922
923 PetscFunctionBeginUser;
924 if (user_ptr) {
925 user = *user_ptr;
926 }
927 if (simCtx_ptr) {
928 simCtx = *simCtx_ptr;
929 }
930
931 if (simCtx) {
932 PetscCall(DestroySolutionConvergenceState(simCtx));
933 }
934
935 if (user) {
936 PetscCall(DestroyDMIfSet(&user->swarm));
937 PetscCall(DestroyDMIfSet(&user->post_swarm));
938
939 PetscCall(DestroyVecIfSet(&user->P));
940 PetscCall(DestroyVecIfSet(&user->lP));
941 PetscCall(DestroyVecIfSet(&user->Phi));
942 PetscCall(DestroyVecIfSet(&user->lPhi));
943 PetscCall(DestroyVecIfSet(&user->Nvert));
944 PetscCall(DestroyVecIfSet(&user->lNvert));
945 PetscCall(DestroyVecIfSet(&user->ParticleCount));
946 PetscCall(DestroyVecIfSet(&user->lParticleCount));
947 PetscCall(DestroyVecIfSet(&user->Psi));
948 PetscCall(DestroyVecIfSet(&user->lPsi));
949 PetscCall(DestroyVecIfSet(&user->Qcrit));
950 PetscCall(DestroyVecIfSet(&user->lQcrit));
951 PetscCall(DestroyVecIfSet(&user->Qcrit_nodal));
952 PetscCall(DestroyVecIfSet(&user->P_nodal));
953 PetscCall(DestroyVecIfSet(&user->Psi_nodal));
954 PetscCall(DestroyVecIfSet(&user->Ucat));
955 PetscCall(DestroyVecIfSet(&user->lUcat));
956 PetscCall(DestroyVecIfSet(&user->Ucont));
957 PetscCall(DestroyVecIfSet(&user->lUcont));
958 PetscCall(DestroyVecIfSet(&user->Csi));
959 PetscCall(DestroyVecIfSet(&user->lCsi));
960 PetscCall(DestroyVecIfSet(&user->Eta));
961 PetscCall(DestroyVecIfSet(&user->lEta));
962 PetscCall(DestroyVecIfSet(&user->Zet));
963 PetscCall(DestroyVecIfSet(&user->lZet));
964 PetscCall(DestroyVecIfSet(&user->Aj));
965 PetscCall(DestroyVecIfSet(&user->lAj));
966 PetscCall(DestroyVecIfSet(&user->IAj));
967 PetscCall(DestroyVecIfSet(&user->lIAj));
968 PetscCall(DestroyVecIfSet(&user->JAj));
969 PetscCall(DestroyVecIfSet(&user->lJAj));
970 PetscCall(DestroyVecIfSet(&user->KAj));
971 PetscCall(DestroyVecIfSet(&user->lKAj));
972 PetscCall(DestroyVecIfSet(&user->Diffusivity));
973 PetscCall(DestroyVecIfSet(&user->lDiffusivity));
974 PetscCall(DestroyVecIfSet(&user->DiffusivityGradient));
975 PetscCall(DestroyVecIfSet(&user->lDiffusivityGradient));
976 PetscCall(DestroyVecIfSet(&user->CS));
977 PetscCall(DestroyVecIfSet(&user->lCs));
978 PetscCall(DestroyVecIfSet(&user->Nu_t));
979 PetscCall(DestroyVecIfSet(&user->lNu_t));
980 PetscCall(DestroyVecIfSet(&user->Ucont_o));
981 PetscCall(DestroyVecIfSet(&user->lUcont_o));
982 PetscCall(DestroyVecIfSet(&user->Ucat_o));
983 PetscCall(DestroyVecIfSet(&user->P_o));
984 PetscCall(DestroyVecIfSet(&user->Nvert_o));
985 PetscCall(DestroyVecIfSet(&user->lNvert_o));
986 PetscCall(DestroyVecIfSet(&user->Ucont_rm1));
987 PetscCall(DestroyVecIfSet(&user->lUcont_rm1));
988 PetscCall(DestroyVecIfSet(&user->Rhs));
989 PetscCall(DestroyVecIfSet(&user->dUcont));
990 PetscCall(DestroyVecIfSet(&user->pUcont));
991 PetscCall(DestroyVecIfSet(&user->pRhs));
992 PetscCall(DestroyVecIfSet(&user->CellScalarAtCorner));
993 PetscCall(DestroyVecIfSet(&user->lCellScalarAtCorner));
994 PetscCall(DestroyVecIfSet(&user->CellVectorAtCorner));
995 PetscCall(DestroyVecIfSet(&user->lCellVectorAtCorner));
996 PetscCall(DestroyVecIfSet(&user->B));
997 PetscCall(DestroyVecIfSet(&user->R));
998 PetscCall(DestroyVecIfSet(&user->Cent));
999 PetscCall(DestroyVecIfSet(&user->lCent));
1000 PetscCall(MetricDestroyFacePlanes(user));
1001 PetscCall(DestroyVecIfSet(&user->Centx));
1002 PetscCall(DestroyVecIfSet(&user->Centy));
1003 PetscCall(DestroyVecIfSet(&user->Centz));
1004 PetscCall(DestroyVecIfSet(&user->lCentx));
1005 PetscCall(DestroyVecIfSet(&user->lCenty));
1006 PetscCall(DestroyVecIfSet(&user->lCentz));
1007 PetscCall(DestroyVecIfSet(&user->Ucat_nodal));
1008 PetscCall(DestroyVecIfSet(&user->Bcs.Ubcs));
1009 PetscCall(DestroyVecIfSet(&user->Bcs.Uch));
1010 PetscCall(MomentumSolver_NewtonKrylov_Destroy(user));
1011 PetscCall(DestroyMatIfSet(&user->A));
1012 PetscCall(DestroyKSPIfSet(&user->ksp));
1013 PetscCall(DestroyNullSpaceIfSet(&user->nullsp));
1014 PetscCall(PetscFree(user->RankCellInfoMap));
1015 user->RankCellInfoMap = NULL;
1016 for (PetscInt face = BC_FACE_NEG_X; face <= BC_FACE_POS_Z; ++face) {
1017 if (user->boundary_faces[face].params) {
1019 user->boundary_faces[face].params = NULL;
1020 }
1021 }
1022
1023 PetscCall(DestroyVecIfSet(&user->PostScalar));
1024 PetscCall(DestroyVecIfSet(&user->lPostScalar));
1025 PetscCall(DestroyVecIfSet(&user->PostScalarNodal));
1026 PetscCall(DestroyVecIfSet(&user->PostVector));
1027 PetscCall(DestroyVecIfSet(&user->lPostVector));
1028 PetscCall(DestroyVecIfSet(&user->PostVectorNodal));
1029 PetscCall(DestroyDMIfSet(&user->fda6));
1030 PetscCall(DestroyDMIfSet(&user->fda));
1031 PetscCall(DestroyDMIfSet(&user->da));
1032 PetscCall(PetscFree(user));
1033 if (user_ptr) {
1034 *user_ptr = NULL;
1035 }
1036 }
1037
1038 if (simCtx) {
1039 PetscCall(PetscFree(simCtx->bboxlist));
1040 PetscCall(PetscFree(simCtx->usermg.mgctx));
1041 PetscCall(PetscFree(simCtx->pps));
1042 PetscCall(PetscFree(simCtx));
1043 if (simCtx_ptr) {
1044 *simCtx_ptr = NULL;
1045 }
1046 }
1047
1048 PetscFunctionReturn(0);
1049}
PetscErrorCode MetricDestroyFacePlanes(UserCtx *user)
Frees the face-plane fields MetricComputeFacePlanes() built, if any.
Definition Metric.c:355
void FreeBC_ParamList(BC_Param *head)
Frees an entire linked list of boundary-condition parameters.
Definition io.c:719
PetscErrorCode DestroySolutionConvergenceState(SimCtx *simCtx)
Frees any runtime storage allocated for solution-convergence logging.
Definition setup.c:230
#define MomentumSolver_NewtonKrylov_Destroy
static PetscErrorCode DestroyKSPIfSet(KSP *ksp)
Destroys a PETSc KSP only when the handle is non-null.
static PetscErrorCode DestroyDMIfSet(DM *dm)
Destroys a PETSc DM only when the handle is non-null.
static PetscErrorCode DestroyNullSpaceIfSet(MatNullSpace *nullsp)
Destroys a PETSc nullspace only when the handle is non-null.
static PetscErrorCode DestroyVecIfSet(Vec *vec)
Destroys a PETSc vector only when the handle is non-null.
static PetscErrorCode DestroyMatIfSet(Mat *mat)
Destroys a PETSc matrix only when the handle is non-null.
BoundaryFaceConfig boundary_faces[6]
Definition variables.h:1182
MatNullSpace nullsp
Definition variables.h:1228
DM post_swarm
Definition variables.h:1280
RankCellInfo * RankCellInfoMap
Definition variables.h:1274
Vec lNu_t
Definition variables.h:1259
BC_Param * params
Definition variables.h:429
PostProcessParams * pps
Definition variables.h:1131
@ BC_FACE_NEG_X
Definition variables.h:309
@ BC_FACE_POS_Z
Definition variables.h:311
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PicurvBuildTinyRuntimeContext()

PetscErrorCode PicurvBuildTinyRuntimeContext ( const char *  bcs_contents,
PetscBool  enable_particles,
SimCtx **  simCtx_out,
UserCtx **  user_out,
char *  tmpdir,
size_t  tmpdir_len 
)

Builds a tiny runtime context through the real setup path for behavior-level tests.

Definition at line 775 of file test_support.c.

781{
782 PetscFunctionBeginUser;
783 PetscCall(PicurvBuildTinyRuntimeContextWithOptions(bcs_contents, enable_particles, NULL,
784 simCtx_out, user_out, tmpdir, tmpdir_len));
785 PetscFunctionReturn(0);
786}
PetscErrorCode PicurvBuildTinyRuntimeContextWithOptions(const char *bcs_contents, PetscBool enable_particles, const char *extra_options, SimCtx **simCtx_out, UserCtx **user_out, char *tmpdir, size_t tmpdir_len)
Builds the tiny runtime context with extra control-file options appended.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PicurvBuildTinyRuntimeContextWithOptions()

PetscErrorCode PicurvBuildTinyRuntimeContextWithOptions ( const char *  bcs_contents,
PetscBool  enable_particles,
const char *  extra_options,
SimCtx **  simCtx_out,
UserCtx **  user_out,
char *  tmpdir,
size_t  tmpdir_len 
)

Builds the tiny runtime context with extra control-file options that override its defaults.

Builds the tiny runtime context with extra control-file options that override its defaults.

Definition at line 791 of file test_support.c.

798{
799 char control_path[PETSC_MAX_PATH_LEN];
800 SimCtx *simCtx = NULL;
801
802 PetscFunctionBeginUser;
803 PetscCheck(simCtx_out != NULL, PETSC_COMM_SELF, PETSC_ERR_ARG_NULL, "SimCtx output cannot be NULL.");
804
805 PetscCall(PetscOptionsClear(NULL));
806 PetscCall(PrepareTinyRuntimeConfig(bcs_contents, enable_particles, extra_options, tmpdir, tmpdir_len,
807 control_path, sizeof(control_path)));
808 PetscCall(PetscOptionsSetValue(NULL, "-control_file", control_path));
809 PetscCall(CreateSimulationContext(0, NULL, &simCtx));
810 simCtx->exec_mode = EXEC_MODE_SOLVER;
811 PetscCall(SetupSimulationEnvironment(simCtx));
812 PetscCall(SetupGridAndSolvers(simCtx));
813 PetscCall(SetupBoundaryConditions(simCtx));
814 PetscCall(SetupDomainRankInfo(simCtx));
815
816 *simCtx_out = simCtx;
817 if (user_out) {
818 *user_out = simCtx->usermg.mgctx[simCtx->usermg.mglevels - 1].user;
819 }
820 PetscFunctionReturn(0);
821}
PetscErrorCode SetupDomainRankInfo(SimCtx *simCtx)
Sets up the full rank communication infrastructure, including neighbor ranks and bounding box exchang...
Definition setup.c:3242
PetscErrorCode SetupGridAndSolvers(SimCtx *simCtx)
The main orchestrator for setting up all grid-related components.
Definition setup.c:2066
PetscErrorCode SetupSimulationEnvironment(SimCtx *simCtx)
Verifies and prepares the complete I/O environment for a simulation run.
Definition setup.c:1728
PetscErrorCode CreateSimulationContext(int argc, char **argv, SimCtx **p_simCtx)
Allocates and populates the master SimulationContext object.
Definition setup.c:453
PetscErrorCode SetupBoundaryConditions(SimCtx *simCtx)
(Orchestrator) Sets up all boundary conditions for the simulation.
Definition setup.c:2755
static PetscErrorCode PrepareTinyRuntimeConfig(const char *bcs_contents, PetscBool enable_particles, const char *extra_options, char *tmpdir, size_t tmpdir_len, char *control_path, size_t control_path_len)
Creates a tiny control-file bundle used by richer runtime fixtures built through the setup path.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PicurvBuildMomentumPurityRuntimeContext()

PetscErrorCode PicurvBuildMomentumPurityRuntimeContext ( const char *  bcs_contents,
SimCtx **  simCtx_out,
UserCtx **  user_out,
char *  tmpdir,
size_t  tmpdir_len 
)

Builds the production-sized straight-duct fixture used by the opt-in residual-purity diagnostic.

Builds the production-sized straight-duct fixture used by the opt-in residual-purity diagnostic.

Definition at line 827 of file test_support.c.

832{
833 char bcs_path[PETSC_MAX_PATH_LEN];
834 char post_path[PETSC_MAX_PATH_LEN];
835 char output_dir[PETSC_MAX_PATH_LEN];
836 char log_dir[PETSC_MAX_PATH_LEN];
837 char analysis_dir[PETSC_MAX_PATH_LEN];
838 char control_path[PETSC_MAX_PATH_LEN];
839 char control_buffer[8192];
840 SimCtx *simCtx = NULL;
841 const char *default_bcs =
842 "-Xi WALL noslip\n"
843 "+Xi WALL noslip\n"
844 "-Eta WALL noslip\n"
845 "+Eta WALL noslip\n"
846 "-Zeta INLET prescribed_velocity source_id=0\n"
847 "+Zeta OUTLET conservation\n";
848
849 PetscFunctionBeginUser;
850 PetscCheck(simCtx_out != NULL, PETSC_COMM_SELF, PETSC_ERR_ARG_NULL,
851 "SimCtx output cannot be NULL.");
852 PetscCall(PetscOptionsClear(NULL));
853 PetscCall(PicurvMakeTempDir(tmpdir, tmpdir_len));
854 PetscCall(PetscSNPrintf(bcs_path, sizeof(bcs_path), "%s/bcs.run", tmpdir));
855 PetscCall(PetscSNPrintf(post_path, sizeof(post_path), "%s/post.run", tmpdir));
856 PetscCall(PetscSNPrintf(output_dir, sizeof(output_dir), "%s/results", tmpdir));
857 PetscCall(PetscSNPrintf(log_dir, sizeof(log_dir), "%s/logs", tmpdir));
858 /* The analysis home defaults to a run-relative path, which would resolve against
859 * the harness's working directory instead of this fixture's tree. */
860 PetscCall(PetscSNPrintf(analysis_dir, sizeof(analysis_dir), "%s/results/analysis/metrics", tmpdir));
861 PetscCall(PetscSNPrintf(control_path, sizeof(control_path), "%s/test.control", tmpdir));
862 PetscCall(WriteTextFileForTests(bcs_path, bcs_contents ? bcs_contents : default_bcs));
863 PetscCall(WriteTextFileForTests(post_path,
864 "startTime = 0\nendTime = 1\ntimeStep = 1\noutput_particles = false\n"));
865 PetscCall(PetscSNPrintf(control_buffer, sizeof(control_buffer),
866 "-start_step 0\n"
867 "-totalsteps 2\n"
868 "-ren 10.0\n"
869 "-dt 0.001\n"
870 "-ic_source_frame cartesian\n-ic_source_expr_0 0.0\n-ic_source_expr_1 0.0\n-ic_source_expr_2 0.1\n"
871 "-bcs_files %s\n"
872 "-face_source_0_frame normal\n-face_source_0_expr_0 0.1\n"
873 "-profiling_timestep_mode off\n-profiling_final_summary true\n"
874 "-postprocessing_config_file %s\n"
875 /* PICurv's programmatic grid counts include the leading physical node;
876 * 17x17x65 therefore represents 16x16x64 Cartesian cells. */
877 "-grid\n-im 17\n-jm 17\n-km 65\n"
878 "-xMins 0.0\n-xMaxs 1.0\n-yMins 0.0\n-yMaxs 1.0\n-zMins 0.0\n-zMaxs 4.0\n"
879 "-rxs 1.0\n-rys 1.0\n-rzs 1.0\n-cgrids 0\n-nblk 1\n"
880 "-euler_field_source solve\n-mom_solver_type newton_krylov\n"
881 "-mg_level 1\n-poisson 0\n-tio 0\n-numParticles 0\n-pinit 2\n"
882 "-particle_console_output_freq 0\n-logfreq 1\n"
883 /* See the note above: the harness authorizes deletion of its own temp tree. */
884 "-output_dir %s\n-restart_dir %s\n-allow_unsafe_log_dir true\n-log_dir %s\n"
885 "-analysis_dir %s\n",
886 bcs_path, post_path, output_dir, output_dir, log_dir, analysis_dir));
887 PetscCall(WriteTextFileForTests(control_path, control_buffer));
888 PetscCall(PetscOptionsSetValue(NULL, "-control_file", control_path));
889 PetscCall(CreateSimulationContext(0, NULL, &simCtx));
890 simCtx->exec_mode = EXEC_MODE_SOLVER;
891 PetscCall(SetupSimulationEnvironment(simCtx));
892 PetscCall(SetupGridAndSolvers(simCtx));
893 PetscCall(SetupBoundaryConditions(simCtx));
894 PetscCall(SetupDomainRankInfo(simCtx));
895 *simCtx_out = simCtx;
896 if (user_out) *user_out = simCtx->usermg.mgctx[simCtx->usermg.mglevels - 1].user;
897 PetscFunctionReturn(0);
898}
PetscErrorCode PicurvMakeTempDir(char *path, size_t path_len)
Creates a unique temporary directory for one test case.
static PetscErrorCode WriteTextFileForTests(const char *path, const char *contents)
Writes one small temporary text file used by the richer runtime fixtures.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PicurvDestroyRuntimeContext()

PetscErrorCode PicurvDestroyRuntimeContext ( SimCtx **  simCtx_ptr)

Finalizes and frees a runtime context built by PicurvBuildTinyRuntimeContext.

Definition at line 903 of file test_support.c.

904{
905 PetscFunctionBeginUser;
906 if (simCtx_ptr && *simCtx_ptr) {
907 PetscCall(FlowSolver_Destroy(*simCtx_ptr));
908 PetscCall(FinalizeSimulation(*simCtx_ptr));
909 *simCtx_ptr = NULL;
910 }
911 PetscCall(PetscOptionsClear(NULL));
912 PetscFunctionReturn(0);
913}
PetscErrorCode FinalizeSimulation(SimCtx *simCtx)
Main cleanup function for the entire simulation context.
Definition setup.c:4137
PetscErrorCode FlowSolver_Destroy(SimCtx *simCtx)
Releases the solver objects FlowSolver() keeps for the run.
Definition solvers.c:202
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PicurvPopulateUniformCellCenters()

PetscErrorCode PicurvPopulateUniformCellCenters ( UserCtx *  user)

Populates cell center coordinates for a uniform grid on [0,1]^3.

Uses the shifted-index convention: cell (i,j,k) is stored at array index (i+1, j+1, k+1). For mx cells on [0,1], cell i has center at (i+0.5)/mx.

Definition at line 583 of file test_support.c.

584{
585 Cmpnts ***cent = NULL;
586 PetscInt mx = user->IM;
587 PetscInt my = user->JM;
588 PetscInt mz = user->KM;
589
590 PetscFunctionBeginUser;
591 PetscCall(DMDAVecGetArray(user->fda, user->Cent, &cent));
592 for (PetscInt k = user->info.zs; k < user->info.zs + user->info.zm; k++) {
593 for (PetscInt j = user->info.ys; j < user->info.ys + user->info.ym; j++) {
594 for (PetscInt i = user->info.xs; i < user->info.xs + user->info.xm; i++) {
595 cent[k][j][i].x = (i - 0.5) / (PetscReal)mx;
596 cent[k][j][i].y = (j - 0.5) / (PetscReal)my;
597 cent[k][j][i].z = (k - 0.5) / (PetscReal)mz;
598 }
599 }
600 }
601 PetscCall(DMDAVecRestoreArray(user->fda, user->Cent, &cent));
602 PetscCall(DMGlobalToLocalBegin(user->fda, user->Cent, INSERT_VALUES, user->lCent));
603 PetscCall(DMGlobalToLocalEnd(user->fda, user->Cent, INSERT_VALUES, user->lCent));
604 PetscFunctionReturn(0);
605}
A 3D point or vector with PetscScalar components.
Definition variables.h:144
Here is the caller graph for this function:

◆ PicurvPopulateIdentityMetrics()

PetscErrorCode PicurvPopulateIdentityMetrics ( UserCtx *  user)

Fills metric vectors with identity metrics for Cartesian-reference tests.

Fills metric vectors with identity metrics for Cartesian-reference tests.

Definition at line 611 of file test_support.c.

612{
613 Cmpnts ***csi = NULL;
614 Cmpnts ***eta = NULL;
615 Cmpnts ***zet = NULL;
616 Cmpnts ***icsi = NULL;
617 Cmpnts ***ieta = NULL;
618 Cmpnts ***izet = NULL;
619 Cmpnts ***jcsi = NULL;
620 Cmpnts ***jeta = NULL;
621 Cmpnts ***jzet = NULL;
622 Cmpnts ***kcsi = NULL;
623 Cmpnts ***keta = NULL;
624 Cmpnts ***kzet = NULL;
625 PetscReal ***aj = NULL;
626 PetscReal ***iaj = NULL;
627 PetscReal ***jaj = NULL;
628 PetscReal ***kaj = NULL;
629
630 PetscFunctionBeginUser;
631 PetscCall(DMDAVecGetArray(user->fda, user->Csi, &csi));
632 PetscCall(DMDAVecGetArray(user->fda, user->Eta, &eta));
633 PetscCall(DMDAVecGetArray(user->fda, user->Zet, &zet));
634 PetscCall(DMDAVecGetArray(user->fda, user->ICsi, &icsi));
635 PetscCall(DMDAVecGetArray(user->fda, user->IEta, &ieta));
636 PetscCall(DMDAVecGetArray(user->fda, user->IZet, &izet));
637 PetscCall(DMDAVecGetArray(user->fda, user->JCsi, &jcsi));
638 PetscCall(DMDAVecGetArray(user->fda, user->JEta, &jeta));
639 PetscCall(DMDAVecGetArray(user->fda, user->JZet, &jzet));
640 PetscCall(DMDAVecGetArray(user->fda, user->KCsi, &kcsi));
641 PetscCall(DMDAVecGetArray(user->fda, user->KEta, &keta));
642 PetscCall(DMDAVecGetArray(user->fda, user->KZet, &kzet));
643 PetscCall(DMDAVecGetArray(user->da, user->Aj, &aj));
644 PetscCall(DMDAVecGetArray(user->da, user->IAj, &iaj));
645 PetscCall(DMDAVecGetArray(user->da, user->JAj, &jaj));
646 PetscCall(DMDAVecGetArray(user->da, user->KAj, &kaj));
647
648 for (PetscInt k = user->info.zs; k < user->info.zs + user->info.zm; ++k) {
649 for (PetscInt j = user->info.ys; j < user->info.ys + user->info.ym; ++j) {
650 for (PetscInt i = user->info.xs; i < user->info.xs + user->info.xm; ++i) {
651 csi[k][j][i].x = 1.0; csi[k][j][i].y = 0.0; csi[k][j][i].z = 0.0;
652 eta[k][j][i].x = 0.0; eta[k][j][i].y = 1.0; eta[k][j][i].z = 0.0;
653 zet[k][j][i].x = 0.0; zet[k][j][i].y = 0.0; zet[k][j][i].z = 1.0;
654 icsi[k][j][i] = csi[k][j][i];
655 ieta[k][j][i] = eta[k][j][i];
656 izet[k][j][i] = zet[k][j][i];
657 jcsi[k][j][i] = csi[k][j][i];
658 jeta[k][j][i] = eta[k][j][i];
659 jzet[k][j][i] = zet[k][j][i];
660 kcsi[k][j][i] = csi[k][j][i];
661 keta[k][j][i] = eta[k][j][i];
662 kzet[k][j][i] = zet[k][j][i];
663 aj[k][j][i] = 1.0;
664 iaj[k][j][i] = 1.0;
665 jaj[k][j][i] = 1.0;
666 kaj[k][j][i] = 1.0;
667 }
668 }
669 }
670
671 PetscCall(DMDAVecRestoreArray(user->fda, user->Csi, &csi));
672 PetscCall(DMDAVecRestoreArray(user->fda, user->Eta, &eta));
673 PetscCall(DMDAVecRestoreArray(user->fda, user->Zet, &zet));
674 PetscCall(DMDAVecRestoreArray(user->fda, user->ICsi, &icsi));
675 PetscCall(DMDAVecRestoreArray(user->fda, user->IEta, &ieta));
676 PetscCall(DMDAVecRestoreArray(user->fda, user->IZet, &izet));
677 PetscCall(DMDAVecRestoreArray(user->fda, user->JCsi, &jcsi));
678 PetscCall(DMDAVecRestoreArray(user->fda, user->JEta, &jeta));
679 PetscCall(DMDAVecRestoreArray(user->fda, user->JZet, &jzet));
680 PetscCall(DMDAVecRestoreArray(user->fda, user->KCsi, &kcsi));
681 PetscCall(DMDAVecRestoreArray(user->fda, user->KEta, &keta));
682 PetscCall(DMDAVecRestoreArray(user->fda, user->KZet, &kzet));
683 PetscCall(DMDAVecRestoreArray(user->da, user->Aj, &aj));
684 PetscCall(DMDAVecRestoreArray(user->da, user->IAj, &iaj));
685 PetscCall(DMDAVecRestoreArray(user->da, user->JAj, &jaj));
686 PetscCall(DMDAVecRestoreArray(user->da, user->KAj, &kaj));
687
688 PetscCall(DMGlobalToLocalBegin(user->fda, user->Csi, INSERT_VALUES, user->lCsi));
689 PetscCall(DMGlobalToLocalEnd(user->fda, user->Csi, INSERT_VALUES, user->lCsi));
690 PetscCall(DMGlobalToLocalBegin(user->fda, user->Eta, INSERT_VALUES, user->lEta));
691 PetscCall(DMGlobalToLocalEnd(user->fda, user->Eta, INSERT_VALUES, user->lEta));
692 PetscCall(DMGlobalToLocalBegin(user->fda, user->Zet, INSERT_VALUES, user->lZet));
693 PetscCall(DMGlobalToLocalEnd(user->fda, user->Zet, INSERT_VALUES, user->lZet));
694 PetscCall(DMGlobalToLocalBegin(user->fda, user->ICsi, INSERT_VALUES, user->lICsi));
695 PetscCall(DMGlobalToLocalEnd(user->fda, user->ICsi, INSERT_VALUES, user->lICsi));
696 PetscCall(DMGlobalToLocalBegin(user->fda, user->IEta, INSERT_VALUES, user->lIEta));
697 PetscCall(DMGlobalToLocalEnd(user->fda, user->IEta, INSERT_VALUES, user->lIEta));
698 PetscCall(DMGlobalToLocalBegin(user->fda, user->IZet, INSERT_VALUES, user->lIZet));
699 PetscCall(DMGlobalToLocalEnd(user->fda, user->IZet, INSERT_VALUES, user->lIZet));
700 PetscCall(DMGlobalToLocalBegin(user->fda, user->JCsi, INSERT_VALUES, user->lJCsi));
701 PetscCall(DMGlobalToLocalEnd(user->fda, user->JCsi, INSERT_VALUES, user->lJCsi));
702 PetscCall(DMGlobalToLocalBegin(user->fda, user->JEta, INSERT_VALUES, user->lJEta));
703 PetscCall(DMGlobalToLocalEnd(user->fda, user->JEta, INSERT_VALUES, user->lJEta));
704 PetscCall(DMGlobalToLocalBegin(user->fda, user->JZet, INSERT_VALUES, user->lJZet));
705 PetscCall(DMGlobalToLocalEnd(user->fda, user->JZet, INSERT_VALUES, user->lJZet));
706 PetscCall(DMGlobalToLocalBegin(user->fda, user->KCsi, INSERT_VALUES, user->lKCsi));
707 PetscCall(DMGlobalToLocalEnd(user->fda, user->KCsi, INSERT_VALUES, user->lKCsi));
708 PetscCall(DMGlobalToLocalBegin(user->fda, user->KEta, INSERT_VALUES, user->lKEta));
709 PetscCall(DMGlobalToLocalEnd(user->fda, user->KEta, INSERT_VALUES, user->lKEta));
710 PetscCall(DMGlobalToLocalBegin(user->fda, user->KZet, INSERT_VALUES, user->lKZet));
711 PetscCall(DMGlobalToLocalEnd(user->fda, user->KZet, INSERT_VALUES, user->lKZet));
712 PetscCall(DMGlobalToLocalBegin(user->da, user->Nvert, INSERT_VALUES, user->lNvert));
713 PetscCall(DMGlobalToLocalEnd(user->da, user->Nvert, INSERT_VALUES, user->lNvert));
714 PetscCall(DMGlobalToLocalBegin(user->da, user->Aj, INSERT_VALUES, user->lAj));
715 PetscCall(DMGlobalToLocalEnd(user->da, user->Aj, INSERT_VALUES, user->lAj));
716 PetscCall(DMGlobalToLocalBegin(user->da, user->IAj, INSERT_VALUES, user->lIAj));
717 PetscCall(DMGlobalToLocalEnd(user->da, user->IAj, INSERT_VALUES, user->lIAj));
718 PetscCall(DMGlobalToLocalBegin(user->da, user->JAj, INSERT_VALUES, user->lJAj));
719 PetscCall(DMGlobalToLocalEnd(user->da, user->JAj, INSERT_VALUES, user->lJAj));
720 PetscCall(DMGlobalToLocalBegin(user->da, user->KAj, INSERT_VALUES, user->lKAj));
721 PetscCall(DMGlobalToLocalEnd(user->da, user->KAj, INSERT_VALUES, user->lKAj));
722 PetscCall(DMGlobalToLocalBegin(user->da, user->P, INSERT_VALUES, user->lP));
723 PetscCall(DMGlobalToLocalEnd(user->da, user->P, INSERT_VALUES, user->lP));
724 PetscCall(DMGlobalToLocalBegin(user->da, user->Psi, INSERT_VALUES, user->lPsi));
725 PetscCall(DMGlobalToLocalEnd(user->da, user->Psi, INSERT_VALUES, user->lPsi));
726 PetscCall(DMGlobalToLocalBegin(user->fda, user->Ucat, INSERT_VALUES, user->lUcat));
727 PetscCall(DMGlobalToLocalEnd(user->fda, user->Ucat, INSERT_VALUES, user->lUcat));
728 PetscCall(DMGlobalToLocalBegin(user->fda, user->Ucont, INSERT_VALUES, user->lUcont));
729 PetscCall(DMGlobalToLocalEnd(user->fda, user->Ucont, INSERT_VALUES, user->lUcont));
730 PetscCall(DMGlobalToLocalBegin(user->fda, user->Cent, INSERT_VALUES, user->lCent));
731 PetscCall(DMGlobalToLocalEnd(user->fda, user->Cent, INSERT_VALUES, user->lCent));
732 PetscFunctionReturn(0);
733}
Here is the caller graph for this function:

◆ PicurvCreateSwarmPair()

PetscErrorCode PicurvCreateSwarmPair ( UserCtx *  user,
PetscInt  nlocal,
const char *  post_field_name 
)

Creates paired runtime/post swarms with optional extra post-processing field registration.

Creates paired runtime/post swarms with optional extra post-processing field registration.

Definition at line 738 of file test_support.c.

739{
740 PetscFunctionBeginUser;
741 if (!user) {
742 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_NULL, "UserCtx cannot be NULL.");
743 }
744
745 PetscCall(DMCreate(PETSC_COMM_WORLD, &user->swarm));
746 PetscCall(DMSetType(user->swarm, DMSWARM));
747 PetscCall(DMSetDimension(user->swarm, 3));
748 PetscCall(DMSwarmSetType(user->swarm, DMSWARM_BASIC));
749 PetscCall(DMSwarmSetCellDM(user->swarm, user->da));
750 PetscCall(RegisterSwarmFieldForTests(user->swarm, "position", 3, PETSC_REAL));
751 PetscCall(RegisterSwarmFieldForTests(user->swarm, "velocity", 3, PETSC_REAL));
752 PetscCall(RegisterSwarmFieldForTests(user->swarm, "DMSwarm_CellID", 3, PETSC_INT));
753 PetscCall(RegisterSwarmFieldForTests(user->swarm, "weight", 3, PETSC_REAL));
754 PetscCall(RegisterSwarmFieldForTests(user->swarm, "Diffusivity", 1, PETSC_REAL));
755 PetscCall(RegisterSwarmFieldForTests(user->swarm, "DiffusivityGradient", 3, PETSC_REAL));
756 PetscCall(RegisterSwarmFieldForTests(user->swarm, "Psi", 1, PETSC_REAL));
757 PetscCall(RegisterSwarmFieldForTests(user->swarm, "DMSwarm_location_status", 1, PETSC_INT));
758 PetscCall(DMSwarmFinalizeFieldRegister(user->swarm));
759 PetscCall(DMSwarmSetLocalSizes(user->swarm, nlocal, 0));
760
761 PetscCall(DMCreate(PETSC_COMM_WORLD, &user->post_swarm));
762 PetscCall(DMSetType(user->post_swarm, DMSWARM));
763 PetscCall(DMSetDimension(user->post_swarm, 3));
764 PetscCall(DMSwarmSetType(user->post_swarm, DMSWARM_BASIC));
765 PetscCall(DMSwarmSetCellDM(user->post_swarm, user->da));
766 PetscCall(RegisterSwarmFieldForTests(user->post_swarm, post_field_name, 1, PETSC_REAL));
767 PetscCall(DMSwarmFinalizeFieldRegister(user->post_swarm));
768 PetscCall(DMSwarmSetLocalSizes(user->post_swarm, nlocal, 0));
769 PetscFunctionReturn(0);
770}
static PetscErrorCode RegisterSwarmFieldForTests(DM swarm, const char *field_name, PetscInt field_dim, PetscDataType dtype)
Registers one DMSwarm field used by the C test fixtures.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PicurvMakeTempDir()

PetscErrorCode PicurvMakeTempDir ( char *  path,
size_t  path_len 
)

Creates a unique temporary directory path and materializes the directory.

Creates a unique temporary directory path and materializes the directory.

Definition at line 159 of file test_support.c.

160{
161 PetscFunctionBeginUser;
162 if (!path || path_len < 24) {
163 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_NULL, "Temp directory buffer is missing or too small.");
164 }
165
166 PetscCall(PetscSNPrintf(path, path_len, "/tmp/picurv-test-XXXXXX"));
167 if (!mkdtemp(path)) {
168 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "mkdtemp failed for '%s': %s", path, strerror(errno));
169 }
170 PetscFunctionReturn(0);
171}
Here is the caller graph for this function:

◆ PicurvRemoveTempDir()

PetscErrorCode PicurvRemoveTempDir ( const char *  path)

Recursively removes a temporary directory created by PicurvMakeTempDir.

Definition at line 176 of file test_support.c.

177{
178 char cmd[512];
179
180 PetscFunctionBeginUser;
181 if (!path || path[0] == '\0') PetscFunctionReturn(0);
182 /* Safety: only remove paths under /tmp/picurv-test- */
183 if (strncmp(path, "/tmp/picurv-test-", 17) != 0) {
184 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG,
185 "Refusing to remove path outside /tmp/picurv-test-*: '%s'", path);
186 }
187 PetscCall(PetscSNPrintf(cmd, sizeof(cmd), "rm -rf '%s'", path));
188 if (system(cmd) != 0) {
189 PetscCall(PetscPrintf(PETSC_COMM_SELF, "Warning: failed to remove temp dir '%s'\n", path));
190 }
191 PetscFunctionReturn(0);
192}
Here is the caller graph for this function:

◆ PicurvEnsureDir()

PetscErrorCode PicurvEnsureDir ( const char *  path)

Ensures a directory exists, creating it if required.

Ensures a directory exists, creating it if required.

Definition at line 147 of file test_support.c.

148{
149 PetscFunctionBeginUser;
150 if (mkdir(path, 0777) != 0 && errno != EEXIST) {
151 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Failed to create directory '%s': %s", path, strerror(errno));
152 }
153 PetscFunctionReturn(0);
154}
Here is the caller graph for this function:

◆ PicurvAssertRealNear()

PetscErrorCode PicurvAssertRealNear ( PetscReal  expected,
PetscReal  actual,
PetscReal  tol,
const char *  context 
)

Asserts two real values are within tolerance for test validation.

Asserts two real values are within tolerance for test validation.

Definition at line 1054 of file test_support.c.

1055{
1056 PetscFunctionBeginUser;
1057 /* Written so that a NaN fails: every comparison with NaN is false, so the form
1058 "difference > tol" let a NaN result pass silently. */
1059 if (!(PetscAbsReal(expected - actual) <= tol)) {
1060 PetscCall(PetscPrintf(PETSC_COMM_WORLD,
1061 "[FAIL] %s | expected=%0.12e actual=%0.12e tol=%0.12e\n",
1062 context, (double)expected, (double)actual, (double)tol));
1063 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Assertion failed.");
1064 }
1065 PetscFunctionReturn(0);
1066}
Here is the caller graph for this function:

◆ PicurvAssertIntEqual()

PetscErrorCode PicurvAssertIntEqual ( PetscInt  expected,
PetscInt  actual,
const char *  context 
)

Asserts two integer values are exactly equal for test validation.

Asserts two integer values are exactly equal for test validation.

Definition at line 1071 of file test_support.c.

1072{
1073 PetscFunctionBeginUser;
1074 if (expected != actual) {
1075 PetscCall(PetscPrintf(PETSC_COMM_WORLD,
1076 "[FAIL] %s | expected=%" PetscInt_FMT " actual=%" PetscInt_FMT "\n",
1077 context, expected, actual));
1078 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Assertion failed.");
1079 }
1080 PetscFunctionReturn(0);
1081}
Here is the caller graph for this function:

◆ PicurvAssertBool()

PetscErrorCode PicurvAssertBool ( PetscBool  value,
const char *  context 
)

Asserts a boolean condition is true for test validation.

Asserts a boolean condition is true for test validation.

Definition at line 1086 of file test_support.c.

1087{
1088 PetscFunctionBeginUser;
1089 if (!value) {
1090 PetscCall(PetscPrintf(PETSC_COMM_WORLD, "[FAIL] %s\n", context));
1091 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Assertion failed.");
1092 }
1093 PetscFunctionReturn(0);
1094}
Here is the caller graph for this function:

◆ PicurvAssertFileExists()

PetscErrorCode PicurvAssertFileExists ( const char *  path,
const char *  context 
)

Asserts a filesystem path exists.

Asserts a filesystem path exists.

Definition at line 1099 of file test_support.c.

1100{
1101 PetscBool exists = PETSC_FALSE;
1102
1103 PetscFunctionBeginUser;
1104 PetscCall(PetscTestFile(path, 'r', &exists));
1105 if (!exists) {
1106 PetscCall(PetscPrintf(PETSC_COMM_WORLD, "[FAIL] %s | missing file: %s\n", context, path));
1107 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_FILE_OPEN, "Expected file is missing.");
1108 }
1109 PetscFunctionReturn(0);
1110}
Here is the caller graph for this function:

◆ PicurvAssertVecConstant()

PetscErrorCode PicurvAssertVecConstant ( Vec  vec,
PetscScalar  expected,
PetscReal  tol,
const char *  context 
)

Asserts every entry of a vector equals a constant within tolerance.

Asserts every entry of a vector equals a constant within tolerance.

Definition at line 1115 of file test_support.c.

1116{
1117 PetscReal vmin = 0.0;
1118 PetscReal vmax = 0.0;
1119
1120 PetscFunctionBeginUser;
1121 PetscCall(VecMin(vec, NULL, &vmin));
1122 PetscCall(VecMax(vec, NULL, &vmax));
1123 PetscCall(PicurvAssertRealNear((PetscReal)expected, vmin, tol, context));
1124 PetscCall(PicurvAssertRealNear((PetscReal)expected, vmax, tol, context));
1125 PetscFunctionReturn(0);
1126}
PetscErrorCode PicurvAssertRealNear(PetscReal expected, PetscReal actual, PetscReal tol, const char *context)
Asserts that two real values agree within tolerance.
Here is the call graph for this function:
Here is the caller graph for this function: