Skip to content

Five spot demos#9

Open
volpatto wants to merge 10 commits into
allanleal:experimentalfrom
volpatto:five-spot-demo
Open

Five spot demos#9
volpatto wants to merge 10 commits into
allanleal:experimentalfrom
volpatto:five-spot-demo

Conversation

@volpatto

@volpatto volpatto commented Sep 24, 2019

Copy link
Copy Markdown
Collaborator

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.

@volpatto volpatto requested a review from allanleal September 24, 2019 02:58

@allanleal allanleal left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread rok/permeability.py


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):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread rok/utils.py
import numpy as np


class PressureFixBC(fire.DirichletBC):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! :)

@volpatto

volpatto commented Sep 24, 2019

Copy link
Copy Markdown
Collaborator Author

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).

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants