On Mon, Apr 20, 2015 at 11:32 AM, Zhenyu Zhang <[email protected]> wrote:
> Here I tried to add an if block in init_value(),
> if (boost::iequals(varname, string("p")))
> {
> ... // calculate the return value like before
> }
>
> Then the setting of initial values worked.
>
> Since the above code only work for one variable, does this mean I have to
> call project_solution for all variables in my N-S separately?
>
Your initialization function will generally call System::project_solution()
on the appropriate system, passing a pointer to the function that actually
sets the values for the variables in that system. See, for example,
adaptivity_ex2:
system.project_solution(exact_value, NULL, es.parameters);
In this case, the exact_value() function only has a single variable's value
to set, so it ignores the incoming "varname" parameter string, but in
general you will need to check the incoming varname to determine what value
to return, as you have done above.
So, yes, for multiple variables you do need checks like the one shown
above. I tried to find a libmesh example which demonstrated this,
unfortunately all of our examples seem to either use a zero initial
condition or only have one variable :-(
BTW,Since I used shared_ptr<> for _func in init_value(), is there any
> limits of the maximum in its internal counter?
>
I have no idea, you are kind of on your own as far as using boost stuff is
concerned, I'm afraid. In this particular case, _func goes out of scope at
the end of init_value() though, so that should decrement the ref count.
--
John
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users