From 9dd4c8d0bbf224625aa37d2deab5ad6e5e4d5459 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Fri, 12 May 2023 13:48:26 +0100 Subject: [PATCH] Test solvers for development --- Test.hpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Test.hpp diff --git a/Test.hpp b/Test.hpp new file mode 100644 index 0000000..b7012e8 --- /dev/null +++ b/Test.hpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2023 + * + * Author: Antonin Portelli + * Elements based on production templates from Raoul Hodgson + * + * Hadrons is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Hadrons is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Hadrons. If not, see . + * + * See the full license in the file "LICENSE" in the top level distribution + * directory. + */ + +#pragma once + +#include +#include + +namespace hadpresets +{ +using namespace Grid::Hadrons; + +struct Test +{ + static inline void addTestDwfSolver(Application &app, const std::string solverName, + const std::string gaugeName, const double mass = 0.1, + const double residual = 1.0e-8); +}; + +void Test::addTestDwfSolver(Application &app, const std::string solverName, + const std::string gaugeName, const double mass, const double residual) +{ + const std::string prefix = solverName; + + // DWF action + MAction::DWF::Par actionPar; + + actionPar.gauge = gaugeName; + actionPar.Ls = 8; + actionPar.M5 = 1.8; + actionPar.mass = mass; + actionPar.boundary = "1 1 1 -1"; + actionPar.twist = "0. 0. 0. 0."; + app.createModule(prefix + "_dwf", actionPar); + + // solver + MSolver::RBPrecCG::Par solverPar; + + solverPar.action = prefix + "_dwf"; + solverPar.guesser = ""; + solverPar.maxIteration = 10000; + solverPar.residual = residual; + app.createModule(solverName, solverPar); +} + +} // namespace hadpresets \ No newline at end of file