Adding gravity to Poisson equation


226
views
0
8 months ago by
Hi there
I have the equation

$0=\nabla\bullet\left(\nabla p-\rho g\right)$0=∇•(pρg)

Solved in a circular domain in the x, z coordiantes.

How could I subtract the g vector from the  $\frac{\partial p}{\partial z}$pz term only
I've been trying these but I do not know how to define the vector field with the constant z component
F = (Dx(p,0)*Dx(q,0)+(Dx(p,1)-rho*g)Dx(q,0))*dx​

Thank you very much for your help
Community: FEniCS Project
I recommend you add more details about your problem though. Like including the entire snippet of code.
written 8 months ago by Miguel  

1 Answer


2
8 months ago by
Miguel  
You can write g as a vector expression:

from dolfin import *

mesh = UnitSquareMesh(10,10)
V = FunctionSpace(mesh, 'CG', 1)
p = Function(V)
q = TestFunction(V)

g = Expression(("0.0", "10.0"), degree=0)

F = inner(grad(q),(grad(p) - g))*dx
p_ = TrialFunction(V)
J = derivative(F, p, p_)​
Thank you very much for your help.

There is one thing I do not understand, what is the purpose of these lines?
p_ = TrialFunction(V)
J = derivative(F, p, p_)​​
written 8 months ago by Ruben Gonzalez  
To get the jacobian/derivative of the linear form F with respect to p. Not sure if you need it, probably not.
written 8 months ago by Miguel  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »