# Spatially variable boundary conditions

**URL:** <https://community.geodynamics.org/t/spatially-variable-boundary-conditions/4022>\
**Category:** PyLith\
**Created:** [March 27, 2025, 7:23pm UTC](https://community.geodynamics.org/t/spatially-variable-boundary-conditions/4022 "2025-03-27T19:23:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stacylarochelle](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/stacylarochelle/32/2494_2.png) [@stacylarochelle](https://community.geodynamics.org/u/stacylarochelle)\
**Post date:** [March 27, 2025, 7:23pm UTC](https://community.geodynamics.org/t/spatially-variable-boundary-conditions/4022/1 "2025-03-27T19:23:02Z")

</div>

Hello,

I’m wondering if it is possible to prescribe a spatially variable Neumann boundary condition through an analytical expression (e.g., f(x) = x^2) instead of through a SimpleDB external file? It looks like it should be possible from looking at [Eq. 163](https://pylith.readthedocs.io/en/latest/user/physics/bc/time-dependent.html#equation-b8e95689-cd61-405f-86ea-a9d9472a5bad), but I can’t figure out how to implement a spatially variable f\_o(x) as opposed to a constant value when defining the boundary conditions in the .cfg.

I’m using Pylith Version 4.2.0.

Thanks so much for your help!

---

<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:** [March 27, 2025, 8:47pm UTC](https://community.geodynamics.org/t/spatially-variable-boundary-conditions/4022/2 "2025-03-27T20:47:39Z")

</div>

You can use the [AnalyticDB — SpatialData 3.1.3 documentation](https://spatialdata.readthedocs.io/en/latest/user/components/spatialdb/AnalyticDB.html).

Let us know if you need more explanation than what is in the SpatialData documentation..

---

<div class="post-metadata">

**Author:** ![stacylarochelle](https://yyz2.discourse-cdn.com/flex036/user_avatar/community.geodynamics.org/stacylarochelle/32/2494_2.png) [@stacylarochelle](https://community.geodynamics.org/u/stacylarochelle)\
**Post date:** [March 27, 2025, 10:47pm UTC](https://community.geodynamics.org/t/spatially-variable-boundary-conditions/4022/3 "2025-03-27T22:47:26Z")

</div>

Awesome, I got it to work. Thanks so much!
