Re: [Libmesh-users] IO runtime error

2016-08-20 Thread Roy Stogner


On Sat, 20 Aug 2016, Rossi, Simone wrote:


I’m experiencing a runtime error when export the equation systems if
I use more than one EquationSystems with different variables in each
system.


Hmm.. this needs to be better documented and better enforced with
assertions, but: any given Mesh object can only be used to construct
*one* EquationSystems object.  You should put all your different
System objects which live on the same mesh into the same
EquationSystems.  If there's some reason you can't do that then you
should make a copy of the Mesh and use the second Mesh for the second
EquationSystems.
---
Roy--
___
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users


[Libmesh-users] IO runtime error

2016-08-19 Thread Rossi, Simone
Hello,
I’m experiencing a runtime error when export the equation systems if I use more 
than one EquationSystems with different variables in each system.
In particular, I created 2 EquationSystems: systems1 with one P1 variable and 
systems2  with two P1 variables. After initializing, I write the 
EquationSystems on two separate exodus files
and here it breaks at runtime.
If I initialize the systems with the same number of variables , everything 
works fine.
Do you have any suggestions?
I attaching the output error and the simple code I used.
Thanks,
Simone

// Output

Creating Systems1:
Initializing s1
Creating Systems2:
Initializing s2
Exporting s1
[0]PETSC ERROR: 

[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably 
memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see 
http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to 
find memory corruption errors
[0]PETSC ERROR: likely location of problem given in stack below
[0]PETSC ERROR: -  Stack Frames 

[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
[0]PETSC ERROR:   INSTEAD the line number of the start of the function
[0]PETSC ERROR:   is given.
[0]PETSC ERROR: - Error Message 
--
[0]PETSC ERROR: Signal received
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for 
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.7.2, Jun, 05, 2016
[0]PETSC ERROR: ./test_libmesh_example on a linux-opt named aorta by srossi Fri 
Aug 19 22:48:40 2016
[0]PETSC ERROR: Configure options 
--prefix=/not_backed_up/srossi/TPL/petsc/3.7.2 --PETSC_ARCH=linux-opt 
--with-default-arch=0 --with-c++-support --with-hypre=1 --download-hypre=1 
--with-x=0
[0]PETSC ERROR: #1 User provided function() line 0 in  unknown file



// main.cpp

#include "libmesh/libmesh.h"
#include "libmesh/mesh.h"
#include "libmesh/mesh_generation.h"
#include "libmesh/equation_systems.h"
#include "libmesh/explicit_system.h"
#include "libmesh/exodusII_io.h"

int main (int argc, char ** argv)
{
   using namespace libMesh;
LibMeshInit init (argc, argv);
Mesh mesh(init.comm());
std::cout << "Creating Mesh ..." << std::endl;
MeshTools::Generation::build_cube (mesh,
  2 , 2 , 2,
  0., 1.,
  0., 1.,
  0., 1.,
  TET4);

   std::cout << "Creating Systems1: " << std::endl;
   EquationSystems systems1(mesh);
   ExplicitSystem& s1 = systems1.add_system("s1");
   s1.add_variable("s1", FIRST);
   std::cout << "Initializing s1" << std::endl;
   systems1.init();

   std::cout << "Creating Systems2: " << std::endl;
   EquationSystems systems2(mesh);
   ExplicitSystem& s2 = systems2.add_system("s2");
   s2.add_variable("s2a", FIRST);
   s2.add_variable("s2b", FIRST); // Commenting this line below it runs ok
   std::cout << "Initializing s2" << std::endl;
   systems2.init();

   std::cout << "Exporting s1" << std::endl;
   ExodusII_IO(systems1.get_mesh()).write_equation_systems("s1.e", systems1);
   std::cout << "Exporting s2" << std::endl;
   ExodusII_IO(systems2.get_mesh()).write_equation_systems("s2.e", systems2);

   return 0;
}

--
___
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users