Step 1: Error 5#

Error Message#

Listing 178 Error message 5 when running Step 1.#
 1$ pylith step01_gravity.cfg
 2
 3 >> /software/baagaard/py38-venv/pylith-debug/lib/python3.8/site-packages/pylith/problems/Problem.py:186:initialize
 4 -- timedependent(info)
 5 -- Initializing timedependent problem with quasistatic formulation.
 6[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
 7[0]PETSC ERROR: Error in external library
 8[0]PETSC ERROR: Error converting spatial database values for gravitational_acceleration at (  -96623.5  -72650.4) in
 9spatial database 'Gravity field'. Found near zero magnitude (0) for gravity field vector (  0  0).
10
11# -- lines with PETSc configuration omitted --
12
13[0]PETSC ERROR: #1 static PetscErrorCode pylith::topology::FieldQuery::queryDBPointFn(PylithInt, PylithReal, const PylithReal*, PylithInt, PylithScalar*, void*)() at /home/baagaard/src/cig/pylith/libsrc/pylith/topology/FieldQuery.cc:327
14[0]PETSC ERROR: #2 DMProjectPoint_Func_Private() at /software/baagaard/petsc-dev/src/dm/impls/plex/plexproject.c:127
15[0]PETSC ERROR: #3 DMProjectPoint_Private() at /software/baagaard/petsc-dev/src/dm/impls/plex/plexproject.c:409
16[0]PETSC ERROR: #4 DMProjectLocal_Generic_Plex() at /software/baagaard/petsc-dev/src/dm/impls/plex/plexproject.c:902
17[0]PETSC ERROR: #5 DMProjectFunctionLocal_Plex() at /software/baagaard/petsc-dev/src/dm/impls/plex/plexproject.c:933
18[0]PETSC ERROR: #6 DMProjectFunctionLocal() at /software/baagaard/petsc-dev/src/dm/interface/dm.c:8869
19[0]PETSC ERROR: #7 void pylith::topology::FieldQuery::queryDB()() at /home/baagaard/src/cig/pylith/libsrc/pylith/topology/FieldQuery.cc:211
20Fatal error. Calling MPI_Abort() to abort PyLith application.
21Traceback (most recent call last):
22  File "/software/baagaard/py38-venv/pylith-debug/lib/python3.8/site-packages/pylith/apps/PetscApplication.py", line 61, in onComputeNodes
23    self.main(*args, **kwds)
24  File "/software/baagaard/py38-venv/pylith-debug/lib/python3.8/site-packages/pylith/apps/PyLithApp.py", line 110, in main
25    self.problem.initialize()
26  File "/software/baagaard/py38-venv/pylith-debug/lib/python3.8/site-packages/pylith/problems/Problem.py", line 188, in initialize
27    ModuleProblem.initialize(self)
28  File "/software/baagaard/py38-venv/pylith-debug/lib/python3.8/site-packages/pylith/problems/problems.py", line 170, in initialize
29    return _problems.Problem_initialize(self)
30RuntimeError: Error detected while in PETSc function.

Troubleshooting Strategy#

During initialization of the time-dependent problem, PyLith encountered an error while calling PETSc functions. When an error occurs within a PETSc routine, PETSc dumps a lot of information to the screen. First, it display the error message; second, it displays configuration information; third, it displays the stacktrace. PyLith traps the PETSc error and displays the Python Traceback. In this case, the error message on lines 8-9 indicate that the gravity field vector has a magnitude of zero. We notice that it shows only the first two components because this is a 2D problem, whereas the default is (0, 0, -1) and intended for 3D problems.

Resolution#

Listing 179 Correct error in step01_gravity.cfg.#
[pylithapp.problem]
gravity_field = spatialdata.spatialdb.GravityField
gravity_field.gravity_dir = [0.0, -1.0, 0.0]

Our simulation now runs without errors and the output looks correct.