Replies: 2 comments 2 replies
-
To make the shapes match up, it looks like you have a Petrov-Galerkin, rather than Galerkin method. So you want to find a vector-valued # Note: I have no idea what the right sets of spaces are
V = VectorFunctionSpace(mesh, "CG", 2)
Q = FunctionSpace(mesh, "CG", 1)
Z = V*Q
z = Function(Z)
u, p = split(z)
# This is probably the wrong pair, but the shapes are right
W = Q*V
phi, psi = TestFunctions(W)
I = Identity(2)
sigma = mu*(grad(u) + grad(u).T) + lambda_ * div(u) * I
F = (
inner(grad(phi), u_diff)
+ phi * f
- inner(grad(psi), sigma)
+ div(psi)*p
)*dx
bcs = [DirichletBC(Z.sub(0), 0, "on_boundary"), DirichletBC(Z.sub(1), 400, "on_boundary")]
solve(F == 0, z, bcs=bcs) I think the bcs won't work properly since Firedrake won't correctly identify the columns in the operator that match up with the boundary rows. See #197 |
Beta Was this translation helpful? Give feedback.
-
Your first issue is that you are assuming i, j = indices(2)
F_u = -(inner(u_diff, v) + grad(v)[i] * K[i,j] * grad(p)[j] + dot(v, f))*dx This uses Einstein summation to represent the two contractions in your maths. The issue with Incidentally, another issue in your maths is that |
Beta Was this translation helpful? Give feedback.
-
Hello. I am trying to solve the following PDEs representing volume and force balance in a porous medium.
where$\mathbf{u}$ is the vector valued displacement and and $P$ is the pressure while $\mathbf{K}$ is permeability tensor and $\mathbf{\sigma}= \mu (\nabla \mathbf{u} + (\nabla \mathbf{u})^T) + \lambda (\nabla \cdot \mathbf{u}) \mathbf{I}$ is the solid stress term. It is given that $u=0$ and $P=400$ on the boundary $\partial\Omega$ . Using scalar test functions $\phi$ and $\psi$ vanishing on the boundary, we obtain the following weak forms:
I am trying to set up this problem on Firedrake with simplest case possible with$K = \mathbf{I}$ and $f=1$ . Assuming the weak form is correct and I am not missing anything, I set up the problem as follows. I am new to Firedrake and Fenics, my understanding is that solution vector $\mathbf{u}$ and the scalar test function $\phi$ should use the same \textit{VectorFunctionSpace} object but this naturally gives me "Shapes do not match:" error in the variational form from the line I define the variational form $F_u$a as well as $F_p$ . Should I somehow pull these test functions from something like Q = FunctionSpace(mesh,"CG",degree=1)? Here is my code. I highly appreciate any kind of insight:
Beta Was this translation helpful? Give feedback.
All reactions