Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOL & BoundaryConditions #379

Open
B-LIE opened this issue Mar 9, 2024 · 3 comments
Open

MOL & BoundaryConditions #379

B-LIE opened this issue Mar 9, 2024 · 3 comments
Labels
question Further information is requested

Comments

@B-LIE
Copy link

B-LIE commented Mar 9, 2024

** Does MOL support BCs including Algebraic Equations❓**

I'm trying to solve a "realistic"/"engineering" type PDE system with MOL. Most (every?) example I have seen of the use of MOL just contains PDEs for equations, and simple boundaries for BCs. In my case, I consider a two phase system of liquid and gas; a gas-lift system as used in oil production. I have 3 PDEs + numerous AEs (algebraic equations) within the system volume.

Then I have boundary conditions, typically represented by pressures outside of the pipe and flow of mass through valves governed by pressure differences.


The documentation is not very clear to me whether MOL allows for a mixture of PDEs and AEs, and BCs with AEs.

Here is a sketch of the system I consider with boundaries:
image

  • Liquid (oil+water) enters at x=0 from an oil reservoir at pressure p_f.
  • Gas enters at x=0 from an annulus pipe surrounding the tubing pipe that I consider; annulus pressure is p_a.
  • The mixture (two phase) leaves the pipe at x=L towards a production manifold pressure p_p.

The gas and liquid flows as two separate phases, and may take up varying cross sectional areas given by variable alpha:
image

When I run my code, I get an error message when I try to discretize the model into DAEs: I'm told there is an illegal boundary condition.


To make my problem clearer, here are the PDEs valid within x=(0,L):
image

In addition, I have the following AEs which are also valid within x=(0,L):
image

In my model, in general, m is mass, fracture m is momentum, so two mass balances (liquid, gas) and a total momentum balance. The check decoration ("v") indicates "per volume". A dot on top (".") indicates flow rate. p is pressure, etc. For initial simplification, I have assumed that liquid density is constant (in reality, slightly compressible), and I have used a simplified gas EquationOfState which is almost an ideal gas but with compressibility factor z_g set to constant; in a more realistic model, z_g is the real root of a cubic polynomial. That will come in later.

My BCs are a mixture of traditional BCs and some AEs:
image
image

The last of the BCs I've listed (pressure gradient) is probably incorrect... because of gravity and friction, I don't think the gradient should be zero. Also, I already have 3 BCs related to the three external pressures p_f, p_a, p_p, and I have 3 PDEs with first order derivatives -- not sure if the pressure gradient should be counted in.

When I try to create the problem, I get an error message:

> prob = discretize(gas_lift,discr_scheme);
AssertionError: Boundary condition ṁ_a2t(t) ~ Y_a2t(t)*sqrt((max(Δp_a2t(t), 0)*ρ_a(t)) / (p_at2__ς*ρ_a2t__ς))*f_v(u_a2t(t))*ṁ_a2t__c is not on a boundary of the domain, or is not a valid boundary condition

NOTE: If someone knowledgeable would like to test what is wrong with my code, let me know.

@B-LIE B-LIE added the question Further information is requested label Mar 9, 2024
@B-LIE B-LIE closed this as completed Mar 9, 2024
@B-LIE B-LIE reopened this Mar 9, 2024
@cmhyett
Copy link
Contributor

cmhyett commented Mar 9, 2024

This is not an appropriate place to post confidential code. Anyone can view.

@ruidanielgm
Copy link

Hello. Were you able to solve the problem? I'm having the same issue with another problem.

@B-LIE
Copy link
Author

B-LIE commented Jun 4, 2024

No. I found a mistake in one of my boundary conditions, and started to check how I could compute steady state of a simpler problem using a boundary value solver. Then I got caught up in other things, and have put it at rest for the time being... will return to it RSN... ["Real Soon Now", an expression used by writer Jerry Pournelle in Byte Magazine back in the days...].


Note: my problem with formulating the model using MethodOfLines was not due to the mistaken boundary condition, but is a structural thing with restriction on the form of boundary conditions. Reason for sidestepping into the steady state study was in a hope that the system is simpler to solve if I start close to steady state.

I haven't checked lately whether the possibilities with boundary values have been improved.

Anyways, I have some ideas of how to get around the problem, but it will be extremely wasteful wrt. unknowns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants