Adjusting the FEM source code of contaminant transport physics


I am pavan. Recently I started working on using the ContaminantTransport module to transport biochemical species. I am even using the Python script file to include the required source terms so that I will be able to simulate what I want (Wang and Nackenhorst, 2020).

I have two questions regarding the implementation.

  1. I found adjusting the governing partial differential equation of the ContaminantTransport module very difficult, as per my requirement. Is it possible to include my own derived weak form in OGS? If so, can I get any documentation for the same? If not, can I get a solved example for a pure mathematics problem with a PDE that includes all the advective, diffusive terms?

  2. How to define the nonlinear functions for the variations in the hydraulic properties (i.e., porosity and permeability), which are functions of the primary variables of the problem (i.e., concentration, pore pressure)? Is it possible to update the variables through the Python script?

Please let me know.


Hi Pavan,

if the changes to the existing processes are small, the easiest would be to extend one of the existing processes by an additional / modified term. If the changes are significant, you may think about a new process class (copying one that’s similar, renaming it and then implementing your changes).

Properties that are non-linear functions exist already in the MPL (material property library). One example are retention curves, krel curves etc. You would also backtrace their implementation to see how that’s done and then create your own copy.

That’s a first general response. A lot depends on the specifics of what you want to do exactly. It might be easiest if you present your planned work to the group at some stage (the PDEs, weak forms, properties, etc.). Then, the people present might be able to give you some hints on where to look and how to proceed.

BTW: Advection-diffusion examples you can find in several places in the benchmark Gallery, including:

Dear Thomas,

Thanks for the suggestions. I will try the same and let you know.

However, what exactly do you mean by presenting the group? Do you mean to post the governing equations here in the forum or contact and personally present the specifics to the OGS team?


Dear Pavan,

thanks for your talk today that made it very clear what you want to do. Two pieces of information that you may find useful:

  • There will be an improved Modified Cam Clay version merged soon – you may check if that helps you.
  • I suggest do contact Xuerui again, because she has a running model very similar to yours and a corresponding paper in review. Firstly, it may save you effort; secondly, it’s nice to link things – both from a scientific point of view as well as from code management (if we can merge one overall model instead of two almost identical ones, that’s good).