From 79e6be471b533a83d7e8c7bcb12e07cd585c6471 Mon Sep 17 00:00:00 2001 From: Kevin Huynh Date: Fri, 12 Nov 2021 10:40:59 -0800 Subject: [PATCH] more build updates (#83) * more build updates * update reamde * Add software update to mac * update readme * change softwareupate --- CMakeLists.txt | 3 +- examples/README.md | 19 ++++ examples/data/beam-quad.mesh | 69 ++++++++++++ examples/data/inline-quad.mesh | 7 ++ examples/data/periodic-hexagon.mesh | 106 ++++++++++++++++++ examples/data/periodic-square.mesh | 85 ++++++++++++++ examples/data/star.mesh | 96 ++++++++++++++++ examples/dmd/dg_advection.cpp | 2 +- examples/dmd/dg_euler.cpp | 2 +- examples/dmd/heat_conduction.cpp | 2 +- examples/dmd/nonlinear_elasticity.cpp | 2 +- examples/matlab/second_diff.m | 10 -- examples/prom/dg_advection_global_rom.cpp | 2 +- .../dg_advection_local_rom_matrix_interp.cpp | 2 +- examples/prom/mixed_nonlinear_diffusion.cpp | 26 ++--- examples/prom/poisson_global_rom.cpp | 2 +- examples/prom/poisson_local_rom_greedy.cpp | 2 +- scripts/compile.sh | 2 + {examples => tests}/matlab/deim.m | 0 {examples => tests}/matlab/dmd.m | 0 {examples => tests}/matlab/gnat.m | 0 {examples => tests}/matlab/qdeim.m | 0 {examples => tests}/matlab/randomized_svd.m | 0 23 files changed, 407 insertions(+), 32 deletions(-) create mode 100644 examples/README.md create mode 100644 examples/data/beam-quad.mesh create mode 100644 examples/data/inline-quad.mesh create mode 100644 examples/data/periodic-hexagon.mesh create mode 100644 examples/data/periodic-square.mesh create mode 100644 examples/data/star.mesh delete mode 100644 examples/matlab/second_diff.m rename {examples => tests}/matlab/deim.m (100%) rename {examples => tests}/matlab/dmd.m (100%) rename {examples => tests}/matlab/gnat.m (100%) rename {examples => tests}/matlab/qdeim.m (100%) rename {examples => tests}/matlab/randomized_svd.m (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31625bb68..b8628d25c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_policy(SET CMP0074 NEW) # Use _ROOT variables in find_package # for MPI and HDF5 dependency checking. The Fortran language must be enabled # for Fortran-C name mangling convention detection. project(libROM - VERSION 0.0.1 + VERSION 1.0.0 DESCRIPTION "Model reduction library emphasizing large-scale parallelism" HOMEPAGE_URL "https://github.com/LLNL/libROM" LANGUAGES C CXX Fortran) @@ -163,6 +163,7 @@ if (USE_MFEM) ${MPI_C_INCLUDE_DIRS}) target_compile_features(${name} PRIVATE cxx_std_11) endforeach() # IN LISTS examples + file(COPY examples/data DESTINATION ${CMAKE_BINARY_DIR}/examples) endif() set(regression_test_names diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000..196ec322b --- /dev/null +++ b/examples/README.md @@ -0,0 +1,19 @@ +# Examples + +These data and examples are built using MFEM and derived from their examples +(https://mfem.org/examples/). libROM's examples are divided into two categories. + +## Dynamic Mode Decomposition (DMD) + +- DG Advection +- DG Euler +- Heat Conduction +- Nonlinear Elasticity + +## Projection-based Reduced Order Models (PROM) + +- DG Advection (Global ROM) +- DG Advection (Local ROM with matrix interpolation) +- Mixed Linear Diffusion (Global ROM) +- Poisson (Global ROM) +- Poisson (Local ROM using the greedy algorithm) diff --git a/examples/data/beam-quad.mesh b/examples/data/beam-quad.mesh new file mode 100644 index 000000000..0fba24fe2 --- /dev/null +++ b/examples/data/beam-quad.mesh @@ -0,0 +1,69 @@ +MFEM mesh v1.0 + +# +# MFEM Geometry Types (see mesh/geom.hpp): +# +# POINT = 0 +# SEGMENT = 1 +# TRIANGLE = 2 +# SQUARE = 3 +# TETRAHEDRON = 4 +# CUBE = 5 +# + +dimension +2 + +elements +8 +1 3 0 1 10 9 +1 3 1 2 11 10 +1 3 2 3 12 11 +1 3 3 4 13 12 +2 3 4 5 14 13 +2 3 5 6 15 14 +2 3 6 7 16 15 +2 3 7 8 17 16 + +boundary +18 +3 1 0 1 +3 1 1 2 +3 1 2 3 +3 1 3 4 +3 1 4 5 +3 1 5 6 +3 1 6 7 +3 1 7 8 +3 1 10 9 +3 1 11 10 +3 1 12 11 +3 1 13 12 +3 1 14 13 +3 1 15 14 +3 1 16 15 +3 1 17 16 +1 1 9 0 +2 1 8 17 + +vertices +18 +2 +0 0 +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +7 0 +8 0 +0 1 +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 diff --git a/examples/data/inline-quad.mesh b/examples/data/inline-quad.mesh new file mode 100644 index 000000000..692520ac5 --- /dev/null +++ b/examples/data/inline-quad.mesh @@ -0,0 +1,7 @@ +MFEM INLINE mesh v1.0 + +type = quad +nx = 4 +ny = 4 +sx = 1.0 +sy = 1.0 diff --git a/examples/data/periodic-hexagon.mesh b/examples/data/periodic-hexagon.mesh new file mode 100644 index 000000000..5a5d448bc --- /dev/null +++ b/examples/data/periodic-hexagon.mesh @@ -0,0 +1,106 @@ +MFEM mesh v1.0 + +# +# MFEM Geometry Types (see mesh/geom.hpp): +# +# POINT = 0 +# SEGMENT = 1 +# TRIANGLE = 2 +# SQUARE = 3 +# TETRAHEDRON = 4 +# CUBE = 5 +# + +dimension +2 + +# format: ... +elements +12 + +1 3 0 2 8 5 +1 3 2 1 3 8 +1 3 5 8 6 11 +1 3 8 3 0 6 + +2 3 0 4 9 6 +2 3 4 1 2 9 +2 3 6 9 7 11 +2 3 9 2 0 7 + +3 3 0 3 10 7 +3 3 3 1 4 10 +3 3 7 10 5 11 +3 3 10 4 0 5 + +boundary +0 + +vertices +12 + +nodes +FiniteElementSpace +FiniteElementCollection: L2_T1_2D_P1 +VDim: 2 +Ordering: 1 + +-0.50 -0.8660254037844386 + 0.00 -0.8660254037844386 +-0.25 -0.4330127018922193 + 0.25 -0.4330127018922193 + + 0.00 -0.8660254037844386 + 0.50 -0.8660254037844386 + 0.25 -0.4330127018922193 + 0.75 -0.4330127018922193 + +-0.25 -0.4330127018922193 + 0.25 -0.4330127018922193 + 0.00 0.0 + 0.50 0.0 + + 0.25 -0.4330127018922193 + 0.75 -0.4330127018922193 + 0.50 0.0 + 1.00 0.0 + + 1.00 0.0 + 0.75 0.4330127018922193 + 0.50 0.0 + 0.25 0.4330127018922193 + + 0.75 0.4330127018922193 + 0.50 0.8660254037844386 + 0.25 0.4330127018922193 + 0.00 0.8660254037844386 + + 0.50 0.0 + 0.25 0.4330127018922193 + 0.00 0.0 +-0.25 0.4330127018922193 + + 0.25 0.4330127018922193 + 0.00 0.8660254037844386 +-0.25 0.4330127018922193 +-0.50 0.8660254037844386 + +-0.50 0.8660254037844386 +-0.75 0.4330127018922193 +-0.25 0.4330127018922193 +-0.50 0.0 + +-0.75 0.4330127018922193 +-1.00 0.0 +-0.50 0.0 +-0.75 -0.4330127018922193 + +-0.25 0.4330127018922193 +-0.50 0.0 + 0.00 0.0 +-0.25 -0.4330127018922193 + +-0.50 0.0 +-0.75 -0.4330127018922193 +-0.25 -0.4330127018922193 +-0.50 -0.8660254037844386 diff --git a/examples/data/periodic-square.mesh b/examples/data/periodic-square.mesh new file mode 100644 index 000000000..7d0bf5af3 --- /dev/null +++ b/examples/data/periodic-square.mesh @@ -0,0 +1,85 @@ +MFEM mesh v1.0 + +# +# MFEM Geometry Types (see mesh/geom.hpp): +# +# POINT = 0 +# SEGMENT = 1 +# TRIANGLE = 2 +# SQUARE = 3 +# TETRAHEDRON = 4 +# CUBE = 5 +# + +dimension +2 + +# format: ... +elements +9 +1 3 0 1 4 3 +2 3 1 2 5 4 +3 3 2 0 3 5 +4 3 3 4 7 6 +5 3 4 5 8 7 +6 3 5 3 6 8 +7 3 6 7 1 0 +8 3 7 8 2 1 +9 3 8 6 0 2 + +boundary +0 + +vertices +9 + +nodes +FiniteElementSpace +FiniteElementCollection: L2_T1_2D_P1 +VDim: 2 +Ordering: 1 + +-1 -1 +-0.333333333 -1 +-1 -0.333333333 +-0.333333333 -0.333333333 + +-0.333333333 -1 ++0.333333333 -1 +-0.333333333 -0.333333333 ++0.333333333 -0.333333333 + ++0.333333333 -1 ++1 -1 ++0.333333333 -0.333333333 ++1 -0.333333333 + +-1 -0.333333333 +-0.333333333 -0.333333333 +-1 +0.333333333 +-0.333333333 +0.333333333 + +-0.333333333 -0.333333333 ++0.333333333 -0.333333333 +-0.333333333 +0.333333333 ++0.333333333 +0.333333333 + ++0.333333333 -0.333333333 ++1 -0.333333333 ++0.333333333 +0.333333333 ++1 +0.333333333 + +-1 +0.333333333 +-0.333333333 +0.333333333 +-1 +1 +-0.333333333 +1 + +-0.333333333 +0.333333333 ++0.333333333 +0.333333333 +-0.333333333 +1 ++0.333333333 +1 + ++0.333333333 +0.333333333 ++1 +0.333333333 ++0.333333333 +1 ++1 +1 diff --git a/examples/data/star.mesh b/examples/data/star.mesh new file mode 100644 index 000000000..f6d6f2d8c --- /dev/null +++ b/examples/data/star.mesh @@ -0,0 +1,96 @@ +MFEM mesh v1.0 + +# +# MFEM Geometry Types (see mesh/geom.hpp): +# +# POINT = 0 +# SEGMENT = 1 +# TRIANGLE = 2 +# SQUARE = 3 +# TETRAHEDRON = 4 +# CUBE = 5 +# + +dimension +2 + +elements +20 +1 3 0 11 26 14 +1 3 0 14 27 17 +1 3 0 17 28 20 +1 3 0 20 29 23 +1 3 0 23 30 11 +1 3 11 1 12 26 +1 3 26 12 3 13 +1 3 14 26 13 2 +1 3 14 2 15 27 +1 3 27 15 5 16 +1 3 17 27 16 4 +1 3 17 4 18 28 +1 3 28 18 7 19 +1 3 20 28 19 6 +1 3 20 6 21 29 +1 3 29 21 9 22 +1 3 23 29 22 8 +1 3 23 8 24 30 +1 3 30 24 10 25 +1 3 11 30 25 1 + +boundary +20 +1 1 13 2 +1 1 12 3 +1 1 16 4 +1 1 15 5 +1 1 19 6 +1 1 18 7 +1 1 22 8 +1 1 21 9 +1 1 25 1 +1 1 24 10 +1 1 3 13 +1 1 1 12 +1 1 5 16 +1 1 2 15 +1 1 7 19 +1 1 4 18 +1 1 9 22 +1 1 6 21 +1 1 10 25 +1 1 8 24 + +vertices +31 +2 +0 0 +1 0 +0.309017 0.951057 +1.30902 0.951057 +-0.809017 0.587785 +-0.5 1.53884 +-0.809017 -0.587785 +-1.61803 0 +0.309017 -0.951057 +-0.5 -1.53884 +1.30902 -0.951057 +0.5 0 +1.15451 0.475529 +0.809019 0.951057 +0.154508 0.475529 +-0.0954915 1.24495 +-0.654508 1.06331 +-0.404508 0.293893 +-1.21352 0.293893 +-1.21352 -0.293892 +-0.404508 -0.293893 +-0.654508 -1.06331 +-0.0954915 -1.24495 +0.154508 -0.475529 +0.809019 -0.951057 +1.15451 -0.475529 +0.654509 0.475529 +-0.25 0.769421 +-0.809016 0 +-0.25 -0.76942 +0.654509 -0.475529 diff --git a/examples/dmd/dg_advection.cpp b/examples/dmd/dg_advection.cpp index b23d1498e..244f9c676 100644 --- a/examples/dmd/dg_advection.cpp +++ b/examples/dmd/dg_advection.cpp @@ -232,7 +232,7 @@ int main(int argc, char *argv[]) // 2. Parse command-line options. problem = 0; - const char *mesh_file = "../../../dependencies/mfem/data/periodic-hexagon.mesh"; + const char *mesh_file = "../data/periodic-hexagon.mesh"; int ser_ref_levels = 2; int par_ref_levels = 0; int order = 3; diff --git a/examples/dmd/dg_euler.cpp b/examples/dmd/dg_euler.cpp index 689b0f97d..3e9e01d0d 100644 --- a/examples/dmd/dg_euler.cpp +++ b/examples/dmd/dg_euler.cpp @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) // 2. Parse command-line options. problem = 1; - const char *mesh_file = "../../../dependencies/mfem/data/periodic-square.mesh"; + const char *mesh_file = "../data/periodic-square.mesh"; int ser_ref_levels = 0; int par_ref_levels = 1; int order = 3; diff --git a/examples/dmd/heat_conduction.cpp b/examples/dmd/heat_conduction.cpp index b64a0060e..63217fedf 100644 --- a/examples/dmd/heat_conduction.cpp +++ b/examples/dmd/heat_conduction.cpp @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(MPI_COMM_WORLD, &myid); // 2. Parse command-line options. - const char *mesh_file = "../../../dependencies/mfem/data/star.mesh"; + const char *mesh_file = "../data/star.mesh"; int ser_ref_levels = 2; int par_ref_levels = 1; int order = 2; diff --git a/examples/dmd/nonlinear_elasticity.cpp b/examples/dmd/nonlinear_elasticity.cpp index 9e850361a..eb03161b4 100644 --- a/examples/dmd/nonlinear_elasticity.cpp +++ b/examples/dmd/nonlinear_elasticity.cpp @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(MPI_COMM_WORLD, &myid); // 2. Parse command-line options. - const char *mesh_file = "../../../dependencies/mfem/data/beam-quad.mesh"; + const char *mesh_file = "../data/beam-quad.mesh"; int ser_ref_levels = 2; int par_ref_levels = 0; int order = 2; diff --git a/examples/matlab/second_diff.m b/examples/matlab/second_diff.m deleted file mode 100644 index ea267f0ca..000000000 --- a/examples/matlab/second_diff.m +++ /dev/null @@ -1,10 +0,0 @@ -function K = second_diff(n) -% Input: n: a nonnegative integer 2 or greater -% Output: a second difference matrix -% K = [ 2 -1 ] -% [-1 2 -1 ] -% [ .. .. .. ] -% [ .. .. -1] -% [ -1 2] - K = toeplitz([2 -1 zeros(1, n - 2)]); -end \ No newline at end of file diff --git a/examples/prom/dg_advection_global_rom.cpp b/examples/prom/dg_advection_global_rom.cpp index 142e3a851..d3e62ef86 100644 --- a/examples/prom/dg_advection_global_rom.cpp +++ b/examples/prom/dg_advection_global_rom.cpp @@ -278,7 +278,7 @@ int main(int argc, char *argv[]) // 2. Parse command-line options. problem = 3; - const char *mesh_file = "../../../dependencies/mfem/data/periodic-hexagon.mesh"; + const char *mesh_file = "../data/periodic-hexagon.mesh"; int ser_ref_levels = 2; int par_ref_levels = 0; int order = 3; diff --git a/examples/prom/dg_advection_local_rom_matrix_interp.cpp b/examples/prom/dg_advection_local_rom_matrix_interp.cpp index b375d0f92..629080bbc 100644 --- a/examples/prom/dg_advection_local_rom_matrix_interp.cpp +++ b/examples/prom/dg_advection_local_rom_matrix_interp.cpp @@ -287,7 +287,7 @@ int main(int argc, char *argv[]) // 2. Parse command-line options. problem = 3; - const char *mesh_file = "../../../dependencies/mfem/data/periodic-hexagon.mesh"; + const char *mesh_file = "../data/periodic-hexagon.mesh"; int ser_ref_levels = 2; int par_ref_levels = 0; int order = 3; diff --git a/examples/prom/mixed_nonlinear_diffusion.cpp b/examples/prom/mixed_nonlinear_diffusion.cpp index 4ab6cd0ed..d57e5e32d 100644 --- a/examples/prom/mixed_nonlinear_diffusion.cpp +++ b/examples/prom/mixed_nonlinear_diffusion.cpp @@ -19,22 +19,22 @@ // Sample runs: // Analytic test (reproductive) -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -offline -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -merge -ns 1 -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -online -rrdim 8 -rwdim 8 +// mpirun -n 1 ./mixed_nonlinear_diffusion -offline +// mpirun -n 1 ./mixed_nonlinear_diffusion -merge -ns 1 +// mpirun -n 1 ./mixed_nonlinear_diffusion -online -rrdim 8 -rwdim 8 // // Initial step test (reproductive) -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -offline -p 1 -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -merge -ns 1 -p 1 -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -online -rrdim 8 -rwdim 8 -p 1 +// mpirun -n 1 ./mixed_nonlinear_diffusion -offline -p 1 +// mpirun -n 1 ./mixed_nonlinear_diffusion -merge -ns 1 -p 1 +// mpirun -n 1 ./mixed_nonlinear_diffusion -online -rrdim 8 -rwdim 8 -p 1 // // Initial step parametric test (predictive) -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -p 1 -offline -id 0 -sh 0.25 -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -p 1 -offline -id 1 -sh 0.15 -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -p 1 -offline -id 2 -sh 0.35 -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -p 1 -merge -ns 3 -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -p 1 -offline -id 3 -sh 0.3 -// mpirun -n 1 ./mixed_nonlinear_diffusion -m ../../dependencies/mfem/data/inline-quad.mesh -p 1 -online -rrdim 8 -rwdim 8 -sh 0.3 -id 3 +// mpirun -n 1 ./mixed_nonlinear_diffusion -p 1 -offline -id 0 -sh 0.25 +// mpirun -n 1 ./mixed_nonlinear_diffusion -p 1 -offline -id 1 -sh 0.15 +// mpirun -n 1 ./mixed_nonlinear_diffusion -p 1 -offline -id 2 -sh 0.35 +// mpirun -n 1 ./mixed_nonlinear_diffusion -p 1 -merge -ns 3 +// mpirun -n 1 ./mixed_nonlinear_diffusion -p 1 -offline -id 3 -sh 0.3 +// mpirun -n 1 ./mixed_nonlinear_diffusion -p 1 -online -rrdim 8 -rwdim 8 -sh 0.3 -id 3 #include "mfem.hpp" @@ -425,7 +425,7 @@ int main(int argc, char *argv[]) problem = ANALYTIC; diffusion_c = 2.0; step_half = 0.25; - const char *mesh_file = "../../dependencies/mfem/data/star.mesh"; + const char *mesh_file = "../data/inline-quad.mesh"; int ser_ref_levels = 2; int par_ref_levels = 1; int order = 0; diff --git a/examples/prom/poisson_global_rom.cpp b/examples/prom/poisson_global_rom.cpp index 1934a2731..b1e59228e 100644 --- a/examples/prom/poisson_global_rom.cpp +++ b/examples/prom/poisson_global_rom.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(MPI_COMM_WORLD, &myid); // 2. Parse command-line options. - const char *mesh_file = "../../../dependencies/mfem/data/star.mesh"; + const char *mesh_file = "../data/star.mesh"; int order = 1; bool static_cond = false; bool pa = false; diff --git a/examples/prom/poisson_local_rom_greedy.cpp b/examples/prom/poisson_local_rom_greedy.cpp index 4d93d7cba..7e30d2691 100644 --- a/examples/prom/poisson_local_rom_greedy.cpp +++ b/examples/prom/poisson_local_rom_greedy.cpp @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) MPI_Comm_rank(MPI_COMM_WORLD, &myid); // 2. Parse command-line options. - const char *mesh_file = "../../../dependencies/mfem/data/star.mesh"; + const char *mesh_file = "../data/star.mesh"; int order = 1; bool static_cond = false; bool pa = false; diff --git a/scripts/compile.sh b/scripts/compile.sh index 8b6f63029..2f7e07ffb 100755 --- a/scripts/compile.sh +++ b/scripts/compile.sh @@ -74,11 +74,13 @@ if [ "$(uname)" == "Darwin" ]; then if [[ $? != 0 ]] ; then xcode-select --install fi + softwareupdate --all --install --force brew list open-mpi > /dev/null || brew install open-mpi brew list openblas > /dev/null || brew install openblas brew list lapack > /dev/null || brew install lapack brew list scalapack > /dev/null || brew install scalapack brew list hdf5 > /dev/null || brew install hdf5 + brew list cmake > /dev/null || brew install cmake cmake ${REPO_PREFIX} \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DUSE_MFEM=${USE_MFEM} diff --git a/examples/matlab/deim.m b/tests/matlab/deim.m similarity index 100% rename from examples/matlab/deim.m rename to tests/matlab/deim.m diff --git a/examples/matlab/dmd.m b/tests/matlab/dmd.m similarity index 100% rename from examples/matlab/dmd.m rename to tests/matlab/dmd.m diff --git a/examples/matlab/gnat.m b/tests/matlab/gnat.m similarity index 100% rename from examples/matlab/gnat.m rename to tests/matlab/gnat.m diff --git a/examples/matlab/qdeim.m b/tests/matlab/qdeim.m similarity index 100% rename from examples/matlab/qdeim.m rename to tests/matlab/qdeim.m diff --git a/examples/matlab/randomized_svd.m b/tests/matlab/randomized_svd.m similarity index 100% rename from examples/matlab/randomized_svd.m rename to tests/matlab/randomized_svd.m