Skip to content

Commit

Permalink
Merge pull request #1251 from LLNL/feature/chapman39/increase-benchma…
Browse files Browse the repository at this point in the history
…rk-scale

Option to increase problem size of nonlinear solve benchmark (small or large)
  • Loading branch information
chapman39 authored Oct 25, 2024
2 parents 6357a07 + b90e7d7 commit e229a18
Showing 1 changed file with 35 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string, Prec> precMap = {
Expand All @@ -62,6 +68,10 @@ std::map<std::string, NonlinSolve> nonlinSolveMap = {
{"trustregion", NonlinSolve::TRUSTREGION},
{"none", NonlinSolve::NONE},
};
std::map<std::string, ProblemSize> problemSizeMap = {
{"small", ProblemSize::SMALL},
{"large", ProblemSize::LARGE},
};

const std::string precToString(Prec prec)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
Expand Down

0 comments on commit e229a18

Please sign in to comment.