Postprocessing module (postprocessing.h)
Functions
-
PetscErrorCode computeFields(const fmParams params, const CsemSourceSet sources, const DM dm, const Grid grid, Vec receivers, const Mat X)
Computes electric and magnetic fields at receivers (forward kernel).
Locates the receivers in the mesh, interpolates the H(curl) solution X to obtain E (and H via H = curl(E)/(iωμ)) at each receiver, and writes a SINGLE HDF5 response file containing every source. The file layout is:
/ root attrs: petgem_version, input_filename, date, nord, mpi_tasks, num_sources, frequency /sources/src{k}/ attrs: frequency, x_pos, y_pos, z_pos, current, length, dip_angle, azimuth_angle /sources/src{k}/fields/ Ex, Ey, Ez, Hx, Hy, Hz (PETSc Vec)
The output filename is
{output_directory}/{output_filename}.h5. All Vec writes are collective on the kernel communicator through PETSc’s HDF5 viewer (parallel HDF5 when PETSc is built against a parallel HDF5 library); no rank-0 gather happens.receiversis the serial Vec (PETSC_COMM_SELF, length 3·N_recv) returned by loadCsemInputs - passed through so postprocessing does not re-open the input HDF5.Locates the receivers in the mesh, interpolates the H(curl) solution X to obtain E at each receiver, derives H via H = curl(E)/(iωμ), and writes a SINGLE HDF5 response file containing every source. The file groups the responses by source (one subgroup per transmitter) and carries run-wide provenance attributes at the root:
/ root attrs: petgem_version, input_filename, date, nord, mpi_tasks, num_sources, frequency /sources/src{k}/ attrs: frequency, x_pos, y_pos, z_pos, current, length, dip_angle, azimuth_angle /sources/src{k}/fields/ Ex, Ey, Ez, Hx, Hy, Hz (PETSc Vec)
The output filename is
{output_directory}/{output_filename}.h5; the per-source_src{k}suffix used by the legacy one-file-per-source layout is gone. All Vec writes are collective on the kernel’s MPI communicator and go through PETSc’s native HDF5 viewer (parallel HDF5 when PETSc is built against a parallel HDF5 library); no rank-0 gather happens.receiversis the serial Vec (PETSC_COMM_SELF, length 3·N_recv) returned by loadCsemInputs - passed through so postprocessing does not re-open the input HDF5.Note
Assumes 3D H(curl) Nédélec elements. Receivers outside the computational domain trigger a warning and are skipped.
- Parameters:
params – [in] Forward-modeling parameters (nord, output paths).
sources – [in] Transmitter set (one solution column per source).
dm – [in] DMPlex mesh and H(curl) discretization.
grid – [in] Finite-element grid descriptor.
receivers – [in] Serial Vec of 3·N_recv receiver coordinates.
X – [in] Solution matrix, one column per source.
params – [in] Forward-modeling parameters (nord, output paths, MPI tasks).
sources – [in] Transmitter set (one solution column per source).
dm – [in] DMPlex mesh and H(curl) discretization.
grid – [in] Finite-element grid descriptor.
receivers – [in] Serial Vec of 3·N_recv receiver coordinates.
X – [in] Solution matrix (one column per source).
- Returns:
PetscErrorCode PETSC_SUCCESS on success, or a PETSc error code otherwise.
- Returns:
PetscErrorCode PETSC_SUCCESS on success, or a PETSc error code otherwise.