This repository contains the code for an open source MATLAB library for the virtual element method.
- Two-dimensional linear elastostatics (plane strain and plane stress) and two-dimensional Poisson problem.
- Solution methods: Linear VEM (polygonal elements), FEM (3-node triangles, 4-node quadrilateral).
- Boundary conditions: Dirichlet, Neumann on boundary edges; can be a constant or a function.
- Meshers: PolyMesher, distmesh2d, quad4mesh; PolyMesher is customized for rectangular domain, wrench domain and plate with a hole domain; distmesh2d and quad4mesh are customized for rectangular domain only. Domains can be extended for any of the meshers, but it requires adjustments to some interface functions (see the instructions that are available in functions create_polygonal_mesh.m, create_quadrilateral_mesh.m and create_triangular_mesh.m in folder “mesher”).
- Meshes need to be generated separately and saved to folder “test/mesh_files”.
- Meshes must be generated with the functions “create_” located in the folder “mesher”. Then, the files containing the generated meshes will be automatically saved to folder “test/mesh_files” for their use.
- Solutions can be plotted to MATLAB figures, text files, GiD files and VTK files.
Segoe UI Semibold: This font must be installed directly in your operating system. In Windows system this is done in Settings-->Fonts or just type "Font settings" in Window's search utility.
Good Times RG: This font must be added to the Java Runtime Environment (JRE) that ships with MATLAB (if that is the Java version being used by the program). The steps to install the font are:
-
Copy the TTF fonts to "\sys\java\jre\win64\jre\lib\fonts", e.g., "C:\Program Files\MATLAB\R2019a\sys\java\jre\win64\jre\lib\fonts". Note: You might need to be an administrator to copy files to this folder.
-
Restart MATLAB.
-
You should now be able to see the fonts in MATLAB's font preference panel. Note: If using the default JVM shipped with MATLAB, you must do this for each MATLAB version installed.
create_matlab_contour_plots='yes'; % (for numerical solution)
create_matlab_exact_contour_plots='yes'; % (for exact solution)
The figures can also be printed and saved to PDF files (the output PDFs are saved to folder “test/output_files/matlab_figures/”) by setting
print_figures='yes'; % (for numerical solution)
print_exact_figures='yes'; % (for exact solution)
The figures can also be saved to .fig files (the output .fig files are saved to folder “test/output_files/matlab_figures/”) by setting
save_matlab_figures='yes'; % (for numerical solution)
save_exact_matlab_figures='yes'; % (for exact solution)
The resolution of the MATLAB’s figures when plotting to PDF files or saving to .fig files is controlled by
print_figures_resolution=600;
where it has been set to 600 dpi. This value can be changed as required by the user.
Many other customizations of the output figures can be made by setting the appropriate parameters in “plot_and_output_options.m” (for details, see the manual that is available in the folder “doc”). Several example output MATLAB’s figures are provided in the manual that is available in the folder “doc”.
As an alternative, plots can be visualized externally in the GiD postprocessor. This is an independent process and can be performed even if plots were set to be displayed on MATLAB’s figures. When the following is set in “plot_and_output_options.m”:
write_solutions_to_GiD_file='yes';
results are written to GiD files and saved to folder “test/output_files/GiD”. GiD can be downloaded from its webpage: https://www.gidhome.com/.
VEMLAB is a library. You need to create a main .m file and place it inside the folder “test”. The main file has the typical structure of a FEM simulation. Simply follow the test problems (they are given with detailed comments) that are provided inside the folder “test” to write your own .m files or modify the ones provided. Alternatively, you can read the manual that is available in the folder “doc”. We are grateful to Dr. Stefan Holst, EMAG Application Manager, Technology Group, CD-adapco/Siemens PLM Software, for his kind advice on making VEMLAB to run in Octave.In Octave, the “computer” function that is at the beginning of each test file, returns a different name than one of those expected by VEMLAB when running in MATLAB, i.e., 'PCWIN', 'PCWIN64', 'GLNX86' or 'GLNXA64'. To fix this, at the beginning of each test file simply redefine the variable “opsystem” as follows: opsystem='PCWIN' or opsystem=' GLNX86' if the machine where Octave is installed is a Windows machine or a Linux machine, respectively.
In addition, Octave presents some issues when plotting VEMLAB results to MATLAB figures (on small meshes it will do the work, but on larger meshes it will crash). To fix this, switch off all the MATLAB figures by setting the following parameters in the function “plot_and_output_options.m” that is in the folder “config”:
create_matlab_contour_plots='no';
plot_mesh='no';
plot_mesh_over_results='no';
write_solutions_to_text_file='yes';
write_solutions_to_GiD_file='yes';
write_solutions_to_VTK_file='yes';
Make sure the last three parameters are set to 'yes' so that one can have access to VEMLAB results through text files or can postprocess results in GiD and VTK/Paraview.
Alejandro Ortiz-Bernardin, Associate Professor, Department of Mechanical Engineering, Universidad de Chile. This project is licensed under the GPL3 License. This program is free software; it can be redistributed or modified under the terms of the GNU General Public License 3 as published by the Free Software Foundation.