On Fri, Feb 8, 2013 at 10:17 AM, Jens Lohne Eftang <[email protected]>wrote:
> > I need to writing transient solutions into files and read them back later
> > (not for plotting). It seems I can access transient solutions at each
> time
> > step by current_local_solution, which is NumericVector type. I wonder if
> > there are some functions that deal with reading/writing NumericVector.
> >
> > K. Lee.
> Hi K.
>
> One way that's convenient is to add all the vectors that you wish to
> write out to a System using System::add_vector(), and then write out the
> EquationsSystems::write() with the WRITE_ADDITIONAL_DATA flag.
>
> Then you can just read them back into another System later ...
>
> Jens
>
Thanks for the tip, Jens. I managed to writing/reading as follows:
In the lift system:
lift_system.solve();
// save the solution into a file
lift_system.add_vector("lift_function");
lift_system.get_vector("lift_function") = *(lift_system.solution);
equation_systems.write("lift_data.dat", WRITE,
EquationSystems::WRITE_DATA | EquationSystems::WRITE_ADDITIONAL_DATA);
In the RB system:
equation_systems.init ();
// read lift function
equation_systems.read("../lift_model/lift_data.dat", READ,
EquationSystems::READ_DATA | EquationSystems::READ_ADDITIONAL_DATA);
I found the caveat here is we need to make sure both systems have the same
system names.
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users