On Tuesday September 28 2010 09:39:57 Marie Rognes wrote: > On 28. sep. 2010 18:18, Johan Hake wrote: > > On Tuesday September 28 2010 09:08:01 Marie Rognes wrote: > >> On 28. sep. 2010 17:16, Johan Hake wrote: > >>> 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 > >> > >> So, you want a simpler way of doing it, but not a really simple way of > >> doing it ;) ? > > > > The point is that the flux quantity is nice to have computed, as I use it > > for further computation. The above form works fine. > > Ok. > > >> I don't think I have any more suggestions at the moment -- could you > >> remind me why the integration is a problem again? Or, what would you > >> like to write? > > > > No problem. Just overkill (I assume...). I am calculating a scalar > > quantity (r0) from other scalar quantities (r1, r2) using a form. But > > the only way I can use a form to evaluate these are by an integral. An > > integral is over a spatial domain. r0, r1 and r2 are just values on R > > not on the domain. > > The are functions on the domain. Just constant ones: > > r0 : domain -> R > > defined by > > r0(x) = r_0 > > for all x in domain, for some value r_0 \in R.
Ok. > > Why > > should I then have to integrate over the domain to calculate r0? > > You need one equation to determine r_0, in particular an integral over > some part of the domain will do. Yes, and this is what I do. It just seemed pointless when everything is constant over the domain. > > Because nothing else is implemented in UFL/UFC/DOLFIN. I am fine with > > this, but it is a unintutive and it might be usefull to introduce some > > other measure for these guys. > > Introducing forms that are not defined using integrals sounds like it > deserves its own thread. Ok. But it is a minor request which probably cost more than it taste. Johan > >>> 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. > >> > >> Sounds like a bit of an overhead there, yes ... > > > > Yes and the ODE solver can probably not be used to solve particular stiff > > ODEs. BUT, and here comes the raisin in the hot dog, it can be included > > in the automated linearization so you can get quadratic convergence in a > > coupled ODE/PDE system. > : > :) > > -- > Marie _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

