Skip to content

Initializing the TDycore Library

Jeffrey N. Johnson edited this page Sep 20, 2020 · 4 revisions

Because the TDycore library uses MPI, PETSc, and other subsystems, we have defined a function to initialize these various subsystems at the beginning of any TDycore-based driver/program:

PetscErrorCode TDyInit(int argc, char* argv[]);

Call this function where you would ordinarily call MPI_Init or PetscInitialize. It has no effect on subsequent calls. You can check whether the library has been initialized with a call to

PetscBool TDyInitialized(void);

Similarly, we have defined a finalization function to be called at the end of a TDycore-based program:

PetscErrorCode TDyFinalize(void);

Use this instead of MPI_Finalize or PetscFinalize. This ensures that all TDycore subsystems properly free their resources.

Fortran 90 Interface

We offer two equivalent subroutines for Fortran 90, similar to their PETSc counterparts:

TDyInit(ierr)
TDyFinalize(ierr)

Both accept an integer that stores an error code if these subroutines encounter an issue.