diff --git a/src/serac/physics/benchmarks/physics_benchmark_solid_nonlinear_solve.cpp b/src/serac/physics/benchmarks/physics_benchmark_solid_nonlinear_solve.cpp index 23e98abb6..192066803 100644 --- a/src/serac/physics/benchmarks/physics_benchmark_solid_nonlinear_solve.cpp +++ b/src/serac/physics/benchmarks/physics_benchmark_solid_nonlinear_solve.cpp @@ -48,6 +48,12 @@ enum class NonlinSolve NONE }; +enum class ProblemSize +{ + SMALL, + LARGE, +}; + std::string mesh_path = "."; // string->value matching for optionally entering options as string in command line std::map precMap = { @@ -62,6 +68,10 @@ std::map nonlinSolveMap = { {"trustregion", NonlinSolve::TRUSTREGION}, {"none", NonlinSolve::NONE}, }; +std::map problemSizeMap = { + {"small", ProblemSize::SMALL}, + {"large", ProblemSize::LARGE}, +}; const std::string precToString(Prec prec) { @@ -258,7 +268,7 @@ void functional_solid_test_euler(NonlinSolve nonlinSolve, Prec prec) } } -void functional_solid_test_nonlinear_buckle(NonlinSolve nonlinSolve, Prec prec, double loadMagnitude) +void functional_solid_test_nonlinear_buckle(NonlinSolve nonlinSolve, Prec prec, ProblemSize problemSize) { // initialize serac axom::sidre::DataStore datastore; @@ -267,15 +277,27 @@ void functional_solid_test_nonlinear_buckle(NonlinSolve nonlinSolve, Prec prec, static constexpr int ORDER{1}; static constexpr int DIM{3}; - // int Nx = 1000; - int Nx = 500; - int Ny = 6; - int Nz = 5; + int Nx, Ny, Nz; + switch (problemSize) { + case ProblemSize::SMALL: + Nx = 500; + Ny = 6; + Nz = 5; + break; + default: + case ProblemSize::LARGE: + Nx = 1000; + Ny = 60; + Nz = 50; + break; + } double Lx = Nx * 0.1; double Ly = Ny * 0.03; double Lz = Nz * 0.06; + double loadMagnitude = 5e-10; + double density = 1.0; double E = 1.0; double v = 0.33; @@ -322,13 +344,16 @@ int main(int argc, char* argv[]) NonlinSolve nonlinSolve = NonlinSolve::NONE; Prec prec = Prec::NONE; + ProblemSize problemSize = ProblemSize::LARGE; axom::CLI::App app{"Solid Nonlinear Solve Benchmark"}; // app.add_option("-m,--mesh", mesh_path, "Path to mesh files")->check(axom::CLI::ExistingDirectory); - app.add_option("-n,--nonlinear-solver", nonlinSolve, "Nonlinear solver") + app.add_option("-n,--nonlinear-solver", nonlinSolve, "Nonlinear Solver") ->transform(axom::CLI::CheckedTransformer(nonlinSolveMap, axom::CLI::ignore_case)); app.add_option("-p,--preconditioner", prec, "Preconditioner") ->transform(axom::CLI::CheckedTransformer(precMap, axom::CLI::ignore_case)); + app.add_option("-s,--problem-size", problemSize, "Problem Size") + ->transform(axom::CLI::CheckedTransformer(problemSizeMap, axom::CLI::ignore_case)); // Parse the arguments and check if they are good try { @@ -350,27 +375,25 @@ int main(int argc, char* argv[]) // If you do not specify preconditioner and nonlinear solver, run the following pre-selected options if (nonlinSolve == NonlinSolve::NONE && prec == Prec::NONE) { SERAC_MARK_BEGIN("Jacobi Preconditioner"); - functional_solid_test_nonlinear_buckle(NonlinSolve::NEWTON, Prec::JACOBI, 5e-10); + functional_solid_test_nonlinear_buckle(NonlinSolve::NEWTON, Prec::JACOBI, problemSize); SERAC_MARK_END("Jacobi Preconditioner"); SERAC_MARK_BEGIN("Multigrid Preconditioner"); - functional_solid_test_nonlinear_buckle(NonlinSolve::NEWTON, Prec::MULTIGRID, 5e-10); + functional_solid_test_nonlinear_buckle(NonlinSolve::NEWTON, Prec::MULTIGRID, problemSize); SERAC_MARK_END("Multigrid Preconditioner"); SERAC_MARK_BEGIN("Petsc Multigrid Preconditioner"); - functional_solid_test_nonlinear_buckle(NonlinSolve::NEWTON, Prec::PETSC_MULTIGRID, 5e-10); + functional_solid_test_nonlinear_buckle(NonlinSolve::NEWTON, Prec::PETSC_MULTIGRID, problemSize); SERAC_MARK_END("Petsc Multigrid Preconditioner"); } else { SERAC_SET_METADATA("nonlinear solver", nonlinSolveToString(nonlinSolve)); SERAC_SET_METADATA("preconditioner", precToString(prec)); SERAC_MARK_BEGIN("Custom Preconditioner"); - functional_solid_test_nonlinear_buckle(nonlinSolve, prec, 5e-10); + functional_solid_test_nonlinear_buckle(nonlinSolve, prec, problemSize); SERAC_MARK_END("Custom Preconditioner"); } - // functional_solid_test_nonlinear_buckle(4e-4); - // functional_solid_test_nonlinear_buckle(3e-2); // functional_solid_test_euler(); serac::exitGracefully(0);