richards.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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* sup_A;
  16. double* diag_A;
  17. double* sub_A;
  18. double* sup_B;
  19. double* diag_B;
  20. double* sub_B;
  21. double* sup_C;
  22. double* diag_C;
  23. double* sub_C;
  24. double* F;
  25. double* G;
  26. double* S;
  27. double* H;
  28. double* R;
  29. double* I;
  30. double* BB;
  31. size_t ix;
  32. size_t nZ;
  33. double dZ;
  34. double norm_previous_P;
  35. bool weighted_run(double w);
  36. void solve_system();
  37. double* temp_P[2];
  38. double* in_P;
  39. double* out_P;
  40. public:
  41. double dt;
  42. double flux_bot;
  43. double* div_w;
  44. double* near_P; //for Newton algorithm
  45. double* previous_P; //previous relatively to n2
  46. double* P;
  47. bool has_converged;
  48. Richards();
  49. void init(size_t ix,size_t nZ,double dZ);
  50. void run();
  51. };
  52. }
  53. #endif