# PETSc Error in Poroelastic Simulation with PyLith 4.2.0

**URL:** <https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219>\
**Category:** PyLith\
**Created:** [July 17, 2025, 1:48pm UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219 "2025-07-17T13:48:02Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![yangxiao](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/yangxiao/32/2323_2.png) [@yangxiao](https://community.geodynamics.org/u/yangxiao)\
**Post date:** [August 27, 2025, 3:12am UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/24 "2025-08-27T03:12:51Z")

</div>

Dear Baagaard:

I have a question regarding my current work. I am simulating reservoir pressure changes, and in my input file I am using the following settings:

[pylithapp.problem.bc.bc\_zpos\_shangyou]  
label = boundary\_zpos\_shangyou  
use\_initial = False  
use\_time\_history = True  
db\_auxiliary\_field = spatialdata.spatialdb.UniformDB  
db\_auxiliary\_field.description = Neumann BC shangyou edge  
db\_auxiliary\_field.values = [time\_history\_amplitude\_normal, time\_history\_amplitude\_tangential\_1, time\_history\_amplitude\_tangential\_2, time\_history\_start\_time]  
db\_auxiliary\_field.data = [-1_MPa, 0_MPa, 0\*MPa, 1.0]  
time\_history = spatialdata.spatialdb.TimeHistory  
time\_history.description = Impulse time history  
time\_history.filename = impulseshang.timedb  
auxiliary\_subfields.time\_history\_amplitude.basis\_order = 0  
auxiliary\_subfields.time\_history\_start\_time.basis\_order = 0

together with another input file to apply the pressure change.

However, considering the effect of water gravity, the pressure on different terrains should act along the local surface normal. Therefore, I would like to apply time-varying pressure **at each point individually** , rather than applying the same time variation across the entire surface.

May I ask if this idea is feasible in PyLith? I believe I asked a similar question before, and you kindly provided some replies, but I am still confused and not sure how to resolve this issue.

Thank you very much for your time and guidance.

Best regards,

[impulseshangtimedb.txt](https://community.geodynamics.org/uploads/short-url/dlPZsSgnqMqlJRLCA63q0ohMEfU.txt) (67.4 KB)

---

<div class="post-metadata">

**Author:** ![baagaard](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/baagaard/32/615_2.png) [@baagaard](https://community.geodynamics.org/u/baagaard)\
**Post date:** [August 27, 2025, 1:53pm UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/25 "2025-08-27T13:53:11Z")

</div>

> [@yangxiao](#):
>
> apply time-varying pressure **at each point individually** , rather than applying the same time variation across the entire surface.

PyLith currently lacks a mechanism for specifying boundary conditions that vary independently in space and time. The current implementation utilizes spatial variations in parameters, while maintaining the same temporal function with spatial variations in the time shift and amplitude. [Time-Dependent Boundary Conditions — PyLith 5.0.0dev documentation](https://pylith.readthedocs.io/en/latest/user/physics/bc/time-dependent.html#time-dependent-boundary-conditions)

Some workarounds include:

1. Using multiple, overlapping Neumann boundary conditions so that the sum of the boundary conditions gives the function you want.
2. Decomposing a boundary condition into multiple boundary conditions that do not overlap.

---

<div class="post-metadata">

**Author:** ![yangxiao](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/yangxiao/32/2323_2.png) [@yangxiao](https://community.geodynamics.org/u/yangxiao)\
**Post date:** [August 29, 2025, 4:40pm UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/26 "2025-08-29T16:40:23Z")

</div>

Thank you very much for your kind reply! I will give it a try.

---

<div class="post-metadata">

**Author:** ![yangxiao](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/yangxiao/32/2323_2.png) [@yangxiao](https://community.geodynamics.org/u/yangxiao)\
**Post date:** [August 31, 2025, 7:33am UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/27 "2025-08-31T07:33:41Z")

</div>

Dear baagaard:

I would also like to ask whether PyLith can be used to simulate and calculate the Peak Ground Acceleration (PGA) and Peak Ground Velocity (PGV) during an earthquake.I saw simulations of P-wave and S-wave propagation in barwaves-2d, but I’m not sure whether it can be used to simulate and compute the entire earthquake process.

---

<div class="post-metadata">

**Author:** ![baagaard](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/baagaard/32/615_2.png) [@baagaard](https://community.geodynamics.org/u/baagaard)\
**Post date:** [September 6, 2025, 7:26pm UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/28 "2025-09-06T19:26:48Z")

</div>

> I would also like to ask whether PyLith can be used to simulate and calculate the Peak Ground Acceleration (PGA) and Peak Ground Velocity (PGV) during an earthquake.I saw simulations of P-wave and S-wave propagation in barwaves-2d, but I’m not sure whether it can be used to simulate and compute the entire earthquake process.

PyLith v3 and later have limited capabilities for dynamic simulations (including inertia). We are still working on reimplementing the dynamic formulations in our multi-physics approach. PyLith v2.2.2 supports both prescribed and spontaneous rupture for both quasistatic and dynamic simulations.

---

<div class="post-metadata">

**Author:** ![yangxiao](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/yangxiao/32/2323_2.png) [@yangxiao](https://community.geodynamics.org/u/yangxiao)\
**Post date:** [September 8, 2025, 3:58pm UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/29 "2025-09-08T15:58:33Z")

</div>

Thank you for your help! Following your suggestion, I tried using a combination of two boundary conditions in my model. I used the `time_history_amplitude_normal` related content as follows:

[pylithapp.problem.bc.bc\_zpos\_shangyou]  
label = boundary\_zpos\_shangyou  
use\_initial = False  
use\_time\_history = True  
db\_auxiliary\_field = spatialdata.spatialdb.UniformDB  
db\_auxiliary\_field.description = Neumann BC shangyou edge  
db\_auxiliary\_field.values = [time\_history\_amplitude\_normal, time\_history\_amplitude\_tangential\_1, time\_history\_amplitude\_tangential\_2, time\_history\_start\_time]  
db\_auxiliary\_field.data = [-1_MPa, 0_MPa, 0\*MPa, 1.0]  
time\_history = spatialdata.spatialdb.TimeHistory  
time\_history.description = Impulse time history  
time\_history.filename = impulseshang.timedb  
auxiliary\_subfields.time\_history\_amplitude.basis\_order = 0  
auxiliary\_subfields.time\_history\_start\_time.basis\_order = 0

This part works without any issues.

Then, I wanted to add an initial pressure field that varies spatially (i.e., one pressure value for each grid point in the model). For this, I used:

[pylithapp.problem.bc.bc\_zpos\_shangyou]  
label = boundary\_zpos\_shangyou  
db\_auxiliary\_field = spatialdata.spatialdb.UniformDB  
db\_auxiliary\_field.description = Neumann BC shangyou edge  
db\_auxiliary\_field.filename = shangyouchushi.spatialdb

I feel my understanding might be incorrect because this part keeps failing. My intention was to introduce a `.spatialdb` file to implement it. The file content is as follows:

// This spatial database specifies the initial displacement and  
// velocity on the +x boundary. For the linear variation (data-dim ==  
// 1) in displacement, we only need to specify the two end points with  
// a SimpleDB.  
#SPATIAL.ascii 1  
SimpleDB {  
num-values = 3  
value-names = initial\_amplitude\_normal initial\_amplitude\_tangential\_1 initial\_amplitude\_tangential\_2  
value-units = MPa MPa MPa  
num-locs = 1  
data-dim = 1  
space-dim = 3  
cs-data = cartesian {  
to-meters = 1.0e+3 // specify coordinates in km  
space-dim = 3  
}  
}

However, it keeps producing the error:

/public1/home/a8s000279/pylith-4.2.1-linux-x86\_64/lib/python3.12/site-packages/pythia/ **init**.py:16: UserWarning: pkg\_resources is deprecated as an API…

> > ./pylithapp.cfg:476:  
> > – pyre.inventory(error)  
> > – timedependent.bc.neumanntimedependent.uniformdb.filename ← ‘shangyouchushi.spatialdb’  
> > – unrecognized property ‘timedependent.bc.neumanntimedependent.uniformdb.filename’  
> > …  
> > pylithapp: configuration error(s)
> > 
> > How should I resolve this?

---

<div class="post-metadata">

**Author:** ![yangxiao](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/yangxiao/32/2323_2.png) [@yangxiao](https://community.geodynamics.org/u/yangxiao)\
**Post date:** [September 8, 2025, 4:25pm UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/30 "2025-09-08T16:25:13Z")

</div>

Is it because I set this surface as NeumannTimeDependent that the spatial file above only works for Dirichlet boundaries? Does this mean I cannot implement the idea of applying the same `time_history_amplitude_normal` and `impulseshang.timedb` to the entire surface, while assigning a continuous but different `initial_amplitude_normal` to different points on this surface?

---

<div class="post-metadata">

**Author:** ![baagaard](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/baagaard/32/615_2.png) [@baagaard](https://community.geodynamics.org/u/baagaard)\
**Post date:** [September 8, 2025, 8:11pm UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/31 "2025-09-08T20:11:38Z")

</div>

The error you are getting arises from specifying a `UniformDB` but parameters for a `SimpleDB`. Both Neumann and Dirichlet boundary conditions work with any of the various types of spatial databases (`UniformDB`, `SimpleDB`, `SimpleGridDB`, `AnalyticDB`).

---

<div class="post-metadata">

**Author:** ![yangxiao](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/yangxiao/32/2323_2.png) [@yangxiao](https://community.geodynamics.org/u/yangxiao)\
**Post date:** [September 9, 2025, 1:29am UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/32 "2025-09-09T01:29:57Z")

</div>

I have already changed it to **SimpleDB** , but the same issue still occurs. Could it be because I set the **timehistory** part as **UniformDB** earlier? Since both conditions are applied to the same surface, could this be causing a conflict?

---

<div class="post-metadata">

**Author:** ![yangxiao](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/yangxiao/32/2323_2.png) [@yangxiao](https://community.geodynamics.org/u/yangxiao)\
**Post date:** [September 9, 2025, 1:33am UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/34 "2025-09-09T01:33:12Z")

</div>

Now is:[pylithapp.problem.bc.bc\_zpos\_shangyou]  
label = boundary\_zpos\_shangyou2  
field = pressure  
db\_auxiliary\_field = spatialdata.spatialdb.SimpleDB  
db\_auxiliary\_field.description = Flow into external boundary of shangyou  
db\_auxiliary\_field.filename = shangyouchushi.spatialdb

[pylithapp.problem.bc.bc\_zpos\_shangyou]  
label = boundary\_zpos\_shangyou  
use\_initial = False  
use\_time\_history = True  
db\_auxiliary\_field = spatialdata.spatialdb.UniformDB  
db\_auxiliary\_field.description = Neumann BC shangyou edge  
db\_auxiliary\_field.values = [time\_history\_amplitude\_normal, time\_history\_amplitude\_tangential\_1, time\_history\_amplitude\_tangential\_2, time\_history\_start\_time]  
db\_auxiliary\_field.data = [-1_MPa,0_MPa,0\*MPa, 1.0]  
time\_history = spatialdata.spatialdb.TimeHistory  
time\_history.description = Impulse time history  
time\_history.filename = impulseshang.timedb  
auxiliary\_subfields.time\_history\_amplitude.basis\_order = 0  
auxiliary\_subfields.time\_history\_start\_time.basis\_order = 0

---

<div class="post-metadata">

**Author:** ![baagaard](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/baagaard/32/615_2.png) [@baagaard](https://community.geodynamics.org/u/baagaard)\
**Post date:** [September 9, 2025, 3:10am UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/35 "2025-09-09T03:10:04Z")

</div>

If your parameters are the following, then you have two boundary conditions named `bc_zpos_shangyou`:

```auto
[pylithapp.problem.bc.bc_zpos_shangyou]
label = boundary_zpos_shangyou2
field = pressure
db_auxiliary_field = spatialdata.spatialdb.SimpleDB
db_auxiliary_field.description = Flow into external boundary of shangyou
db_auxiliary_field.filename = shangyouchushi.spatialdb

[pylithapp.problem.bc.bc_zpos_shangyou]
label = boundary_zpos_shangyou

```

If you have two boundary conditions on a boundary with a label “boundary\_zpos\_shangyou”, then you want:

```auto
[pylithapp.problem]
bc = [bc_zpos_shangyou_pressure, bc_zpos_shangyou_displacement]

[pylithapp.problem.bc.bc_zpos_shangyou_pressure]
label = boundary_zpos_shangyou
field = pressure
# Remaining settings added here

[pylithapp.problem.bc.bc_zpos_shangyou_displacement]
label = boundary_zpos_shangyou
field = displacement
# Remaining settings added here

```

Note that multiple boundary conditions can use the same label (nodeset or physical group), but they need different names in the PyLith list of boundary conditions.

---

<div class="post-metadata">

**Author:** ![yangxiao](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/yangxiao/32/2323_2.png) [@yangxiao](https://community.geodynamics.org/u/yangxiao)\
**Post date:** [September 9, 2025, 7:47am UTC](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219/36 "2025-09-09T07:47:53Z")

</div>

Thank you for your reply, it was very helpful to me. The issue has now been resolved. Thanks again!

[Previous page](https://community.geodynamics.org/t/petsc-error-in-poroelastic-simulation-with-pylith-4-2-0/4219.md?page=1)
