Features:
- Includes its own mesher based on the computation of the constrained Voronoi diagram. The meshes can be created in arbitrary two-dimensional 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: see "EquilibriumPatchTestMain.cpp").
- 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 Veamy to solve 2D linear elastostatic problems.
- Download the source code and unpack it.
- In the root directory of Veamy, create a build/ folder.
- Go to test/ folder located in the root directory of Veamy and: (a) add the main C++ file
(say, mytest.cpp) containing your test example problem, (b) modify the CMakeLists.txt
by changing the file name example.cpp in
set(SOURCE_FILES example.cpp) by the name
of your main C++ file (in this case, mytest.cpp)
- Inside the build/ folder, type and execute in the terminal:
to create the makefiles. And to compile the program type and execute:
cmake ..make - To run your example, go to the build/test/ folder, and in the terminal, type and execute:
./Test
- 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(); - If using an externally generated mesh, for example, from PolyMesher, refer to the next section of this tutorial; for a generic mesh format see "EquilibriumPatchTestMain.cpp" in the test folder.
- 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, mesh.getPoints()); ConstraintsContainer container; container.addConstraints(e, mesh); container.addConstraints(n, mesh); - Create the problem conditions container, assigning the domain material properties, the body forces if needed, and
the boundary conditions:
Material* material = new MaterialPlaneStrain(1e7, 0.3); ProblemConditions conditions(container, material); - Create a Veamer instance and initialize the numerical problem:
Veamer veamer; veamer.initProblem(mesh, conditions); - Compute the displacements:
Eigen::VectorXd displacements = veamer.simulate(mesh); - If required, print the nodal displacements to a text file:
veamer.writeDisplacements(fileName, displacements); - The results can be plotted using the Matlab function plotPolyMeshDisplacements (located in folder /lib/visualization/ ):
[points,polygons,displacements] = plotPolyMeshDisplacements('mesh.txt','displacements.txt','$u_x^h$','$u_y^h$','$||u^h||$');
This and various additional examples are provided in the test/ folder located in the root directory of Veamy.
- Use the Matlab function PolyMesher2Veamy.m included in the polymesher/ folder and use it to generate a Veamy-format file, whose default name is "polymesher2veamy.txt", from PolyMesher.
- Use the previously generated file as parameter of the initProblemFromFile method of the Veamer class. It
requires the definition of the material properties, and, in the case the problem includes them, a body force pointer:
Veamer v; Material* material = new MaterialPlaneStress(1e7, 0.3); PolygonalMesh mesh = v.initProblemFromFile("polymesher2veamy.txt", material); - Proceed exactly as shown from step 6 forward, as boundary conditions are already defined.
This and various additional examples are provided in the test/ folder located in the root directory of Veamy.
Veamy depends on two external open source libraries, whose codes are included in this repository, inside lib folder. Linear algebra aspects are handled using: 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. 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]