PyLith Application Flow#
The PyLith application driver performs two main functions.
First, it collects all user parameters from input files (e.g., .cfg files) and the command line, and then it performs from simple checks on the parameters.
Second, it launches the MPI job.
Once the MPI job launches, the application flow is:
Read the finite-element mesh;
pylith.meshio.MeshImporter.Read the mesh (serial);
pylith::meshio::MeshIO.Reorder the mesh, if desired;
pylith::topology::ReverseCuthillMcKee.Insert cohesive cells as necessary (serial);
pylith::faults::FaultCohesive.Distribute the mesh across processes (parallel);
pylith::topology::Distributor.Refine the mesh, if desired (parallel);
pylith::topology::RefineUniform.
Setup the problem.
Preinitialize the problem by passing information from Python to C++ and doing minimal setup
pylith.Problem.preinitialize().Perform consistency checks and additional checks of user parameters;
pylith.Problem verifyConfiguration().Complete initialization of the problem;
pylith::problems::Problem::initialize().
Run the problem;
pylith.problems.Problem.run().Cleanup;
pylith.problems.Problem.finalize().Close output files.
Deallocate memory.
Output PETSc log summary, if desired.
In the first step, we list the object performing the work, whereas in subsequent steps we list the top-level object method responsible for the work.
Python objects are listed using the path.class syntax while C++ objects are listed using namespace::class syntax.
Note that a child class may redefine or perform additional work compared to what is listed in the parent class method.
Reading the mesh and the first two steps of the problem setup are controlled from Python. That is, at each step Python calls the corresponding C++ methods using SWIG. Starting with the complete initialization of the problem, the flow is controlled at the C++ level.
Time-Dependent Problem#
In a time-dependent problem the PETSc TS object (relabeled PetscTS within PyLith) controls the time stepping.
Within each time step, the PetscTS object calls the PETSc linear and nonlinear solvers as needed, which call the following methods of the C++ pylith::problems::TimeDependent object as needed: computeRHSResidual(), computeLHSResidual(), and computeLHSJacobian().
The pylith::problems::TimeDependent object calls the corresponding methods in the boundary conditions, constraints, and materials objects.
At the end of each time step, it calls problems::TimeDependent::poststep().