Skip to content

Commit

Permalink
Correction sur commit precedent
Browse files Browse the repository at this point in the history
  • Loading branch information
Goul-tard committed Dec 22, 2024
1 parent 69a9472 commit 400841d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 13 deletions.
30 changes: 22 additions & 8 deletions examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@
#include <Eigen/Dense>

#include "demeter/model.hpp"
#include "demeter/solve.hpp"

int main() {
using namespace Demeter;
using namespace Eigen;

CheckOpenMP();


Eigen::Matrix2f A, b;
A << 2, -1, -1, 3; // sorted line by line
b << 1, 2, 3, 1;
std::cout << "Here is the matrix A:\n" << A << std::endl;
std::cout << "Here is the right hand side b:\n" << b << std::endl;
Eigen::Matrix2f x1 = A.ldlt().solve(b);
std::cout << "The solution is:\n" << x1 << std::endl;

Eigen::Matrix2f x2 = A.llt().solve(b);
std::cout << "The solution is:\n" << x2 << std::endl;


// Define variables
int ngroups = 2;
int naniso = 0;
Expand Down Expand Up @@ -73,15 +87,15 @@ int main() {
Lattice core{{assm00, assm01, assm10, assm11}, "core"};
std::cout << core << '\n';

// Set boundary conditions
//core.BoundaryCondition(BoundarySide::xmin, BoundaryCondition::Vacuum);
//core.BoundaryCondition(BoundarySide::xmax, BoundaryCondition::Reflection);
//// Set boundary conditions
////core.BoundaryCondition(BoundarySide::xmin, BoundaryCondition::Vacuum);
////core.BoundaryCondition(BoundarySide::xmax, BoundaryCondition::Reflection);

//// Define solver and solve the transport equation
//AngularMethod sn (AngularMethod::Type::SN, 2);
//SpatialMethod dg (SpatialMethod::Type::DG, 1);
//Solver solver(core, sn, dg);
//solver.solve();
////// Define solver and solve the transport equation
////AngularMethod sn (AngularMethod::Type::SN, 2);
////SpatialMethod dg (SpatialMethod::Type::DG, 1);
////Solver solver(core, sn, dg);
////solver.solve();

return 0;
}
3 changes: 2 additions & 1 deletion src/demeter/solve.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once

#include "solve/solver.hpp"
#include "solve/solver.hpp"
#include "solve/linear_solver.hpp"
3 changes: 3 additions & 0 deletions src/demeter/solve/linear_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
namespace Demeter {

void LinearSolver::solve_llt() {
std::cout << "Standard Cholesky decomposition" << std::endl;
}

void LinearSolver::solve_ldtl() {
std::cout << "Robust Cholesky decomposition with pivoting" << std::endl;
}

void LinearSolver::solve_PartialPivLu() {
std::cout << "Partial LU pivoting" << std::endl;
}

} // namespace Demeterr
4 changes: 2 additions & 2 deletions src/demeter/solve/linear_solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class LinearSolver {
public:

// Constructeur vide
Exemple() {
LinearSolver() {
// Initialisation par défaut
std::cout << "Constructeur vide" << std::endl;
}

void solve_llt();
void solve_ldtl();
void solve_PartialPivLu()
void solve_PartialPivLu();

private:
double tolerance = 1e-5;
Expand Down
2 changes: 1 addition & 1 deletion src/demeter/solve/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ void Solver::solve() {
// Calcul des sources
// Methode de la puissance iteree
}
} // namespace Demeter
} // namespace Demeter
5 changes: 4 additions & 1 deletion src/demeter/solve/solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Solver {
void solve();

const auto& getFlux() const { return flux_; }
const auto& getFiss() const { return fiss_; }
const auto& getPower() const { return power_; }

private:
Expand All @@ -24,9 +25,11 @@ class Solver {

double keff_ = 1.0;
ArrayXd flux_;
ArrayXd fiss_;
ArrayXd power_;

double tolerence_keff_ = 1e-5;
double tolerence_flux_ = 1e-5;
double tolerence_fiss_ = 1e-4;
};
} // namespace Demeter
} // namespace Demeter

0 comments on commit 400841d

Please sign in to comment.