Five spot demos#9
Conversation
There was a problem hiding this comment.
Hi Diego, another round of major contributions from your side; incredible! The demos look quite interesting. I remember in the past trying to solve a five-spot reservoir problem in which Neumann boundary conditions were imposed in all boundaries, and this resulting in a singular problem, requiring further steps to fix it (at the time, using FEniCS with an approach similar to the one documented in the Firedrake docs here. It seems you did not need this (I haven't looked at in details why not though, maybe you are imposing pressure somewhere, and not just only zero fluxes on the boundaries).
| year = 365 * day | ||
|
|
||
| # Parameters for the flow simulation | ||
| method = 'dgls' |
There was a problem hiding this comment.
| method = 'dgls' | |
| method = 'dgls' # Options: 'sdhm', 'cgls', 'dgls' |
| # v_left = rok.conditional(y < h_well, -rok.sqrt(rok.Constant(2)) / (3 * (h_well - y)), 0) | ||
| # v_bottom = rok.conditional(x < h_well, -rok.sqrt(rok.Constant(2)) / (3 * (h_well - x)), 0) | ||
| # v_right = rok.conditional(Ly - y < h_well, rok.sqrt(rok.Constant(2)) / (3 * (y - h_well)), 0) | ||
| # v_top = rok.conditional(Lx - x < h_well, rok.sqrt(rok.Constant(2)) / (3 * (x - h_well)), 0) |
There was a problem hiding this comment.
Are these comments meant to exist in the demo (in case someone wants to try it out)?
| f = rok.Constant(0.0) # the source rate in the flow calculation | ||
|
|
||
| # Boundary conditions | ||
| h_well = rok.Constant(0.05 * Lx) |
There was a problem hiding this comment.
I wonder what would happen if the well size is less than the size of the mesh cell. In the future, we could have in one of the rok classes (or in a Simulator class) a method to sets wells such that a proper well size is chosen automatically, and the user only specifies the injection/production rates (and the composition of the fluid injected).
|
|
||
| rok.File(resultsdir + 'flow.pvd').write(flow.u, flow.p, k) | ||
|
|
||
| # # Initialize the transport solver |
There was a problem hiding this comment.
Should we transform this demo into a demo-five-spot-transport-in-heterogeneous-medium.py by uncommenting the lines of code below?
| plt.show() | ||
|
|
||
| output = File(resultsdir + 'flow.pvd', project_output=True) | ||
| output.write(sigma_h, u_h, flux_h, k) |
There was a problem hiding this comment.
For these series of standalone demos, using only Firedrake, what do you think about placing them in a demos/firedrake directory? In this way, Rok users would not be so explicitly exposed to more lower level constructs (as most of such users might not have have enough FEM knowledge).
|
|
||
|
|
||
| def permeability(function_space, minval=1e-14, maxval=1e-10, var=1e-2, len_scale=10, len_low=0, seed=20170519): | ||
| def permeability(function_space, minval=1e-18, maxval=1e-10, var=1e-2, len_scale=10, len_low=0, seed=20170519): |
There was a problem hiding this comment.
You mentioned before we should be careful at such low level of permeability values because the flow solver could possibly fail; I assume the new methods you've introduced are more robust and can handle such scenarios.
| import numpy as np | ||
|
|
||
|
|
||
| class PressureFixBC(fire.DirichletBC): |
There was a problem hiding this comment.
Are there restrictions to the use of PressureFixBC (e.g., only with DG function spaces)? What are the differences with plain DirichletBC? My knowledge of the underlying Firedrake lower level components do not allow me to understand what is going on below! :)
Hi, Allan! I will do the requested changes and discuss the above points with you, but due to Firedrake's conference deadline, I will skip it for awhile. In the next days I will come back here. Sorry! |
Allan, I'm adding here some basic examples with Five Spot problems. Since I had some difficulties while handling the boundary conditions as they currently are in
rok(the five spot problem has a hard setup with source terms and some conditions that can be not straightforward), I put the flow part as explicit, just above the transport part. I don't know if you want to use it, but I'm sending the PR anyway. If you want to use it, please be careful with the source terms, they can give rise to nonphysical pressure values (negative ones). To avoid such complication, you have to follow the classical thermodynamic convention about the sign of work (net fluid flow is just "work" too, but in terms of momentum). So, it means that the injection well source term (solving the flow problem) must be negative, while the production well is positive. Maybe (actually there is a great chance of) you know it far better than me, but an advise has no price anyway.The case with transport and random permeability field is at
demos/demo-standalone-five-spot-realistic-dgls.py.