richards.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef RICHARDS_HPP
  2. #define RICHARDS_HPP
  3. #include <iostream>
  4. #include <limits>
  5. #include <cassert>
  6. #include "physics.hpp"
  7. #include "math/algo.hpp"
  8. #include "debug.hpp"
  9. using namespace std;
  10. namespace Kernel{
  11. class Richards{
  12. private:
  13. static constexpr size_t max_iterations_Richards=50;
  14. static constexpr double tolerence_Richards=1e-10;
  15. double* pumps;
  16. double* sup_A;
  17. double* diag_A;
  18. double* sub_A;
  19. double* sup_B;
  20. double* diag_B;
  21. double* sub_B;
  22. double* sup_C;
  23. double* diag_C;
  24. double* sub_C;
  25. double* F;
  26. double* G;
  27. double* S;
  28. double* H;
  29. double* R;
  30. double* I;
  31. double* BB;
  32. size_t ix;
  33. size_t nZ;
  34. double dZ;
  35. double norm_previous_P;
  36. bool weighted_run(double w);
  37. void solve_system();
  38. double* temp_P[2];
  39. double* in_P;
  40. double* out_P;
  41. public:
  42. double dt;
  43. double flux_bot;
  44. double* div_w;
  45. double* near_P; //for Newton algorithm
  46. double* previous_P; //previous relatively to n2
  47. double* P;
  48. bool has_converged;
  49. Richards();
  50. void init(size_t ix,size_t nZ,double dZ,double* pumps);
  51. void run();
  52. };
  53. }
  54. #endif