Veamy: an extensible object-oriented C++ library for the virtual element method

Features:

Free and open source C++ library that implements the virtual element method. The first release of this library allows the solution of 2D linear elastostatic problems.

  • Includes its own mesher based on the computation of the constrained Voronoi diagram. The meshes can be created in arbitrary domains, with or without holes, with procedurally generated points.
  • Meshes can also be read from OFF-style text files (an example can be found in the test folder).
  • Allows easy input of boundary conditions by constraining domain segments and nodes.
  • The results of the computation can be either written into a file or used directly.
  • PolyMesher meshes and boundary conditions can be read straightforwardly in Veamer to solve 2D linear elastostatic problems.

Author

Catalina Alvarez – Master’s Student, Department of Computer Science, Universidad de Chile / B.Sc. Student, Department of Mechanical Engineering, Universidad de Chile.

Supervisors

Nancy Hitschfeld-Kahler – Associate Professor, Department of Computer Science, Universidad de Chile.

Alejandro Ortiz-Bernardin – Assistant Professor, Department of Mechanical Engineering, Universidad de Chile.

Collaborators

Alessandro Russo – Professor, Department of Mathematics and Applications, Università degli Studi di Milano-Bicocca.

Rodrigo Silva-Valenzuela – Master’s student, Department of Mechanical Engineering, Universidad de Chile.

Edgardo Olate-Sanzana – Master’s student, Department of Mechanical Engineering, Universidad de Chile.

Installation

For Linux:

  • Download the source code and unpack it.
  • Download Triangle, and obtain the callable triangle.o object. Follow the documentation and use:
     make trilibrary 
  • Move the file to the triangle folder inside the lib/mesher folder.
  • Once in the directory of the library, create the build folder.
  • Inside the build folder:
    cmake ..
    make

For Windows:

  1. Install Cmake for Windows and MinGW/Cygwin.
  2. Download the source code and unpack it.
  3. Download Triangle, and obtain the callable triangle.o object. There are various ways to do this, but the recommended one is to use MinGW (32 or 64 depending on your system), and use the mingw-gcc executable:
     mingw-gcc -O -DNO_TIMER -DTRILIBRARY -c -o triangle.o triangle.c 
  4. Move the file to the triangle folder inside the lib/mesher folder.
  5. Once in the directory of the library, create the build folder.
  6. Inside the build folder, using the Command Line:
    cmake -G "MinGW MakeFiles" ..
    mingw32-make

Usage example

The complete procedure to compute the displacements using Virtual Element Method requires:

  1. If using the included mesher: create the domain and the input points, and then call the meshing procedure:
    std::vector points = {Point(0,0), Point(1,0), Point(1,1), Point(0,1)};
    Region region(points); 
    region.generateSeedPoints(PointGenerator(functions::random_double(), functions::random_double()), 10, 10);
    TriangleMeshGenerator generator (region.getSeedPoints(), region);
    PolygonalMesh mesh = generator.getMesh();
    mesh.printInFile("mesh.txt");
  2. Create a boundary conditions container and fill it as desired:
    EssentialConstraints e; NaturalConstraints n;
    PointSegment leftSide (Point(0,0), Point(0,1));
    Constraint leftConstraint (leftSide, mesh.getPoints(), Constraint::Direction::Total, new Constant(0));
    PointSegment rightSide (Point(1,0), Point(1,1));
    Constraint rightConstraint (rightSide, mesh.getPoints(), Constraint::Direction::Horizontal, new Constant(1000));
    e.addConstraint(leftConstraint, mesh.getPoints());
    n.addConstraint(rightConstraint, m.getPoints());
    ConstraintsContainer container;
    container.addConstraints(e, mesh);
    container.addConstraints(n, mesh);
  3. Create the problem conditions container, assigning the domain material properties, the body forces if needed, and the boundary conditions:
    ProblemConditions conditions(container, Material(Materials::material::Steel));
  4. Create a Veamer instance and initialize the numerical problem:
    Veamer veamer;
    veamer.initProblem(mesh, conditions);
  5. Compute the displacements:
    Eigen::VectorXd displacements = veamer.simulate(m);
  6. If required, print the obtained displacements to a text file:
    veamer.writeDisplacements("displacements.txt", displacements);
  7. The results can be plotted using the Matlab function plotPolyMeshDisplacements:
    [points,polygons,displacements] = plotPolyMeshDisplacements('mesh.txt','displacements.txt','$u_x^h$','$u_y^h$','$||u^h||$');

This example and some others can be found as part of a C++ test file in ‘test’ folder of Veamy’s source code.

Using PolyMesher

  1. Add the Matlab function PolyMesher2Veamy to the PolyMesher source code and use it to create the text file named “polymesher2veamy.txt” that contains the polygonal mesh and boundary conditions created in PolyMesher. This text file is readable by Veamy’s function “initProblemFromFile.”
  2. Compile and run the following main C++ file of Veamy (update material parameters if desired):
    int main(){
     Veamer v;
     Material m(1e7, 0.3); // Young's modulus and Poisson's ratio
     PolygonalMesh mesh = v.initProblemFromFile("polymesher2veamy.txt", m);
     mesh.printInFile("mesh.txt");
     Eigen::VectorXd x = v.simulate(mesh);
     std::string fileName = "displacements.txt";
     v.writeDisplacements(fileName, x);
    }
  3. The results can be plotted using the Matlab function plotPolyMeshDisplacements:
    [points,polygons,displacements] = plotPolyMeshDisplacements('mesh.txt','displacements.txt','$u_x^h$','$u_y^h$','$||u^h||$');

This example and some others can be found as part of a C++ test file in ‘test’ folder of Veamy’s source code.

Acknowledgements

Veamy depends on three external open source libraries, whose code is included in the repository.

Linear algebra aspects are handled using:

License

This project is licensed under the GPL License. This program is free software; it can be redistributed or modified under the terms of the GNU General Public License as published by the Free Software Foundation.

Citing Veamy 

If you use Veamy in a publication, please include an acknowledgement by citing Veamy as follows:

A. Ortiz-Bernardin, C. Alvarez, N. Hitschfeld-Kahler, A. Russo, R. Silva, E. Olate-Sanzana. Veamy: an extensible object-oriented C++ library for the virtual element method. arXiv:1708.03438 [cs.MS]

Download 

Latest stable version of Veamy

Any version of Veamy + browsing the source code from GitHub


web statistic
web statistic
Since August 10, 2017

Recent News

All news

Recent Publications

All publications