mirror of
https://codeberg.org/vcbferreira/NuFI_deal.ii
synced 2026-08-12 14:33:18 +02:00
Added Jacobi preconditioner, removal of old comments
This commit is contained in:
+3
-3
@@ -17,7 +17,7 @@ constexpr double LX_INV = 1 / LX;
|
||||
constexpr double V_DOMAIN_LEFT = -10.;
|
||||
constexpr double V_DOMAIN_RIGHT = 10.;
|
||||
|
||||
constexpr unsigned int NV = 128;
|
||||
constexpr unsigned int NV = 256;
|
||||
constexpr double DV = std::abs(V_DOMAIN_RIGHT - V_DOMAIN_LEFT) / NV;
|
||||
|
||||
// f0_TYPE:
|
||||
@@ -30,11 +30,11 @@ constexpr size_t f0_TYPE = 1;
|
||||
// deal.ii options
|
||||
constexpr unsigned int GLOBAL_REFINEMENT = 8;
|
||||
constexpr unsigned int FE_DEGREE = 3;
|
||||
constexpr unsigned int CONVERGENCE_ITERATIONS = 5000;
|
||||
constexpr unsigned int CONVERGENCE_ITERATIONS = 10000;
|
||||
constexpr double CONVERGENCE_LIMIT = 1e-8;
|
||||
|
||||
// Adaptive refinement options
|
||||
constexpr unsigned int REFINE_FREQUENCY = 30;
|
||||
constexpr unsigned int REFINE_FREQUENCY = 50;
|
||||
constexpr double REFINEMENT_TOP_FRACTION = 0.8;
|
||||
constexpr double REFINEMENT_BOTTOM_FRACTION = 0.1;
|
||||
|
||||
|
||||
+4
-22
@@ -458,29 +458,11 @@ template <int dim> void PoissonProblem<dim>::solve(size_t it) {
|
||||
system_rhs.l2_norm());
|
||||
SolverCG<Vector<double>> solver(solver_control);
|
||||
|
||||
solver.solve(system_matrix, solution, system_rhs, PreconditionIdentity());
|
||||
constraints.distribute(solution);
|
||||
PreconditionJacobi<SparseMatrix<double>> preconditioner;
|
||||
preconditioner.initialize(system_matrix);
|
||||
|
||||
// std::ofstream out("results/phi_after_solve_" + std::to_string(it) +
|
||||
// ".dat"); std::vector<std::pair<double, double>> data;
|
||||
//
|
||||
// const auto support =
|
||||
// DoFTools::map_dofs_to_support_points(mapping, dof_handler);
|
||||
//
|
||||
// for (const auto &[dof, p] : support) {
|
||||
// data.emplace_back(p[0], solution[dof]);
|
||||
// }
|
||||
//
|
||||
// std::sort(data.begin(), data.end());
|
||||
//
|
||||
// for (const auto &[x, value] : data) {
|
||||
// out << x << " " << value << "\n";
|
||||
// }
|
||||
//
|
||||
// std::vector<double> E_x =
|
||||
// sample_electric_field(Parameters::X_DOMAIN_LEFT,
|
||||
// Parameters::X_DOMAIN_RIGHT, Parameters::PLOT_NX);
|
||||
// save_space_vector(E_x, "E_x_after_solve", it);
|
||||
solver.solve(system_matrix, solution, system_rhs, preconditioner);
|
||||
constraints.distribute(solution);
|
||||
}
|
||||
|
||||
template <int dim> void PoissonProblem<dim>::initialize() {
|
||||
|
||||
Reference in New Issue
Block a user