I found the example adaptivity_ex2 which uses these I/O functions and I can read the file, however I've run into another problem. After reading the EquationSystems, I try to use EquationSystems::get_system() for my FEMSystem derived class TopOptSystem, and this is where I get an error because it cannot recognize such System. What I have ended up doing is deleting the TopOptSystem before writing EquationSystems. I don't really mind having that or not. Then before reading the EquationSystems file, I add the TopOptSystem so I can continue with my simulation. Is there a more elegant solution?
Miguel Placing EquationSystems::init() below read() didn't work because I got this assertion error Assertion `var < this->n_vars(s)' failed. var = 0 this->n_vars(s) = 0 [New LWP 21292] [Thread debugging using libthread_db enabled] 0x00002aaabc37869d in __libc_waitpid (pid=<value optimized out>, stat_loc=<value optimized out>, options=<value optimized out>) at ../sysdeps/unix/sysv/linux/waitpid.c:41 41 int result = INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL); #0 0x00002aaabc37869d in __libc_waitpid (pid=<value optimized out>, stat_loc=<value optimized out>, options=<value optimized out>) at ../sysdeps/unix/sysv/linux/waitpid.c:41 #1 0x00002aaabc30a609 in do_system (line=<value optimized out>) at ../sysdeps/posix/system.c:149 #2 0x00002aaabc30a940 in __libc_system (line=<value optimized out>) at ../sysdeps/posix/system.c:190 #3 0x00002aaaad083057 in (anonymous namespace)::gdb_backtrace (out_stream=...) at src/base/print_trace.C:145 #4 0x00002aaaad082799 in libMesh::print_trace (out_stream=...) at src/base/print_trace.C:192 #5 0x00002aaaad07db66 in libMesh::MacroFunctions::report_error (file=0x2aaaae30a184 "./include/libmesh/dof_object.h", line=771, date=0x2aaaae309d18 "Nov 9 2015", time=0x2aaaae309d0c "16:31:53") at src/base/libmesh_common.C:82 #6 0x00002aaaacfd340a in libMesh::DofObject::n_comp (this=0x859628, s=0, var=0) at ./include/libmesh/dof_object.h:771 #7 0x00002aaaadc32836 in libMesh::System::read_parallel_data (this=0x85a620, io=..., read_additional_data=true) at src/systems/system_io.C:582 #8 0x00002aaaadbc000d in libMesh::EquationSystems::_read_impl(const std::string &, enum libMesh::XdrMODE, unsigned int, bool) (this=0x7fffffffc160, name="./EQ_output.xda", mode=libMesh::READ, read_flags=22, partition_agnostic=true) at src/systems/equation_systems_io.C:359 #9 0x00002aaaadbbead8 in libMesh::EquationSystems::read(const std::string &, enum libMesh::XdrMODE, unsigned int, bool) (this=0x7fffffffc160, name="./EQ_output.xda", mode=libMesh::READ, read_flags=6, partition_agnostic=true) at src/systems/equation_systems_io.C:123 #10 0x00000000004c9134 in libMesh::EquationSystems::read (this=0x7fffffffc160, name="./EQ_output.xda", mode=libMesh::READ, read_flags=6, partition_agnostic=true) at /g/g92/miguel/code/libmesh_install_miguel/include/libmesh/equation_systems.h:339 #11 0x00000000004a7ac8 in main (argc=7, argv=0x7fffffffd7f8) at vector_fe_ex1.C:790 [0] ./include/libmesh/dof_object.h, line 771, compiled Nov 9 2015 at 16:31:53 Which is right above the previous assertion error I was getting. So I figured I would need EquationSystems:: READ_HEADER which makes EquationSystems::read() call init(). That made me go back to the previous assertion error. Is there any example that uses these routines? I must be making some mistake in the way I call the routines. Miguel On Nov 17, 2015 10:38, "Roy Stogner" <royst...@ices.utexas.edu> wrote: > > On Tue, 17 Nov 2015, Miguel Angel Salazar de Troya wrote: > > What's the difference between .xda and .xdr? >> > > ASCII vs (platform-independent) binary. xdr files are smaller (unless > you use xda.gz or xda.bz2), xda files are easier to debug. I like > using xda.gz myself; bz2 conversions aren't done in-stream and are > costly; xdr works great 99% of the time, right up until you have a bug > so confusing that you want to look at restart files directly. > > Last time I pulled libmesh was a couple months ago. >> > > That should have been sufficient; > https://github.com/libMesh/libmesh/pull/618 was merged on Aug 7. > > I'm going to fetch and try again. Before that, leaving just >> EquationSystems::READ_DATA and write and reading the file as >> "eq_output.xda" in the argument still gives me the same error. >> > > Hmm... I wonder if you've got the application init-then-read bug that > we test for as of https://github.com/libMesh/libmesh/pull/689 last > month? > > I've also realized that EquationSystems::write() doesn't record the >> mesh information, does it? >> > > No. If you don't modify the mesh in between restarts then you don't > want to bother writing out redundant copies of it. > > That means we should be careful the mesh matches the mesh we called >> EquationSystems::write() with. >> > > Definitely! This could also manifest as the bug you reported. > > Is there anyway to load all this information? >> > > mesh.write("my_mesh.xda.gz"); > es.write("my_soln.xda.gz", WRITE_DATA | WRITE_ADDITIONAL_DATA); > > For instance, I can record all this information with an ExodusII_IO >> object for plotting purposes. Can I load it and use it in my mesh >> and EquationSystems? >> > > Not safely in general. ExodusII doesn't store the mesh hierarchy, it > "flattens" the mesh by only outputting active elements. Try to read > that in again and you get a torn mesh at hanging nodes; add a solution > on top and you get scrambled garbage. > > If you're not using any adaptivity or non-lagrange FEs, then I believe > we support reading meshes and solutions (via some API in ExodusII_IO, > I think? I don't use this myself) from ExodusII. > --- > Roy > ------------------------------------------------------------------------------ Give your users amazing mobile app experiences with Intel XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2-D/3-D games for multiple OSs. Then get your creation into app stores sooner, with many ways to monetize. http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140 _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users