piccard.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef PICCARD_HPP
  2. #define PICCARD_HPP
  3. #include <cstring>
  4. #include "solution.hpp"
  5. #include "horizontal_problem.hpp"
  6. #include "all_vertical_richards.hpp"
  7. #include "overland.hpp"
  8. namespace Kernel{
  9. //! A class implementing Piccard algorithm
  10. class Piccard{
  11. private:
  12. static constexpr double tolerence_Piccard=1e-6;
  13. static constexpr double oscilation_Piccard=1e-4;
  14. static constexpr size_t max_iterations_Piccard=50;
  15. //! Geometry of the simulation
  16. const Geometry* geometry;
  17. //! A pointer to an HorizontalProblem object
  18. HorizontalProblem horizontal_problem;
  19. //! A pointer to an Overland object
  20. Overland overland;
  21. //! A pointer to an AllVerticalRichards object
  22. AllVerticalRichards all_vertical_richards;
  23. double *l;
  24. double *Pl;
  25. //! Compute l from h and hsat
  26. void compute_l(double* h,double* hsat,double& error);
  27. //! Compute Pl from l and P
  28. void compute_Pl(double** P);
  29. public:
  30. double dt;
  31. Solution* previous_solution;
  32. Solution* new_solution;
  33. bool has_converged;
  34. //! Construct an empty Piccard object
  35. Piccard();
  36. //! Init from a Geometry
  37. void init(const Geometry* geometry);
  38. //! Compute a new Solution form a previous once.
  39. //! The delta time depends of the number of subdivisions required by Solver::space_solution.
  40. void run();
  41. };
  42. }
  43. #endif