← Back to team overview

dolfin team mailing list archive

Re: recompute& evaluate a function/vector

 

On Fri, Mar 13, 2009 at 07:48:39PM +0100, Patrick Riesen wrote:
> Patrick Riesen wrote:
> > Anders Logg wrote:
> >> On Wed, Mar 11, 2009 at 10:21:52AM +0100, Patrick Riesen wrote:
> >>>> hello
> >>>>
> >>>> So my Etafunction is now being correctly constructed and there are the 
> >>>> correct values in the dof-vector(). i did this by a function class 
> >>>> definition and a call to Eta as
> >>>>
> >>>>
> >>>> class Eta: public Function
> >>>> {
> >>>>    Eta (Mesh& mesh, Function& gamma, Form& form, ...) : Function(mesh, 
> >>>> form, argument_id)
> >>>> { constructor....something as above }
> >>>>
> >>>> and then i call it as
> >>>>
> >>>> f_eta = new Eta(.....);
> >>>>
> >>>> in the main program.
> >>>>
> >>>> calling Eta as Function(mesh,form,id) i thought this should create a 
> >>>> discrete function for f_eta, but the type of the f_eta function is 
> >>>> 'user'. this gives me an error at the assembly, "missing eval() for 
> >>>> user-defined function..."
> >>>> do i have to add an dummy eval() function to my Eta-class, or what do i 
> >>>> have to change that no eva()-missing error is raised and my f_eta 
> >>>> function is of type discrete?
> >>>>
> >>>> thanks for your help,
> >>>> patrick
> >>>>
> >>> sorry, i found an error, now the Eta is of type discrete (all 3 argument 
> >>> functions of my form are now discrete). but the eval() error at assembly 
> >>> of the form is still present.
> >> Have you called vector() inside the constructor of Eta? That should
> >> make it discrete and the assembler should not complain. Perhaps there
> >> is some other function in you form that is missing an eval (or a
> >> vector).
> >>
> >   hi anders,
> > yes i did that, and now i found the error fortunately. i did not 
> > initialize the bilinear form correctly with some placeholder function 
> > for Eta. now the assembly is working, so i can go on.
> > 
> > thank you & regards,
> > patrick
> 
> hi all
> my code is now running but the Eta-funcs still give me some problems. i 
> have initialized my bilinear/linear form with two constant functions as
> 
> f_eta = new Function(mesh, 1.)
> f_Deta = new Function(mesh, 1.)

Are you using an old version? This doesn't work with the current
interface.

> the first newton iteration gives me a newtonian solution from which i 
> take the velocity to compute the invariant in another form (gamma) and 
> then i construct the discussed functions Eta, DEta, and renew f_eta, 
> f_Deta as
> 
> f_eta = new Eta(gamma,.....)
> f_Deta = new DEta(gamma,......)
> 
> 
> so i guess in the second iteration it will assemble with a variable 
> viscosity as f_eta, f_Deta are different now but it just converges to 
> the newtonian solution.
> 
> is this a problem, that i constructed the forms with a constant 
> function? does dolfin then not consider the values in the vector() of 
> the new discrete functions for f_eta, f_Deta after renewing?

Yes, if you construct your form with some Function, then that Function
will be used. The form won't change just because you create a new
Function later.

-- 
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References