On Thu, 23 Jan 2014 08:53:13 -0800 Nikolaus Rath <[email protected]> wrote:
> On 01/23/2014 04:19 AM, Jan Blechta wrote: > > On Wed, 22 Jan 2014 11:39:30 -0800 > > Nikolaus Rath <[email protected]> wrote: > > > >> Hi Jan, > >> > >> It was my impression from the other thread that I could handle the > >> problem of multiple solutions by giving the nullspace to the > >> solver. But I'll try the Laplace constraint as well. > >> > >> But then, even with u constrained, I still need to somehow put the > >> same constraint on the test functions, don't I? That's the part I'm > >> struggling with. > > > > Sure. This is why it seems logical to me to constraint both trial > > and test space by Laplace equation. Nevertheless I did not think it > > over a much. > > > For what it's worth, it seems logical to me as well... I just don't > know how to impose the second constraint. Check http://fenicsproject.org/documentation/dolfin/1.3.0/python/demo/documented/neumann-poisson/python/documentation.html Testing by (v, 0) and (v + c, 0) gives linearly dependent equations - in fact, the same. Similar construction can apply to your problem. Jan > > So, if anyone could give me a hint or point me to a demo that shows > how to constrain test functions, I'd be very happy. > > > Best, > Nikolaus > > > > >> On 01/22/2014 11:22 AM, Jan Blechta wrote: > >>> Actually there is a very good reason to constraint also u, say by > >>> Laplace equation in the interior, as your original problem is > >>> singular on a usual H^1 space - there are infinintely many > >>> solutions to the problem. So you need to pick some. > >>> > >>> Jan > >>> ------------------------------------------------------------------------ > >>> From: Nikolaus Rath <mailto:[email protected]> > >>> Sent: 22/01/2014 19:27 > >>> To: Jan Blechta <mailto:[email protected]> > >>> Cc: [email protected] <mailto:[email protected]> > >>> Subject: Re: [FEniCS] How to impose constraints on test functions? > >>> > >>> On 01/21/2014 01:57 AM, Jan Blechta wrote: > >>>>>>>> However, I am still struggling to combine the finite element > >>>>>>>> method with Lagrange multipliers. I think I have a good > >>>>>>>> handle on Lagrange multipliers for constrained optimization > >>>>>>>> of a scalar function or integral, but I fail to transfer > >>>>>>>> this to FE. > >>>>>>> > >>>>>>> Ok, potential for Poisson problem is > >>>>>>> > >>>>>>> \Psi(u) = 1/2 \int |\nabla u|^2 - L(u) > >>>>>> > >>>>>> Ah, the potential is the starting point. Thanks! > >>>>>> > >>>>>>> So if you want to minimize \Psi on V = H^1(\Omega) subject to > >>>>>>> constraint \int u = 0, you do can try to find a minimum (u, c) > >>>>>>> \in (V \times R) of > >>>>>>> > >>>>>>> \Psi(u) - c \int u > >>>>>>> > >>>>>> > >>>>>> My apologies if I'm slow, but why would I want to find a > >>>>>> minimum (u,c) \in (V * R)? It seems to me that I don't want to > >>>>>> find a specific value c -- I want a minimum u \in V \forall c. > >>>>> > >>>>> Nevermind that question. Since c is the Lagrange multiplier of > >>>>> course we need to solve for it. I got confused because I didn't > >>>>> see any additional constraint equations being used to actually > >>>>> determine the value. But that is just because of the special > >>>>> case \int u = 0, correct? > >>>>> > >>>>> For the more general case \int u = u0, am I right that we'd need > >>>>> to set up an extra term in the linear form? > >>>>> > >>>>> (u, c) = TrialFunction(W) > >>>>> (v, d) = TestFunctions(W) > >>>>> g = Expression("-sin(5*x[0])") > >>>>> a = (inner(grad(u), grad(v)) + c*v + u*d)*dx > >>>>> L = g*v*ds + Constant(u0) * d * dx > >>>> > >>>> Correct. > >>> > >>> Ah, good :-). Thanks! > >>> > >>> > >>> Could you also give me a similar hint for my original problem? > >>> > >>> To recap: I want to find u on the boundary such that with > >>> > >>> L = dot(f, grad(v)) * dx > >>> a = u * dot(grad(v), FacetNormal(mesh)) * ds > >>> > >>> L(v) == a(u, v) holds for all v that satisfy div(grad(v)) = 0 > >>> (without any boundary conditions on v). > >>> > >>> > >>> I tried to start setting up the potential problem: > >>> > >>> \Psi(u) = 1/2 a(u,u) - L(u) > >>> > >>> but in contrast to the Poisson-Neumann example, now the constraint > >>> isn't on the solution u but on the test functions v, so I'm not > >>> sure how I can add the Lagrange multiplier here... As far as I can > >>> see, there's no reason to constrain the variation of u to satisfy > >>> Laplace's equation when looking for a stationary point of \Psi. > >>> > >>> What am I missing this time? > >>> > >>> > >>> Thanks so much for all your help! > >>> Nikolaus > >> > >> > > > > _______________________________________________ fenics mailing list [email protected] http://fenicsproject.org/mailman/listinfo/fenics
