Kernels module (kernels.h)

Functions

int runForward(int argc, char **argv)

Runs the CSEM forward-modeling kernel (fm.csem).

Owns the complete PETSc lifecycle: calls PetscInitialize at entry and PetscFinalize at exit.

Parameters:
  • argc[in] Argument count from main().

  • argv[in] Argument vector from main().

Returns:

int the PetscErrorCode (cast to int) as the process exit status.

int runInverse(int argc, char **argv)

Runs the CSEM inversion kernel (im.csem).

Owns the complete PETSc lifecycle: calls PetscInitialize at entry and PetscFinalize at exit.

Runs the CSEM inversion kernel (im.csem).

Initializes PETSc, parses command-line arguments (including --version). Reads the unified bundle (mesh + conductivity + materials_id + receivers + /sources + /observed/Ex + case-property defaults), sets up the H(curl) grid, the inversion DM (1 DOF/cell), the smoother neighbor graph, the receiver-interpolation matrices, and the cached K / Ms-template / G_BDDC matrices. Runs custom L-BFGS (Nocedal 1980) with an adjoint-state gradient until the configured RMS-tolerance or max-iter is hit. Writes the recovered conductivity, the log-perturbation X, and the RMS history to HDF5, then finalizes PETSc. Includes Extrae instrumentation hooks if compiled with USE_EXTRAE.

Parameters:
  • argc[in] Argument count from main().

  • argv[in] Argument vector from main().

  • argc – Argument count.

  • argv – Argument vector.

Returns:

int the PetscErrorCode (cast to int) as the process exit status.

Returns:

int 0 on success, non-zero on failure.