dispersion.hpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * @file tests/plot/dispersion.hpp
  3. * @author The PARADEVS Development Team
  4. * See the AUTHORS or Authors.txt file
  5. */
  6. /*
  7. * PARADEVS - the multimodeling and simulation environment
  8. * This file is a part of the PARADEVS environment
  9. *
  10. * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation, either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. #ifndef TESTS_PLOT_DISPERSION_HPP
  26. #define TESTS_PLOT_DISPERSION_HPP 1
  27. namespace paradevs { namespace tests { namespace plot {
  28. #define SCALE 4
  29. class KleinDispersionFunction
  30. {
  31. public:
  32. KleinDispersionFunction()
  33. {
  34. }
  35. virtual double operator()(
  36. typename common::DoubleTime::type t,
  37. const paradevs::tests::boost_graph::Point& source,
  38. const paradevs::tests::boost_graph::Point& destination,
  39. double wind_speed,
  40. double wind_direction) const
  41. {
  42. double distance = std::sqrt(
  43. (destination._x - source._x) * (destination._x - source._x) +
  44. (destination._y - source._y) * (destination._y - source._y));
  45. double r, rt;
  46. r = distance * SCALE / 100;
  47. if (r <= 1.5) {
  48. rt = 0.340 - 0.405 * r + 0.128 * std::pow (r, 2.0);
  49. } else if (r <= 50) {
  50. rt = 0.03985 / (1.0 + std::pow (r, 3.12) / 3.80);
  51. } else { // r > 50m
  52. double rr, gamma, K;
  53. rr = 50;
  54. gamma = -2.29;
  55. //valeur la plus lourde -2.14, + legere - 2.56
  56. K = (0.03985 / (1.0 + std::pow (rr, 3.12) / 3.80)) / std::pow (1.0 + rr, gamma);
  57. rt = K * std::pow (1.0 + r, gamma);
  58. // std::cout << _index << "\t" << t << "\t" << r << "\t" << K << "\t" << rr << "\t" << rt << "\t" << value << std::endl;
  59. }
  60. return rt;
  61. }
  62. };
  63. } } } // namespace paradevs tests plot
  64. #endif