On Tuesday September 28 2010 04:46:30 Marie Rognes wrote: > On 25. sep. 2010 22:02, Johan Hake wrote: > > On Saturday September 25 2010 00:24:12 Marie E. Rognes wrote: > >> On 25. sep. 2010, at 02:37, Johan Hake <[email protected]> wrote: > >>> Hello! > >>> > >>> I have been experimenting with forms including spaces of Real. I am > >>> using the Real space to calculate average values of other species > >>> across the boundaries. These values are then used to cacluate derived > >>> values such as fluxes across a boundary. In this way I manage to > >>> connect two sepatated meshes (stored in the same mesh) via the > >>> calculated flux. As everything is contained in one form I can > >>> linearize it an use it in a Newton solver, which converges nicely. > >>> > >>> In this procedure I have used unknowns of Reals to caluclate other > >>> Reals. This is somewhat combersome when I have to express this using > >>> an integral. > >>> > >>> Consider: > >>> V = MixedFunctionSpace([FunctionSpace(mesh, "CG", 1)]+ > >>> > >>> [FunctionSpace(mesh, "R", 0)]*3) > >>> > >>> u, r0, r1, r2 = split(Function(V)) > >>> v, v0, v1, v2 = TestFunctions(V) > >>> ... > >>> L0 = (r0-(r2-r1))*v0*ds(1) > >>> > >>> Here I express r0 in terms of r1 and r2. However in the form I need to > >>> integrate the expression over an arbitrary domain in the mesh. I am not > >>> interested in this, as the value is not spatialy varying. Do you have > >>> any suggestions of how to avoid this or to do it in some other manner? > >> > >> It is not entirely clear to me which values that are unknown above, but > >> if everything is known or you are just operating on real numbers, I > >> imagine that extracting the value of the Function using values() could > >> be simpler? > > > > r0, r1, and r2 are unknowns together with the field u. r1 and r2 are the > > mean of the field across a boundary, and r0 are the flux between the two > > distinct domains. > > > > A more complete form would be: > > # Boundary forms > > L1 = (r1-u)/area[1]*v1*ds(1) > > L2 = (r2-u)/area[2]*v2*ds(2) > > L0 = (r0-(r2-r1))*v0*ds(1) > > Lu = r0*v*ds(1) - r0*v*ds(2) > > > > # Stiffnes + Boundary > > L = inner(grad(u),grad(v))*dx + L0 + L1 + L2 + Lu > > > > My question relates to the algebraic relation of the reals in: > > L0 = (r0-(r2-r1))*v0*ds(1) > > > > which really does not need an integral. > > Do you really want: > > r0 = (r2 - r1)
Yes. > If yes, why not replace r0 by (r2 - r1)? That is true but I figure I want to compute that value for book keeping :P On a related topic: The Real space can be used to compute ODEs coupled to PDEs by expressing them using a form. I know several applications that this might be usefull. But then we get the same "problem" when a scalar value are computed by integrating over a domain. Johan > > -- > Marie _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

