Re: [firedrake] Enforcing slip boundary condition strongly
Hi Colin, That does not appear to be what Justin is asking for. He is asking how to set a Dirichlet condition on one component of a VectorFunctionSpace. I'm not sure we can do that right now, but I think this should be fixable. I want to check what the Dolfin syntax for this is (so we maintain compatibility) and then try to fix it. (Of course someone might want to pleasantly surprise me and tell me we can do this already!) David On Fri, 10 Jul 2015 at 10:14 Cotter, Colin J <colin.cotter@imperial.ac.uk> wrote:
Hi Justin, Just to be clear, are you talking about enforcing normal component of the vector RT0 quantity to be zero?
all the best --cjc
On 9 July 2015 at 21:28, Justin Chang <jychang48@gmail.com> wrote:
Hi everyone,
I am solving a mixed poisson (aka: Darcy) problem using the VMS formalism (Masud and Hughes, CMAME, 2002) which enables one to use equal order lagrangian interpolation. In this formulation, the flux/velocity is prescribed strongly and the pressure is prescribed weakly, like how it's done with RT0 elements.
The main difference is that velocity is now a VectorFunctionSpace as opposed to a FunctionSpace. My question is, how would I implement the flux boundary condition in a Dirichlet sense? Say I am working with a unit square for now. I want to enforce v_x = some value(s) for x=0/x=1, and v_y - some values(s) for y = 0/y = 1. How would this be done in Firedrake?
Thanks, Justin
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-- http://www.imperial.ac.uk/people/colin.cotter
www.cambridge.org/9781107663916
On 10 Jul 2015, at 10:25, David Ham <David.Ham@imperial.ac.uk> wrote:
Hi Colin,
That does not appear to be what Justin is asking for. He is asking how to set a Dirichlet condition on one component of a VectorFunctionSpace. I'm not sure we can do that right now, but I think this should be fixable. I want to check what the Dolfin syntax for this is (so we maintain compatibility) and then try to fix it. (Of course someone might want to pleasantly surprise me and tell me we can do this already!)
We can't do it at the moment, the rest of this email explains why and sketches a possible solution. OK, so there are two aspects to this, which make things somewhat tricky. Our data model for indexing vector fields is that we store the Map to the node and stack the dofs on top. To apply such slip BCs, where we only set one of the two dofs, we need to do the following: - Apply the BC value to the appropriate part of the vector. I think this is reasonably straightforward and appear to have something that works. - Fix up the operator appropriately. This latter option is trickier. The way we currently do this is to drop boundary conditions on the floor when assembling the operator. This is done by flagging the appropriate rows/columns to be dropped by putting a negative value in the Map at the appropriate place and letting PETSc do the rest. For vector-valued fields we do block insertion, i.e. we insert a 2x2 block at each location in the matrix indexed by the base map. So the current setup can only drop complete blocks, rather than part of one (as required in this case). The question is, then, how to communicate the relevant bit of information into the code that inserts. How about this: When we splat the values in the Map we convert: val => -(val + 1) If we're apply the BC on part of the map we decorate it with the index offset. We then build a local (unrolled map) and fix up the entries. The negative offset encoding allows us to recover the correct value. So assembly turns from: A = build_element_tensor(...); MatSetValuesBlockedLocal(block_rows, block_cols, A); Into: A = build_element_tensor(...); { PetscInt rows[arity*dim]; PetscInt cols[arity*dim]; // Assume we're setting the bc on the second component. for ( i = 0; i < arity; i++ ) { if (row_map[i] < 0) { rows[i*dim + 0] = dim*(-(row_map[i] + 1)); rows[i*dim + 1] = -1; } else { rows[i*dim + 0] = dim*row_map[i]; rows[i*dim + 1] = dim*row_map[i] + 1; } } // Same for cols MatSetValuesLocal(rows, cols, A); } All the other options I came up with seem more complicated. Lawrence
Justin is wanting to enforce the flux condition, he said. That's the normal component. --cjc On 10 July 2015 at 10:25, David Ham <David.Ham@imperial.ac.uk> wrote:
Hi Colin,
That does not appear to be what Justin is asking for. He is asking how to set a Dirichlet condition on one component of a VectorFunctionSpace. I'm not sure we can do that right now, but I think this should be fixable. I want to check what the Dolfin syntax for this is (so we maintain compatibility) and then try to fix it. (Of course someone might want to pleasantly surprise me and tell me we can do this already!)
David
On Fri, 10 Jul 2015 at 10:14 Cotter, Colin J <colin.cotter@imperial.ac.uk> wrote:
Hi Justin, Just to be clear, are you talking about enforcing normal component of the vector RT0 quantity to be zero?
all the best --cjc
On 9 July 2015 at 21:28, Justin Chang <jychang48@gmail.com> wrote:
Hi everyone,
I am solving a mixed poisson (aka: Darcy) problem using the VMS formalism (Masud and Hughes, CMAME, 2002) which enables one to use equal order lagrangian interpolation. In this formulation, the flux/velocity is prescribed strongly and the pressure is prescribed weakly, like how it's done with RT0 elements.
The main difference is that velocity is now a VectorFunctionSpace as opposed to a FunctionSpace. My question is, how would I implement the flux boundary condition in a Dirichlet sense? Say I am working with a unit square for now. I want to enforce v_x = some value(s) for x=0/x=1, and v_y - some values(s) for y = 0/y = 1. How would this be done in Firedrake?
Thanks, Justin
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-- http://www.imperial.ac.uk/people/colin.cotter
www.cambridge.org/9781107663916
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916
participants (3)
-
Colin Cotter
-
David Ham
-
Lawrence Mitchell