assemble matrix in stokes problem, projection vrs assemble

Asked by Daniel Bare

I am implementing the Uzawa algorithm for a Stokes Problem therefore I need 3 matrices A, BT, B:

# Define function spaces
V = VectorFunctionSpace(mesh, "CG", 2)
Q = FunctionSpace(mesh, "CG", 1)

u = TrialFunction(V)
v = TestFunction(V)
p = TrialFunction(Q)
q = TestFunction(Q)

A=assemble(inner(grad(u), grad(v))*dx)
BT=assemble(inner(v,grad(p))*dx)
B=assemble(-q*(div(u))*dx)

A, BT work well, but B should be BT transposed, and it isnt. B is wrong. But when B is assembled implicitely in each iteration step with a given velocity u_current as project(-div(u_current ),Q) everything is fine.

The same thing with assemble doesn't work either assemble(-q*(div(u_current))*dx) . But this assemble is a projection to Q with the scalar product (q,-div(u_current)=assemble(-q*(div(u_current))*dx) ? What is wrong with assemble? Why does project() work?

thanks,

Daniel

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Kent-Andre Mardal (kent-and) said :
#1

On 12 June 2012 22:01, Daniel Bare <email address hidden>wrote:

> New question #200237 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/200237
>
>
> I am implementing the Uzawa algorithm for a Stokes Problem therefore I
> need 3 matrices A, BT, B:
>
> # Define function spaces
> V = VectorFunctionSpace(mesh, "CG", 2)
> Q = FunctionSpace(mesh, "CG", 1)
>
> u = TrialFunction(V)
> v = TestFunction(V)
> p = TrialFunction(Q)
> q = TestFunction(Q)
>
> A=assemble(inner(grad(u), grad(v))*dx)
> BT=assemble(inner(v,grad(p))*dx)
> B=assemble(-q*(div(u))*dx)
>
> A, BT work well, but B should be BT transposed, and it isnt. B is wrong.

Whether B is BT transposed or not depends on the boundary conditions.

Notice that matrices in Dolfin have transposed vector product, so you can
use this method (transpmult)

Notice also that e.g. the stokes-iterative demo (or corresponding demos in
cbc.block) will give you better algorithms
than Uzawa.

Kent

> But when B is assembled implicitely in each iteration step with a given
> velocity u_current as project(-div(u_current ),Q) everything is fine.
>
> The same thing with assemble doesn't work either
> assemble(-q*(div(u_current))*dx) . But this assemble is a projection to Q
> with the scalar product (q,-div(u_current)=assemble(-q*(div(u_current))*dx)
> ? What is wrong with assemble? Why does project() work?
>
> thanks,
>
> Daniel
>
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>

Can you help with this problem?

Provide an answer of your own, or ask Daniel Bare for more information if necessary.

To post a message you must log in.