Rename miniapp to minimal-surface
Add serial snapshot Costa tau shift & scale
This commit is contained in:
+2
-2
@@ -169,8 +169,8 @@ miniapps/meshing/shaper
|
||||
miniapps/meshing/extruder
|
||||
miniapps/meshing/mesh-optimizer
|
||||
miniapps/meshing/pmesh-optimizer
|
||||
miniapps/meshing/mesh-minimal-surface
|
||||
miniapps/meshing/pmesh-minimal-surface
|
||||
miniapps/meshing/minimal-surface
|
||||
miniapps/meshing/pminimal-surface
|
||||
|
||||
miniapps/meshing/mobius-strip.mesh
|
||||
miniapps/meshing/klein-bottle.mesh
|
||||
|
||||
@@ -47,7 +47,7 @@ groups_serial=(
|
||||
"Meshing miniapps:"
|
||||
"miniapps/meshing"
|
||||
"mobius-strip.cpp klein-bottle.cpp extruder.cpp toroid.cpp
|
||||
mesh-optimizer.cpp mesh-minimal-surface.cpp"'
|
||||
mesh-optimizer.cpp minimal-surface.cpp"'
|
||||
)
|
||||
# Parallel groups
|
||||
groups_parallel=(
|
||||
@@ -72,7 +72,7 @@ groups_parallel=(
|
||||
'"meshing"
|
||||
"Meshing miniapps:"
|
||||
"miniapps/meshing"
|
||||
"pmesh-optimizer.cpp pmesh-minimal-surface.cpp"'
|
||||
"pmesh-optimizer.cpp pminimal-surface.cpp"'
|
||||
'"electromagnetics"
|
||||
"Electromagnetics miniapps:"
|
||||
"miniapps/electromagnetics"
|
||||
@@ -101,7 +101,7 @@ groups_all=(
|
||||
"Meshing miniapps:"
|
||||
"miniapps/meshing"
|
||||
"mobius-strip.cpp klein-bottle.cpp extruder.cpp toroid.cpp
|
||||
{,p}mesh-optimizer.cpp {,p}mesh-minimal-surface.cpp"'
|
||||
{,p}mesh-optimizer.cpp {,p}minimal-surface.cpp"'
|
||||
'"electromagnetics"
|
||||
"Electromagnetics miniapps:"
|
||||
"miniapps/electromagnetics"
|
||||
|
||||
@@ -33,8 +33,8 @@ add_mfem_miniapp(mesh-optimizer
|
||||
MAIN mesh-optimizer.cpp
|
||||
LIBRARIES mfem)
|
||||
|
||||
add_mfem_miniapp(mesh-minimal-surface
|
||||
MAIN mesh-minimal-surface.cpp
|
||||
add_mfem_miniapp(minimal-surface
|
||||
MAIN minimal-surface.cpp
|
||||
LIBRARIES mfem)
|
||||
|
||||
add_mfem_miniapp(toroid
|
||||
@@ -49,7 +49,7 @@ add_mfem_miniapp(twist
|
||||
add_test(NAME mesh-optimizer
|
||||
COMMAND mesh-optimizer -no-vis -m ${CMAKE_CURRENT_SOURCE_DIR}/icf.mesh)
|
||||
|
||||
add_test(NAME mesh-minimal-surface COMMAND mesh-minimal-surface)
|
||||
add_test(NAME minimal-surface COMMAND minimal-surface)
|
||||
|
||||
# Parallel apps.
|
||||
if (MFEM_USE_MPI)
|
||||
@@ -57,8 +57,8 @@ if (MFEM_USE_MPI)
|
||||
MAIN pmesh-optimizer.cpp
|
||||
LIBRARIES mfem)
|
||||
|
||||
add_mfem_miniapp(pmesh-minimal-surface
|
||||
MAIN pmesh-minimal-surface.cpp
|
||||
add_mfem_miniapp(pminimal-surface
|
||||
MAIN pminimal-surface.cpp
|
||||
LIBRARIES mfem)
|
||||
|
||||
# Add parallel tests.
|
||||
@@ -68,8 +68,8 @@ if (MFEM_USE_MPI)
|
||||
-m ${CMAKE_CURRENT_SOURCE_DIR}/icf.mesh
|
||||
${MPIEXEC_POSTFLAGS})
|
||||
|
||||
add_test(NAME pmesh-minimal-surface_np=4
|
||||
add_test(NAME pminimal-surface_np=4
|
||||
COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MFEM_MPI_NP}
|
||||
${MPIEXEC_PREFLAGS} $<TARGET_FILE:pmesh-minimal-surface>
|
||||
${MPIEXEC_PREFLAGS} $<TARGET_FILE:pminimal-surface>
|
||||
${MPIEXEC_POSTFLAGS})
|
||||
endif()
|
||||
|
||||
@@ -23,8 +23,8 @@ MFEM_LIB_FILE = mfem_is_not_built
|
||||
|
||||
SEQ_MINIAPPS = mobius-strip klein-bottle toroid twist \
|
||||
mesh-explorer shaper extruder mesh-optimizer \
|
||||
mesh-minimal-surface
|
||||
PAR_MINIAPPS = pmesh-optimizer pmesh-minimal-surface
|
||||
minimal-surface
|
||||
PAR_MINIAPPS = pmesh-optimizer pminimal-surface
|
||||
ifeq ($(MFEM_USE_MPI),NO)
|
||||
MINIAPPS = $(SEQ_MINIAPPS)
|
||||
else
|
||||
@@ -70,9 +70,9 @@ mesh-optimizer-test-seq: mesh-optimizer
|
||||
@$(call mfem-test,$<,, Meshing miniapp)
|
||||
pmesh-optimizer-test-par: pmesh-optimizer
|
||||
@$(call mfem-test,$<, $(RUN_MPI), Parallel meshing miniapp)
|
||||
mesh-minimal-surface-test-seq: mesh-minimal-surface
|
||||
minimal-surface-test-seq: minimal-surface
|
||||
@$(call mfem-test,$<,, Meshing miniapp)
|
||||
pmesh-minimal-surface-test-par: pmesh-minimal-surface
|
||||
pminimal-surface-test-par: pminimal-surface
|
||||
@$(call mfem-test,$<, $(RUN_MPI), Parallel meshing miniapp)
|
||||
|
||||
# Testing: Specific execution options
|
||||
@@ -93,7 +93,7 @@ clean-build:
|
||||
rm -f *.o *~ mobius-strip klein-bottle toroid twist
|
||||
rm -f mesh-explorer shaper extruder
|
||||
rm -f mesh-optimizer pmesh-optimizer
|
||||
rm -f mesh-minimal-surface pmesh-minimal-surface
|
||||
rm -f minimal-surface pminimal-surface
|
||||
rm -rf *.dSYM *.TVD.*breakpoints
|
||||
|
||||
clean-exec:
|
||||
|
||||
@@ -37,30 +37,30 @@
|
||||
// for the Dirichlet problem, using Picard iterations:
|
||||
// -div( q grad u) = 0, with q(u) = (1 + |∇u|²)^{-1/2}
|
||||
//
|
||||
// Compile with: make mesh-minimal-surface
|
||||
// Compile with: make minimal-surface
|
||||
//
|
||||
// Sample runs: mesh-minimal-surface
|
||||
// mesh-minimal-surface -a
|
||||
// mesh-minimal-surface -c
|
||||
// mesh-minimal-surface -c -a
|
||||
// mesh-minimal-surface -no-pa
|
||||
// mesh-minimal-surface -no-pa -a
|
||||
// mesh-minimal-surface -no-pa -a -c
|
||||
// mesh-minimal-surface -p 1
|
||||
// Sample runs: minimal-surface
|
||||
// minimal-surface -a
|
||||
// minimal-surface -c
|
||||
// minimal-surface -c -a
|
||||
// minimal-surface -no-pa
|
||||
// minimal-surface -no-pa -a
|
||||
// minimal-surface -no-pa -a -c
|
||||
// minimal-surface -p 1
|
||||
//
|
||||
// Device sample runs:
|
||||
// mesh-minimal-surface -d debug
|
||||
// mesh-minimal-surface -d debug -a
|
||||
// mesh-minimal-surface -d debug -c
|
||||
// mesh-minimal-surface -d debug -c -a
|
||||
// mesh-minimal-surface -d cuda
|
||||
// mesh-minimal-surface -d cuda -a
|
||||
// mesh-minimal-surface -d cuda -c
|
||||
// mesh-minimal-surface -d cuda -c -a
|
||||
// mesh-minimal-surface -d cuda -no-pa
|
||||
// mesh-minimal-surface -d cuda -no-pa -a
|
||||
// mesh-minimal-surface -d cuda -no-pa -c
|
||||
// mesh-minimal-surface -d cuda -no-pa -c -a
|
||||
// minimal-surface -d debug
|
||||
// minimal-surface -d debug -a
|
||||
// minimal-surface -d debug -c
|
||||
// minimal-surface -d debug -c -a
|
||||
// minimal-surface -d cuda
|
||||
// minimal-surface -d cuda -a
|
||||
// minimal-surface -d cuda -c
|
||||
// minimal-surface -d cuda -c -a
|
||||
// minimal-surface -d cuda -no-pa
|
||||
// minimal-surface -d cuda -no-pa -a
|
||||
// minimal-surface -d cuda -no-pa -c
|
||||
// minimal-surface -d cuda -no-pa -c -a
|
||||
|
||||
#include "mfem.hpp"
|
||||
#include "../../general/forall.hpp"
|
||||
@@ -101,7 +101,10 @@ struct Opt
|
||||
bool print = false;
|
||||
bool radial = false;
|
||||
bool by_vdim = false;
|
||||
bool snapshot = false;
|
||||
bool vis_mesh = false;
|
||||
bool alpha = false;
|
||||
double tau = 1.0;
|
||||
double lambda = 0.1;
|
||||
double amr_threshold = 0.6;
|
||||
const char *keys = "gAm";
|
||||
@@ -164,6 +167,11 @@ public:
|
||||
{
|
||||
ByNodes(*this, opt).Solve();
|
||||
}
|
||||
if (opt.vis && opt.snapshot)
|
||||
{
|
||||
opt.keys = "Sq";
|
||||
Visualize(opt, mesh, mesh->GetNodes());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -221,7 +229,7 @@ public:
|
||||
}
|
||||
|
||||
// Initialize visualization of some given mesh
|
||||
static void Visualize(const Opt &opt, const Mesh *mesh,
|
||||
static void Visualize(Opt &opt, const Mesh *mesh,
|
||||
const int w, const int h,
|
||||
const GridFunction *sol = nullptr)
|
||||
{
|
||||
@@ -231,6 +239,7 @@ public:
|
||||
glvis.precision(8);
|
||||
glvis << "window_size " << w << " " << h << "\n";
|
||||
glvis << "keys " << opt.keys << "\n";
|
||||
opt.keys = nullptr;
|
||||
if (opt.wait) { glvis << "pause\n"; }
|
||||
glvis << std::flush;
|
||||
}
|
||||
@@ -243,6 +252,7 @@ public:
|
||||
if (opt.vis_mesh) { glvis << "mesh\n" << *mesh; }
|
||||
else { glvis << "solution\n" << *mesh << solution; }
|
||||
if (opt.wait) { glvis << "pause\n"; }
|
||||
if (opt.snapshot && opt.keys) { glvis << "keys " << opt.keys << "\n"; }
|
||||
glvis << std::flush;
|
||||
}
|
||||
|
||||
@@ -721,13 +731,14 @@ cdouble WeierstrassZeta(const cdouble z,
|
||||
}
|
||||
|
||||
// https://www.mathcurve.com/surfaces.gb/costa/costa.shtml
|
||||
static double ALPHA[3] {0.0};
|
||||
static double ALPHA[4] {0.0};
|
||||
struct Costa: public Surface
|
||||
{
|
||||
Costa(Opt &opt): Surface((opt.Tptr = Parametrization, opt), false) { }
|
||||
|
||||
void Prefix()
|
||||
{
|
||||
ALPHA[3] = opt.tau;
|
||||
const int nx = opt.nx, ny = opt.ny;
|
||||
MFEM_VERIFY(nx>2 && ny>2, "");
|
||||
const int nXhalf = (nx%2)==0 ? 4 : 2;
|
||||
@@ -773,8 +784,14 @@ struct Costa: public Surface
|
||||
SetCurvature(opt.order, false, SDIM, Ordering::byNODES);
|
||||
}
|
||||
|
||||
static void Parametrization(const Vector &x, Vector &p)
|
||||
static void Parametrization(const Vector &X, Vector &p)
|
||||
{
|
||||
const double tau = ALPHA[3];
|
||||
Vector x = X;
|
||||
x -= +0.5;
|
||||
x *= tau;
|
||||
x -= -0.5;
|
||||
|
||||
p.SetSize(3);
|
||||
const bool y_top = x[1] > 0.5;
|
||||
const bool x_top = x[0] > 0.5;
|
||||
@@ -1251,6 +1268,7 @@ int main(int argc, char *argv[])
|
||||
args.AddOption(&opt.surface, "-s", "--surface", "Choice of the surface.");
|
||||
args.AddOption(&opt.pa, "-pa", "--partial-assembly", "-no-pa",
|
||||
"--no-partial-assembly", "Enable Partial Assembly.");
|
||||
args.AddOption(&opt.tau, "-t", "--tau", "Costa scale factor.");
|
||||
args.AddOption(&opt.lambda, "-l", "--lambda", "Lambda step toward solution.");
|
||||
args.AddOption(&opt.amr, "-a", "--amr", "-no-a", "--no-amr", "Enable AMR.");
|
||||
args.AddOption(&opt.amr_threshold, "-at", "--amr-threshold", "AMR threshold.");
|
||||
@@ -1266,6 +1284,8 @@ int main(int argc, char *argv[])
|
||||
"Enable or disable the 'ByVdim' solver");
|
||||
args.AddOption(&opt.print, "-print", "--print", "-no-print", "--no-print",
|
||||
"Enable or disable result output (files in mfem format).");
|
||||
args.AddOption(&opt.snapshot, "-ss", "--snapshot", "-no-ss", "--no-snapshot",
|
||||
"Enable or disable GLVis snapshot.");
|
||||
args.Parse();
|
||||
if (!args.Good()) { args.PrintUsage(mfem::out); return 1; }
|
||||
MFEM_VERIFY(opt.lambda >= 0.0 && opt.lambda <= 1.0,"");
|
||||
+21
-21
@@ -37,30 +37,30 @@
|
||||
// for the Dirichlet problem, using Picard iterations:
|
||||
// -div( q grad u) = 0, with q(u) = (1 + |∇u|²)^{-1/2}
|
||||
//
|
||||
// Compile with: make pmesh-minimal-surface
|
||||
// Compile with: make pminimal-surface
|
||||
//
|
||||
// Sample runs: mpirun -np 4 pmesh-minimal-surface
|
||||
// mpirun -np 4 pmesh-minimal-surface -a
|
||||
// mpirun -np 4 pmesh-minimal-surface -c
|
||||
// mpirun -np 4 pmesh-minimal-surface -c -a
|
||||
// mpirun -np 4 pmesh-minimal-surface -no-pa
|
||||
// mpirun -np 4 pmesh-minimal-surface -no-pa -a
|
||||
// mpirun -np 4 pmesh-minimal-surface -no-pa -a -c
|
||||
// mpirun -np 4 pmesh-minimal-surface -p 1
|
||||
// Sample runs: mpirun -np 4 pminimal-surface
|
||||
// mpirun -np 4 pminimal-surface -a
|
||||
// mpirun -np 4 pminimal-surface -c
|
||||
// mpirun -np 4 pminimal-surface -c -a
|
||||
// mpirun -np 4 pminimal-surface -no-pa
|
||||
// mpirun -np 4 pminimal-surface -no-pa -a
|
||||
// mpirun -np 4 pminimal-surface -no-pa -a -c
|
||||
// mpirun -np 4 pminimal-surface -p 1
|
||||
//
|
||||
// Device sample runs:
|
||||
// mpirun -np 4 pmesh-minimal-surface -d debug
|
||||
// mpirun -np 4 pmesh-minimal-surface -d debug -a
|
||||
// mpirun -np 4 pmesh-minimal-surface -d debug -c
|
||||
// mpirun -np 4 pmesh-minimal-surface -d debug -c -a
|
||||
// mpirun -np 4 pmesh-minimal-surface -d cuda
|
||||
// mpirun -np 4 pmesh-minimal-surface -d cuda -a
|
||||
// mpirun -np 4 pmesh-minimal-surface -d cuda -c
|
||||
// mpirun -np 4 pmesh-minimal-surface -d cuda -c -a
|
||||
// mpirun -np 4 pmesh-minimal-surface -d cuda -no-pa
|
||||
// mpirun -np 4 pmesh-minimal-surface -d cuda -no-pa -a
|
||||
// mpirun -np 4 pmesh-minimal-surface -d cuda -no-pa -c
|
||||
// mpirun -np 4 pmesh-minimal-surface -d cuda -no-pa -c -a
|
||||
// mpirun -np 4 pminimal-surface -d debug
|
||||
// mpirun -np 4 pminimal-surface -d debug -a
|
||||
// mpirun -np 4 pminimal-surface -d debug -c
|
||||
// mpirun -np 4 pminimal-surface -d debug -c -a
|
||||
// mpirun -np 4 pminimal-surface -d cuda
|
||||
// mpirun -np 4 pminimal-surface -d cuda -a
|
||||
// mpirun -np 4 pminimal-surface -d cuda -c
|
||||
// mpirun -np 4 pminimal-surface -d cuda -c -a
|
||||
// mpirun -np 4 pminimal-surface -d cuda -no-pa
|
||||
// mpirun -np 4 pminimal-surface -d cuda -no-pa -a
|
||||
// mpirun -np 4 pminimal-surface -d cuda -no-pa -c
|
||||
// mpirun -np 4 pminimal-surface -d cuda -no-pa -c -a
|
||||
|
||||
#include "mfem.hpp"
|
||||
#include "../../general/forall.hpp"
|
||||
Reference in New Issue
Block a user