Replies: 2 comments 2 replies
-
Sorry for the delay; I started to compose answer several days ago, but I'm not sure what happened to it.
What issues? What do you see? What do you expect to see? Once I import the necessary classes and modules, your code runs, but I have no idea what you expect it to do.
def calc_pressure(n,W,P0,mode):
if mode=='P0':
P=P0.copy()
if mode=='P2a':
altP = rhow*g*W
P = altP * (altP <= P0) + P0 * (altP > P0)
if mode=='P2b':
altP = P0*(W/0.1)**3.5
P = altP * (altP <= P0) + P0 * (altP > P0)
return P and then just H = s-b
H.name = "Water height"
P0 = rhoi*g*H
P0.name = "Overburden pressure"
P = calc_pressure(0,W,P0,'P0')
P.name = "Water pressure" |
Beta Was this translation helpful? Give feedback.
-
If P is a simple function of W, like your "P2a" and "P2b" cases, then you don't need to do anything. P will automatically update whenever W changes if you write it the way I show. If P will have its own evolution equation, then you will need to either solve the W and P equations sequentially or you will need to couple them and solve the coupled equation. Either way, you will probably need sweeps to get the solutions to converge. Be aware that the more your equations start to look like Navier-Stokes flow equations, the coupling between pressure and velocity can get tricky. If you find yourself in that situation, see, e.g., |
Beta Was this translation helpful? Give feedback.
-
Hi there! I am trying to solve a problem in relation with subglacial hydrology (https://gmd.copernicus.org/articles/8/1613/2015/gmd-8-1613-2015.pdf) which reads as follows:
with the vector$V=-k\nabla(P+\rho_w gb)$ and $D=\rho_w gkW$ . The term $P+\rho_w gb$ is called the hydraulic potential ($\phi$ ).
My aim is to model a little glacier with water underneath. W is the water thickness in the layer below ice and is the variable to solve. Depending on the pressure (P) and the topography of the bedrock (b) in which the glacier is, water circulates in a way or another, accumulating in some regions and disappearing from others.
For the variables above, P is the pressure defined in a simple case as$P=P_o=\rho_i g H$ (overburden pressure of the ice) with H the ice thickness above the water layer. In turn, H can be modeled as the difference H=s-b with s the surface elevation of the glacier (normally a square-root function) and b is the bedrock elevation at the bottom of the glacier (for this, my plan is to define a function that tries to represent some mountainous terrain, but for the moment it can be flat). Regarding the parameters, $\rho_w$ is the density of water, $k$ is conductivity and $m$ is the source term which is for my case a small constant number. I have defined all this functions in Python in order to make further modifications.
Regarding the equations, as you can see, there is an advection term, together with a diffusion term and in addition a source term. Do you know how to solve it correctly with FiPy?
I have tried the following code to solve it, but I think that the convection term is producing some issues, because the diffusion and source terms work well separately. Also, I don't know if the way I have tried to implement the gradient in V, with functions previously defined (not shown below) is the correct way. As boundary conditions I am trying to impose W=0 at the edges of the domain.
Here there are the functions I use for defining the variables I need with some cases to choose:
And here is the code that I have tried to solve it:
Beta Was this translation helpful? Give feedback.
All reactions