diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 96bc4057ca80d1ef413ea396522dd8179a46ccc9..a200fa2df84bcfeedef912f5b40e5f4e60b37468 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ # gitlab-ci file for waves default: - image: rboman/waves + image: rboman/waves:2020.0 before_script: - source /opt/intel/mkl/bin/mklvars.sh intel64 - source /opt/intel/tbb/bin/tbbvars.sh intel64 @@ -35,7 +35,7 @@ build-py2-no-tlnos: - make -j 4 build-py3: - image: rboman/waves-py3 + image: rboman/waves-py3:2020.0 stage: build script: - printenv | sort @@ -71,7 +71,7 @@ ctest-py2: - build-py2 ctest-py3: - image: rboman/waves-py3 + image: rboman/waves-py3:2020.0 stage: test script: - cd build diff --git a/flow/src/wNewton.cpp b/flow/src/wNewton.cpp index c4aace2b0427dbbe44db487cfc087632d7b6e950..477a43bc7da072c836a8e1c936d64afbc788197e 100644 --- a/flow/src/wNewton.cpp +++ b/flow/src/wNewton.cpp @@ -97,7 +97,7 @@ bool Newton::run() << std::endl; // Initialize solver loop - int itC = 0; // iteration counter + nIt = 0; // iteration counter int avC = 0; // adaptive viscosity counter bool rUpwd = true; // update best upwind element @@ -127,7 +127,7 @@ bool Newton::run() << std::setw(15) << "Rel_Res[phi]" << std::setw(15) << "Abs_Res[phi]" << std::endl; std::cout << std::fixed << std::setprecision(5); - std::cout << std::setw(8) << itC + std::cout << std::setw(8) << nIt << std::setw(8) << 0 << std::setw(8) << 1 << std::setw(12) << "-" @@ -173,7 +173,7 @@ bool Newton::run() bool solve_success = gmm::MUMPS_solve(J, deltaPhi, rPhi); if (!solve_success) throw std::runtime_error("Problem occured in gmm::MUMPS_solve!"); - itC++; + nIt++; // Compute new solution and residual with linesearch fpe.update(phi, deltaPhi); @@ -198,7 +198,7 @@ bool Newton::run() // Display residual std::cout << std::fixed << std::setprecision(5); - std::cout << std::setw(8) << itC + std::cout << std::setw(8) << nIt << std::setw(8) << 1 << std::setw(8) << ls.fevalIt << std::setw(12) << Cl @@ -207,13 +207,13 @@ bool Newton::run() << std::setw(15) << log10(absRes) << "\n"; // Check convergence - if ((relRes < relTol || absRes < absTol) && itC != 0) + if ((relRes < relTol || absRes < absTol) && nIt != 0) break; else if (std::isnan(relRes)) break; else continue; - } while (itC < maxIt); + } while (nIt < maxIt); // Compute field variables Solver::computeFlow(); diff --git a/flow/src/wPicard.cpp b/flow/src/wPicard.cpp index c0fe61cf6696410252c4a392d18d0792a28981b8..97d56ea6ce58e87d2887b70fc2b51af9baccc834 100644 --- a/flow/src/wPicard.cpp +++ b/flow/src/wPicard.cpp @@ -89,7 +89,7 @@ bool Picard::run() << std::endl; // Initialize solver loop - int it = 0; + nIt = 0; double resInit = 1.; double absRes = 1., relRes = 1.; std::vector<double> phiOld(phi.size()); // old solution (for relaxation) @@ -117,7 +117,7 @@ bool Picard::run() std::vector<double> A_phi(pbl->msh->nodes.size()); gmm::mult(A, phi, A_phi); gmm::add(A_phi, gmm::scaled(b, -1.0), rPhi); - if (it == 0) + if (nIt == 0) resInit = gmm::vect_norm2(rPhi); absRes = gmm::vect_norm2(rPhi); relRes = absRes / resInit; @@ -127,18 +127,18 @@ bool Picard::run() // Display residual std::cout << std::fixed << std::setprecision(5); - std::cout << std::setw(8) << it + std::cout << std::setw(8) << nIt << std::setw(12) << Cl << std::setw(12) << Cd << std::setw(15) << log10(relRes) << std::setw(15) << log10(absRes) << "\n"; // Check convergence - if ((relRes < relTol || absRes < absTol) && it != 0) + if ((relRes < relTol || absRes < absTol) && nIt != 0) break; else if (std::isnan(relRes)) break; - it++; + nIt++; // Transfer old solution phiOld = phi; @@ -152,7 +152,7 @@ bool Picard::run() // Relaxation for (size_t i = 0; i < phi.size(); ++i) phi[i] = (1 - relax) * phiOld[i] + relax * phi[i]; - } while (it < maxIt); + } while (nIt < maxIt); // Terminate MUMPS mumps.finalize(); diff --git a/flow/src/wSolver.h b/flow/src/wSolver.h index 5b184c8de54fbaf0eb46371d467b34b679936a4d..d7415b3a22185b05b0e8b6d360a6e94dce3dc7cf 100644 --- a/flow/src/wSolver.h +++ b/flow/src/wSolver.h @@ -43,6 +43,7 @@ public: int maxIt; ///< max number of iterations bool verbose; ///< display more info + int nIt; ///< number of iterations std::vector<double> phi; ///< full potential std::vector<double> rPhi; ///< residual on potential std::vector<double> vPhi; ///< perturbation potential diff --git a/flow/tests/cylinder.py b/flow/tests/cylinder.py index 915fc8cf42ab1d2d41002ef82492359eee2d1ad3..29126407cb3b7718ce60e038c8a62b9c83249819 100644 --- a/flow/tests/cylinder.py +++ b/flow/tests/cylinder.py @@ -158,9 +158,11 @@ def main(): if not cnvrgd0 or not cnvrgd1: raise Exception(ccolors.ANSI_RED + 'Flow solver failed to converge!' + ccolors.ANSI_RESET) tests = CTests() + tests.add(CTest('Picard: iteration count', solver0.nIt, 12, 1, forceabs=True)) tests.add(CTest('Picard: Neumann B.C. mean error', errNeu0, 0., 1e-2)) tests.add(CTest('Picard: Dirichlet B.C. max error', errDir0, 0., 1e-8)) tests.add(CTest('Picard: Wake/Kutta B.C. max error', errWak0, 0., 1e-2)) + tests.add(CTest('Newton: iteration count', solver1.nIt, 3, 1, forceabs=True)) tests.add(CTest('Newton: Neumann B.C. mean error', errNeu1, 0., 1e-2)) tests.add(CTest('Newton: Dirichlet B.C. max error', errDir1, 0., 1e-8)) tests.add(CTest('Newton: Wake/Kutta B.C. max error', errWak1, 0., 1e-2)) diff --git a/flow/tests/cylinder2D5.py b/flow/tests/cylinder2D5.py index b105b65f2e169c16dd25acdd729f3794b1de1fed..bc6c970cfb9f86f6bc3befaa6acb83691d04acd3 100644 --- a/flow/tests/cylinder2D5.py +++ b/flow/tests/cylinder2D5.py @@ -148,6 +148,7 @@ def main(): if (not cnvrgd): raise Exception(ccolors.ANSI_RED + 'Flow solver failed to converge!' + ccolors.ANSI_RESET) tests = CTests() + tests.add(CTest('iteration count', solver.nIt, 3, 1, forceabs=True)) tests.add(CTest('Neumann B.C. mean error', errNeu, 0., 1e-2)) tests.add(CTest('Dirichlet B.C. max error', errDir, 0., 1e-12)) tests.add(CTest('Wake/Kutta B.C. max error', errWak, 0., 1e-1)) diff --git a/flow/tests/cylinder3.py b/flow/tests/cylinder3.py index 145484272b955a5d31d3a6100f4a93e9858a9e8d..c229e6f308ac9f3e78a8220e8ef4d3f520ffd88f 100644 --- a/flow/tests/cylinder3.py +++ b/flow/tests/cylinder3.py @@ -152,6 +152,7 @@ def main(): if (not cnvrgd): raise Exception(ccolors.ANSI_RED + 'Flow solver failed to converge!' + ccolors.ANSI_RESET) tests = CTests() + tests.add(CTest('iteration count', solver.nIt, 4, 1, forceabs=True)) tests.add(CTest('Neumann B.C. mean error', errNeu, 0., 1e-2)) tests.add(CTest('Dirichlet B.C. max error', errDir, 0., 1e-12)) tests.add(CTest('Wake/Kutta B.C. max error', errWak, 0., 1e-1)) diff --git a/flow/tests/lift.py b/flow/tests/lift.py index 77313eadaca425360e280a288bdbc0347f5a0dcc..8332d5ee41faaebd7fe00b03113e399de22b246b 100644 --- a/flow/tests/lift.py +++ b/flow/tests/lift.py @@ -118,6 +118,7 @@ def main(): tests.add(CTest('min(Cp)', min(Cp[:,3]), -1.03, 1e-1)) tests.add(CTest('Cl', solver.Cl, 0.315, 5e-2)) elif M_inf == 0.7 and alpha == 2*math.pi/180: + tests.add(CTest('iteration count', solver.nIt, 12, 3, forceabs=True)) tests.add(CTest('min(Cp)', min(Cp[:,3]), -1.28, 5e-2)) tests.add(CTest('Cl', solver.Cl, 0.388, 5e-2)) else: diff --git a/flow/tests/lift3.py b/flow/tests/lift3.py index 300048398f7182cc2633ca541a6eb39d24e36730..774c77adf4ebb86359f5c137862fe3b2ac3e6a93 100644 --- a/flow/tests/lift3.py +++ b/flow/tests/lift3.py @@ -111,6 +111,7 @@ def main(): print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET) tests = CTests() if alpha == 3*math.pi/180 and M_inf == 0.3 and spn == 1.0: + tests.add(CTest('iteration count', solver.nIt, 3, 1, forceabs=True)) tests.add(CTest('CL', solver.Cl, 0.135, 5e-2)) tests.add(CTest('CD', solver.Cd, 0.0062, 1e-2)) # Tranair (NF=0.0062, FF=0.0030), Panair 0.0035 else: diff --git a/flow/tests/meshDef.py b/flow/tests/meshDef.py index 0d2040a1e85742d6fdf5d2a7f6eefe9895f1fbcb..82e3b31248e1c76bb877d8e07a7c343d4867abde 100644 --- a/flow/tests/meshDef.py +++ b/flow/tests/meshDef.py @@ -188,6 +188,8 @@ def main(): # check results print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET) tests = CTests() + tests.add(CTest('solver: iteration count', solver.nIt, 5, 1, forceabs=True)) + tests.add(CTest('solver_ref: iteration count', solver.nIt, 5, 1, forceabs=True)) tests.add(CTest('min(Cp)', min(Cp[:,3]), min(Cp_ref[:,3]), 5e-2)) tests.add(CTest('Cl', solver.Cl, solver_ref.Cl, 5e-2)) tests.run() diff --git a/flow/tests/meshDef3.py b/flow/tests/meshDef3.py index 5a04160d98122d6d3dc404d6dc4eab67caea46b6..10cdedd32cb3896b35d5c14d093db259189c98e5 100644 --- a/flow/tests/meshDef3.py +++ b/flow/tests/meshDef3.py @@ -153,6 +153,7 @@ def main(): print(ccolors.ANSI_BLUE + 'PyTesting...' + ccolors.ANSI_RESET) tests = CTests() if alfa == 3*np.pi/180 and M_inf == 0.3 and spn == 1.0: + tests.add(CTest('iteration count', solver.nIt, 3, 1, forceabs=True)) tests.add(CTest('CL', solver.Cl, 0.135, 5e-1)) tests.add(CTest('CD', solver.Cd, 0.0062, 1e-2)) # Tranair (NF=0.0062, FF=0.0030), Panair 0.0035 tests.run() diff --git a/flow/tests/nonlift.py b/flow/tests/nonlift.py index 6e6b2ae3c462daba4770a7964d0f01148b1c05b8..55d299dbe672ba1f5fa3d1195b494f88878ae165 100644 --- a/flow/tests/nonlift.py +++ b/flow/tests/nonlift.py @@ -115,6 +115,7 @@ def main(): elif M_inf == 0.7: tests.add(CTest('min(Cp)', min(Cp[:,3]), -0.63, 5e-2)) elif M_inf == 0.8: + tests.add(CTest('iteration count', solver.nIt, 16, 3, forceabs=True)) tests.add(CTest('min(Cp)', min(Cp[:,3]), -0.89, 5e-2)) else: raise Exception('Test not defined for this flow')