From 758fb68adc0702888bb53ac930d5741762ef6cff Mon Sep 17 00:00:00 2001 From: carpemonf Date: Fri, 23 Sep 2022 17:24:51 +0200 Subject: [PATCH 01/44] Reverting unrelated changes to the feature --- src/ITHACA_CORE/ITHACAstream/ITHACAstream.C | 34 +++++++------------ .../splinter/src/rbfspline.C | 6 ++-- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/ITHACA_CORE/ITHACAstream/ITHACAstream.C b/src/ITHACA_CORE/ITHACAstream/ITHACAstream.C index 112d5ec1a0..52a47f2565 100644 --- a/src/ITHACA_CORE/ITHACAstream/ITHACAstream.C +++ b/src/ITHACA_CORE/ITHACAstream/ITHACAstream.C @@ -117,30 +117,10 @@ void exportMatrix(Eigen::Matrix < T, -1, dim > & matrix, if (type == "eigen") { - const static Eigen::IOFormat CSVFormat(6, false, ", ", "\n"); std::ofstream ofs; - ofs.precision(20); ofs.open (folder + "/" + Name + "_mat.txt"); - for (int i = 0; i < matrix.rows(); i++) - { - for (int j = 0; j < matrix.cols(); j++) - { - if (j == 0) - { - ofs << matrix(i,j); - } - else - { - ofs << " " << matrix(i,j); - } - } - - if (i != (matrix.rows() - 1)) - { - ofs << std::endl; - } - } - + ofs.precision(20); + ofs << matrix << std::endl; ofs.close(); } } @@ -749,6 +729,8 @@ void exportSolution(GeometricField& s, ITHACAutilities::createSymLink(folder); GeometricField act(fieldName, s); fileName fieldname = folder + "/" + subfolder + "/" + fieldName; + std::ofstream of(folder + "/" + subfolder + "/" + + s.time().timeName()); OFstream os(fieldname); act.writeHeader(os); os << act << endl; @@ -760,6 +742,9 @@ void exportSolution(GeometricField& s, GeometricField act(fieldName, s); fileName fieldname = folder + "/processor" + name(Pstream::myProcNo()) + "/" + subfolder + "/" + fieldName; + std::ofstream of(folder + "/processor" + name(Pstream::myProcNo()) + "/" + + subfolder + "/" + + s.time().timeName()); std::cout << fieldname << std::endl; OFstream os(fieldname); act.writeHeader(os); @@ -792,6 +777,8 @@ void exportSolution(GeometricField& s, { mkDir(folder + "/" + subfolder); ITHACAutilities::createSymLink(folder); + std::ofstream of(folder + "/" + subfolder + "/" + + s.time().timeName()); fileName fieldname = folder + "/" + subfolder + "/" + s.name(); OFstream os(fieldname); s.writeHeader(os); @@ -801,6 +788,9 @@ void exportSolution(GeometricField& s, { mkDir(folder + "/processor" + name(Pstream::myProcNo()) + "/" + subfolder); ITHACAutilities::createSymLink(folder); + std::ofstream of(folder + "/processor" + name(Pstream::myProcNo()) + "/" + + subfolder + "/" + + s.time().timeName()); fileName fieldname = folder + "/processor" + name(Pstream::myProcNo()) + "/" + subfolder + "/" + s.name(); OFstream os(fieldname); diff --git a/src/ITHACA_THIRD_PARTY/splinter/src/rbfspline.C b/src/ITHACA_THIRD_PARTY/splinter/src/rbfspline.C index cc203cf030..e556648646 100755 --- a/src/ITHACA_THIRD_PARTY/splinter/src/rbfspline.C +++ b/src/ITHACA_THIRD_PARTY/splinter/src/rbfspline.C @@ -155,7 +155,7 @@ RBFSpline::RBFSpline(const DataTable& samples, RadialBasisFunctionType type, std::cout << "The radius of the RBF is equal to " << e << std::endl; #endif // NDEBUG // SVD analysis - Eigen::JacobiSVD svd(A, Eigen::ComputeThinU | Eigen::ComputeThinV); + // Eigen::JacobiSVD svd(A, Eigen::ComputeThinU | Eigen::ComputeThinV); // auto svals = svd.singularValues(); // double svalmax = svals(0); // double svalmin = svals(svals.rows() - 1); @@ -167,8 +167,8 @@ RBFSpline::RBFSpline(const DataTable& samples, RadialBasisFunctionType type, // << std::endl; // #endif // NDEBUG // // Solve for weights - weights = svd.solve(b); - //weights = A.colPivHouseholderQr().solve(b); + // weights = svd.solve(b); + weights = A.colPivHouseholderQr().solve(b); #ifndef NDEBUG // Compute error. If it is used later on, move this statement above the NDEBUG double err = (A * weights - b).norm() / b.norm(); From d124e22ec595790abcc48388c2a2fec4c94cc956 Mon Sep 17 00:00:00 2001 From: carpemonf Date: Fri, 23 Sep 2022 17:26:25 +0200 Subject: [PATCH 02/44] Fixing newtonObject variables --- .../ReducedSteadyNSTurb/ReducedSteadyNSTurb.C | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/ITHACA_ROMPROBLEMS/ReducedSteadyNSTurb/ReducedSteadyNSTurb.C b/src/ITHACA_ROMPROBLEMS/ReducedSteadyNSTurb/ReducedSteadyNSTurb.C index e23345366f..4ec1d49b30 100644 --- a/src/ITHACA_ROMPROBLEMS/ReducedSteadyNSTurb/ReducedSteadyNSTurb.C +++ b/src/ITHACA_ROMPROBLEMS/ReducedSteadyNSTurb/ReducedSteadyNSTurb.C @@ -240,16 +240,11 @@ void ReducedSteadyNSTurb::solveOnlineSUP(Eigen::MatrixXd vel) newtonObjectSUP.bc.resize(N_BC); newtonObjectSUP.tauU = tauU; - Eigen::MatrixXd param(N_BC + 1 , 1); - for (int j = 0; j < N_BC; j++) { - newtonObject.bc(j) = vel_now(j, 0); - param(j, 0) = vel_now(j, 0); + newtonObjectSUP.bc(j) = vel_now(j, 0); } - param(N_BC, 0) = nu; - if (problem->viscCoeff == "L2") { for (int i = 0; i < nphiNut; i++) @@ -261,9 +256,8 @@ void ReducedSteadyNSTurb::solveOnlineSUP(Eigen::MatrixXd vel) { for (int i = 0; i < nphiNut; i++) { - //newtonObject.gNut(i) = problem->rbfSplines[i]->eval(vel_now); - newtonObject.gNut(i) = problem->rbfSplines[i]->eval(param); - rbfCoeff = newtonObject.gNut; + newtonObjectSUP.gNut(i) = problem->rbfSplines[i]->eval(vel_now); + rbfCoeff = newtonObjectSUP.gNut; } } else From a2680c9511ca3730c99cdcacfd7753284ab903f7 Mon Sep 17 00:00:00 2001 From: carpemonf Date: Fri, 23 Sep 2022 17:27:39 +0200 Subject: [PATCH 03/44] Changing back supremizer as default for 06POD_RBF tutorial --- tutorials/CFD/06POD_RBF/system/ITHACAdict | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/CFD/06POD_RBF/system/ITHACAdict b/tutorials/CFD/06POD_RBF/system/ITHACAdict index 5e8e385c52..864081c194 100755 --- a/tutorials/CFD/06POD_RBF/system/ITHACAdict +++ b/tutorials/CFD/06POD_RBF/system/ITHACAdict @@ -18,7 +18,7 @@ FoamFile EigenSolver eigen; // Stabilization, can be supremizer or PPE -Stabilization PPE; +Stabilization supremizer; // Number of modes to output and to use for projection NmodesU 8; From c6aed0db375d85356eeed50b1364ef9696eb717e Mon Sep 17 00:00:00 2001 From: Moaad Khamlich Date: Wed, 28 Sep 2022 11:39:14 +0200 Subject: [PATCH 04/44] FIX: remove Gtest unit testing --- .github/workflows/unit_test.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100755 .github/workflows/unit_test.yml diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml deleted file mode 100755 index 3b25bcf7d9..0000000000 --- a/.github/workflows/unit_test.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Unit Testing - -on: - push: - branches: [ master ] - -jobs: - gtest: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Running docker container with openfoam - run : docker run -v "$PWD/:/root" opencfd/openfoam2106-dev /root/gtest/script.sh From bfe764dc1d4f71eb6b6329145b0b5bcf7b526335 Mon Sep 17 00:00:00 2001 From: giovastabile Date: Fri, 30 Sep 2022 09:30:07 +0200 Subject: [PATCH 05/44] FIX: fixed bug in the check of indices in the DEIM algorithm for vectorial fields --- src/ITHACA_DEIM/DEIM.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ITHACA_DEIM/DEIM.C b/src/ITHACA_DEIM/DEIM.C index fa09dc1e80..515cd5ba8e 100644 --- a/src/ITHACA_DEIM/DEIM.C +++ b/src/ITHACA_DEIM/DEIM.C @@ -80,6 +80,7 @@ DEIM::DEIM (PtrList& s, label MaxModes, word FunctionName, word FieldName) Eigen::VectorXd r; Eigen::VectorXd rho(1); MatrixModes = Foam2Eigen::PtrList2Eigen(modes); + Ncells = modes[0].size(); label ind_max, c1, xyz_in; double max = MatrixModes.cwiseAbs().col(0).maxCoeff(&ind_max, &c1); check3DIndices(ind_max, xyz_in); @@ -103,8 +104,8 @@ DEIM::DEIM (PtrList& s, label MaxModes, word FunctionName, word FieldName) U.col(i) = MatrixModes.col(i); rho.conservativeResize(i + 1); rho(i) = max; - magicPoints().append(ind_max); check3DIndices(ind_max, xyz_in); + magicPoints().append(ind_max); xyz().append(xyz_in); } @@ -680,7 +681,7 @@ void DEIM::check3DIndices(label& ind_rowA, label& ind_colA, label& xyz_rowA, else if (ind_colA < Ncells * 2) { xyz_colA = 1; - ind_colA = ind_colA - 2 * Ncells; + ind_colA = ind_colA - Ncells; } else { From cda341cc0e884bd88282114abff1ac158cbbabfc Mon Sep 17 00:00:00 2001 From: Moaad Date: Thu, 3 Nov 2022 10:25:56 +0100 Subject: [PATCH 06/44] ENH: templatization of errorFrobRel --- src/ITHACA_CORE/ITHACAutilities/ITHACAerror.C | 12 ++++++++---- src/ITHACA_CORE/ITHACAutilities/ITHACAerror.H | 9 ++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/ITHACA_CORE/ITHACAutilities/ITHACAerror.C b/src/ITHACA_CORE/ITHACAutilities/ITHACAerror.C index d536504756..270b833e89 100644 --- a/src/ITHACA_CORE/ITHACAutilities/ITHACAerror.C +++ b/src/ITHACA_CORE/ITHACAutilities/ITHACAerror.C @@ -265,10 +265,10 @@ template double errorL2Abs(GeometricField& field1, GeometricField& field2, List