linear_solvers/direct_solver_test.cc File Reference
#include "generic.h"
#include "poisson.h"
#include "meshes/one_d_mesh.h"

Classes

class  OneDPoissonProblem< ELEMENT >
 1D Poisson problem in unit interval. More...
 

Namespaces

 FishSolnOneDPoisson
 Namespace for fish-shaped solution of 1D Poisson equation.
 

Functions

void FishSolnOneDPoisson::get_exact_u (const Vector< double > &x, Vector< double > &u)
 Exact, fish-shaped solution as a 1D vector. More...
 
void FishSolnOneDPoisson::source_function (const Vector< double > &x, double &source)
 Source function required to make the fish shape an exact solution. More...
 
int main (int argc, char **argv)
 Driver for 1D Poisson problem. More...
 

Variables

int FishSolnOneDPoisson::Sign =-1
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Driver for 1D Poisson problem.

//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////

274 {
275  //Number of elements
276  unsigned n_element=40;
277 
278  // global distribution
279  // LinearAlgebraDistribution
280  // distributed_dist(problem.communicator_pt(),ndof,true);
281 
282  // the doc info
283  DocInfo doc_info;
284  doc_info.set_directory("RESLT");
285 
286 
288  // DenseLU Test
290 
291  // MATRIX BASED SOLVE / DenseDoubleMatrix
292  {
293  oomph_info
294  << "///////////////////////////////////////////////////////////////////////"
295  << std::endl;
296  oomph_info << "TESTING: DenseLU matrix based solve w/ DenseDoubleMatrix"
297  << std::endl;
298  oomph_info
299  << "///////////////////////////////////////////////////////////////////////"
300  << std::endl << std::endl;
304  DoubleVector b;
305  DoubleVector x;
306  DenseLU solver;
307  problem.get_jacobian(b,A);
308  solver.enable_doc_time();
309  solver.solve(&A,b,x);
310  x.output("RESLT/DenseLU_DenseDoubleMatrix.dat");
311  }
312 
313  // PROBLEM BASED SOLVE
314  {
315  oomph_info
316  << "///////////////////////////////////////////////////////////////////////"
317  << std::endl;
318  oomph_info << "TESTING: DenseLU problem based solve"
319  << std::endl;
320  oomph_info
321  << "///////////////////////////////////////////////////////////////////////"
322  << std::endl << std::endl;
325  DoubleVector x;
326  DenseLU solver;
327  problem.linear_solver_pt() = &solver;
328  problem.newton_solve();
329  problem.doc_solution(doc_info);
330  problem.zero_dofs();
331  }
332 
334  // FD_LU Test
336 
337  // PROBLEM BASED SOLVE
338  {
339  oomph_info
340  << "///////////////////////////////////////////////////////////////////////"
341  << std::endl;
342  oomph_info << "TESTING: FD_LU problem based solve"
343  << std::endl;
344  oomph_info
345  << "///////////////////////////////////////////////////////////////////////"
346  << std::endl << std::endl;
349  FD_LU solver;
350  problem.linear_solver_pt() = &solver;
351  problem.newton_solve();
352  doc_info.number()++;
353  problem.doc_solution(doc_info);
354  problem.zero_dofs();
355  }
356 
357 
359  // SuperLU Test
361 
362  // MATRIX BASED SOLVE / CRDoubleMatrix (global)
363  {
364  oomph_info
365  << "///////////////////////////////////////////////////////////////////////"
366  << std::endl;
367  oomph_info << "TESTING: SuperLU matrix based solve w/ global CRDoubleMatrix"
368  << std::endl;
369  oomph_info
370  << "///////////////////////////////////////////////////////////////////////"
371  << std::endl << std::endl;
374  unsigned ndof = problem.ndof();
375  LinearAlgebraDistribution global_dist(problem.communicator_pt(),ndof,false);
376  CRDoubleMatrix A(&global_dist);
377  DoubleVector b(&global_dist,0.0);
378  DoubleVector x(&global_dist,0.0);
380  problem.get_jacobian(b,A);
381  solver.enable_doc_time();
382  solver.solve(&A,b,x);
383  x.output("RESLT/SuperLU_CRDoubleMatrix.dat");
384  }
385 
386  // MATRIX BASED SOLVE / CCDoubleMatrix
387  {
388  oomph_info
389  << "///////////////////////////////////////////////////////////////////////"
390  << std::endl;
391  oomph_info << "TESTING: SuperLU matrix based solve w/ CCDoubleMatrix"
392  << std::endl;
393  oomph_info
394  << "///////////////////////////////////////////////////////////////////////"
395  << std::endl << std::endl;
399  DoubleVector b;
400  DoubleVector x;
402  problem.get_jacobian(b,A);
403  solver.enable_doc_time();
404  solver.solve(&A,b,x);
405  x.output("RESLT/SuperLU_CCDoubleMatrix.dat");
406  }
407 
408  // PROBLEM BASED SOLVE
409  {
410  oomph_info
411  << "///////////////////////////////////////////////////////////////////////"
412  << std::endl;
413  oomph_info << "TESTING: SuperLU problem based solve"
414  << std::endl;
415  oomph_info
416  << "///////////////////////////////////////////////////////////////////////"
417  << std::endl << std::endl;
420  DoubleVector x;
422  problem.linear_solver_pt() = &solver;
423  problem.newton_solve();
424  doc_info.number()++;
425  problem.doc_solution(doc_info);
426  problem.zero_dofs();
427  }
428 
429 } // end of main
BiCGSTAB< SparseMatrix< double > > solver
Definition: BiCGSTAB_simple.cpp:5
Scalar * b
Definition: benchVecAdd.cpp:17
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition: bench_gemm.cpp:47
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
1D Poisson problem in unit interval.
Definition: linear_solvers/direct_solver_test.cc:81
A class for compressed column matrices that store doubles.
Definition: matrices.h:2791
Definition: matrices.h:888
Definition: matrices.h:1271
Definition: linear_solver.h:334
Definition: oomph_utilities.h:499
void set_directory(const std::string &directory)
Definition: oomph_utilities.cc:298
unsigned & number()
Number used (e.g.) for labeling output files.
Definition: oomph_utilities.h:554
Definition: double_vector.h:58
Definition: linear_solver.h:432
Definition: linear_algebra_distribution.h:64
Definition: linear_solver.h:486
void source_function(const Vector< double > &x, double &source)
Source function required to make the fish shape an exact solution.
Definition: linear_solvers/direct_solver_test.cc:63
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
list x
Definition: plotDoE.py:28
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References b, oomph::DocInfo::number(), oomph::oomph_info, problem, oomph::DocInfo::set_directory(), solver, FishSolnOneDPoisson::source_function(), and plotDoE::x.