diff --git a/.gitignore b/.gitignore index 471b059..9c56d00 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ *.dat *.png +# gdb history +.gdb_history + # special directories doc/html/ exe/ @@ -37,3 +40,4 @@ references/ shared/ static/ wiki/ +venv/ diff --git a/fobos b/fobos index e2e9a04..d84e270 100644 --- a/fobos +++ b/fobos @@ -236,7 +236,7 @@ help = Perform coverage analysis rule_1 = FoBiS.py clean -mode tests-gnu rule_2 = FoBiS.py build -mode tests-gnu -coverage rule_3 = ./scripts/run_tests.sh -rule_4 = rm -f exe/obj/penf* exe/obj/face* exe/obj/flap* exe/obj/flow* exe/obj/foodie* exe/obj/vecfor* +rule_4 = rm -f exe/obj/face* exe/obj/flap* exe/obj/flow* exe/obj/foodie* exe/obj/foreseer* exe/obj/penf* exe/obj/pyplot* exe/obj/vecfor* rule_5 = gcov -o exe/obj/ src/lib/wenoof* rule_6 = rm -f *.gcov @@ -245,7 +245,7 @@ help = Perform coverage analysis and saving reports in markdown rule_1 = FoBiS.py clean -mode tests-gnu rule_2 = FoBiS.py build -mode tests-gnu -coverage rule_3 = ./scripts/run_tests.sh -rule_4 = rm -f exe/obj/penf* exe/obj/face* exe/obj/flap* exe/obj/flow* exe/obj/foodie* exe/obj/vecfor* +rule_4 = rm -f exe/obj/face* exe/obj/flap* exe/obj/flow* exe/obj/foodie* exe/obj/foreseer* exe/obj/penf* exe/obj/pyplot* exe/obj/vecfor* rule_5 = gcov -o exe/obj/ src/lib/wenoof* rule_6 = FoBiS.py rule -gcov_analyzer wiki/ Coverage-Analysis rule_7 = rm -f *.gcov diff --git a/src/lib/abstract_objects/wenoof_alpha_object.F90 b/src/lib/abstract_objects/wenoof_alpha_object.F90 index f0f0168..ba3613f 100644 --- a/src/lib/abstract_objects/wenoof_alpha_object.F90 +++ b/src/lib/abstract_objects/wenoof_alpha_object.F90 @@ -23,8 +23,10 @@ module wenoof_alpha_object type, extends(base_object), abstract :: alpha_object !< Abstract alpha (non linear weights) object. - real(RPP), allocatable :: values(:,:) !< Alpha coefficients [1:2,0:S-1]. - real(RPP), allocatable :: values_sum(:) !< Sum of alpha coefficients [1:2]. + real(RPP), allocatable :: values_rank_1(:) !< Alpha values [0:S-1]. + real(RPP) :: values_sum_rank_1 !< Sum of alpha coefficients. + real(RPP), allocatable :: values_rank_2(:,:) !< Alpha values [1:2,0:S-1]. + real(RPP), allocatable :: values_sum_rank_2(:) !< Sum of alpha coefficients [1:2]. contains ! public deferred methods procedure(compute_interface), pass(self), deferred :: compute !< Compute alpha. diff --git a/src/lib/abstract_objects/wenoof_base_object.F90 b/src/lib/abstract_objects/wenoof_base_object.F90 index 044f11c..50cbf9a 100644 --- a/src/lib/abstract_objects/wenoof_base_object.F90 +++ b/src/lib/abstract_objects/wenoof_base_object.F90 @@ -20,8 +20,6 @@ module wenoof_base_object type, abstract :: base_object_constructor !< Abstract base object constructor. integer(I_P) :: S=0_I_P !< Stencils dimension. - logical :: face_left=.true. !< Activate left-face interpolation computation. - logical :: face_right=.true. !< Activate right-face interpolation computation. real(RPP) :: eps=EPS_DEF !< Small epsilon to avoid division by zero. contains procedure, pass(self) :: create => create_base_object_constructor @@ -32,9 +30,6 @@ module wenoof_base_object !< !< Define a minimal, base, object that is used as ancestor of all objects, e.g. smoothness indicator, optimal weights, etc... integer(I_P) :: S=0_I_P !< Stencils dimension. - integer(I_P) :: f1=1_I_P !< Lower bound of faces index. - integer(I_P) :: f2=2_I_P !< Upper bound of faces index. - integer(I_P) :: ff=0_I_P !< Offset (step) of faces index. real(RPP) :: eps=EPS_DEF !< Small epsilon to avoid division by zero. contains ! public deferred methods @@ -75,17 +70,13 @@ elemental subroutine destroy_interface(self) ! base object constructor ! public methods - subroutine create_base_object_constructor(self, S, face_left, face_right, eps) + subroutine create_base_object_constructor(self, S, eps) !< Create alpha constructor. class(base_object_constructor), intent(inout) :: self !< Constructor. integer(I_P), intent(in) :: S !< Stencils dimension. - logical, intent(in), optional :: face_left !< Activate left-face interpolations. - logical, intent(in), optional :: face_right !< Activate right-face interpolations. real(RPP), intent(in), optional :: eps !< Small epsilon to avoid division by zero. self%S = S - if (present(face_left)) self%face_left = face_left - if (present(face_right)) self%face_right = face_right if (present(eps)) self%eps = eps endsubroutine create_base_object_constructor @@ -101,13 +92,6 @@ subroutine create_(self, constructor) select type(constructor) class is(base_object_constructor) self%S = constructor%S - if (constructor%face_left.and.constructor%face_right) then - self%f1 = 1_I_P; self%f2 = 2_I_P; self%ff = 0_I_P - elseif (constructor%face_left) then - self%f1 = 1_I_P; self%f2 = 1_I_P; self%ff = 0_I_P - elseif (constructor%face_right) then - self%f1 = 2_I_P; self%f2 = 2_I_P; self%ff = -1_I_P - endif self%eps = constructor%eps endselect endsubroutine create_ @@ -117,9 +101,6 @@ elemental subroutine destroy_(self) class(base_object), intent(inout) :: self !< Object. self%S = 0_I_P - self%f1 = 1_I_P - self%f2 = 2_I_P - self%ff = 0_I_P self%eps = EPS_DEF endsubroutine destroy_ endmodule wenoof_base_object diff --git a/src/lib/abstract_objects/wenoof_beta_object.F90 b/src/lib/abstract_objects/wenoof_beta_object.F90 index 1711c3b..768207b 100644 --- a/src/lib/abstract_objects/wenoof_beta_object.F90 +++ b/src/lib/abstract_objects/wenoof_beta_object.F90 @@ -20,20 +20,31 @@ module wenoof_beta_object type, extends(base_object), abstract :: beta_object !< Abstract Beta coefficients (smoothness indicators of stencil interpolations) object. - real(RPP), allocatable :: values(:,:) !< Beta values [1:2,0:S-1]. + real(RPP), allocatable :: values_rank_1(:) !< Beta values [0:S-1]. + real(RPP), allocatable :: values_rank_2(:,:) !< Beta values [1:2,0:S-1]. contains - ! public deferred methods - procedure(compute_interface), pass(self), deferred :: compute !< Compute beta. + ! public methods + generic :: compute => compute_with_stencil_of_rank_1, compute_with_stencil_of_rank_2 + ! deferred public methods + procedure(compute_with_stencil_of_rank_1_interface), pass(self), deferred :: compute_with_stencil_of_rank_1!< Compute beta. + procedure(compute_with_stencil_of_rank_2_interface), pass(self), deferred :: compute_with_stencil_of_rank_2!< Compute beta. endtype beta_object abstract interface !< Abstract interfaces of [[beta_object]]. - pure subroutine compute_interface(self, stencil) + pure subroutine compute_with_stencil_of_rank_1_interface(self, stencil) + !< Compute beta. + import :: beta_object, RPP + class(beta_object), intent(inout) :: self !< Beta. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + endsubroutine compute_with_stencil_of_rank_1_interface + + pure subroutine compute_with_stencil_of_rank_2_interface(self, stencil) !< Compute beta. import :: beta_object, RPP class(beta_object), intent(inout) :: self !< Beta. real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. - endsubroutine compute_interface + endsubroutine compute_with_stencil_of_rank_2_interface endinterface endmodule wenoof_beta_object diff --git a/src/lib/abstract_objects/wenoof_interpolations_object.F90 b/src/lib/abstract_objects/wenoof_interpolations_object.F90 index 599622c..998666e 100644 --- a/src/lib/abstract_objects/wenoof_interpolations_object.F90 +++ b/src/lib/abstract_objects/wenoof_interpolations_object.F90 @@ -16,24 +16,37 @@ module wenoof_interpolations_object type, extends(base_object_constructor), abstract :: interpolations_object_constructor !< Abstract interpolations object constructor. + real(RPP), allocatable :: stencil(:) !< Stencil used for interpolation, [1-S:S-1]. + real(RPP) :: x_target !< Coordinate of the interpolation point. endtype interpolations_object_constructor type, extends(base_object), abstract :: interpolations_object !< Abstract interpolations object. - real(RPP), allocatable :: values(:,:) !< Stencil interpolations values [1:2,0:S-1]. + real(RPP), allocatable :: values_rank_1(:) !< Stencil interpolations values [0:S-1]. + real(RPP), allocatable :: values_rank_2(:,:) !< Stencil interpolations values [1:2,0:S-1]. contains - ! public deferred methods - procedure(compute_interface), pass(self), deferred :: compute !< Compute beta. + ! public methods + generic :: compute => compute_with_stencil_of_rank_1, compute_with_stencil_of_rank_2 + ! deferred public methods + procedure(compute_with_stencil_of_rank_1_interface), pass(self), deferred :: compute_with_stencil_of_rank_1!< Compute interp. + procedure(compute_with_stencil_of_rank_2_interface), pass(self), deferred :: compute_with_stencil_of_rank_2!< Compute interp. endtype interpolations_object abstract interface !< Abstract interfaces of [[interpolations_object]]. - pure subroutine compute_interface(self, stencil) + pure subroutine compute_with_stencil_of_rank_1_interface(self, stencil) + !< Compute interpolations. + import :: interpolations_object, RPP + class(interpolations_object), intent(inout) :: self !< Interpolations. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + endsubroutine compute_with_stencil_of_rank_1_interface + + pure subroutine compute_with_stencil_of_rank_2_interface(self, stencil) !< Compute interpolations. import :: interpolations_object, RPP class(interpolations_object), intent(inout) :: self !< Interpolations. real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. - endsubroutine compute_interface + endsubroutine compute_with_stencil_of_rank_2_interface endinterface endmodule wenoof_interpolations_object diff --git a/src/lib/abstract_objects/wenoof_interpolator_object.F90 b/src/lib/abstract_objects/wenoof_interpolator_object.F90 index 45cf577..7d05c4e 100644 --- a/src/lib/abstract_objects/wenoof_interpolator_object.F90 +++ b/src/lib/abstract_objects/wenoof_interpolator_object.F90 @@ -31,16 +31,33 @@ module wenoof_interpolator_object class(interpolations_object), allocatable :: interpolations !< Stencil interpolations. class(weights_object), allocatable :: weights !< Weights of interpolations. contains - ! public deferred methods - procedure(interpolate_debug_interface), pass(self), deferred :: interpolate_debug !< Interpolate values, debug mode. - procedure(interpolate_standard_interface), pass(self), deferred :: interpolate_standard !< Interpolate values, standard mode. ! public methods - generic :: interpolate => interpolate_standard, interpolate_debug !< Interpolate values. + generic :: interpolate => interpolate_with_stencil_of_rank_1_debug, interpolate_with_stencil_of_rank_2_debug, & + interpolate_with_stencil_of_rank_1_standard, interpolate_with_stencil_of_rank_2_standard + ! public deferred methods + procedure(interpolate_with_stencil_of_rank_1_debug_interface), pass(self), & + deferred :: interpolate_with_stencil_of_rank_1_debug + procedure(interpolate_with_stencil_of_rank_2_debug_interface), pass(self), & + deferred :: interpolate_with_stencil_of_rank_2_debug + procedure(interpolate_with_stencil_of_rank_1_standard_interface), pass(self), & + deferred :: interpolate_with_stencil_of_rank_1_standard + procedure(interpolate_with_stencil_of_rank_2_standard_interface), pass(self), & + deferred :: interpolate_with_stencil_of_rank_2_standard endtype interpolator_object abstract interface !< Abstract interfaces of [[interpolator_object]]. - pure subroutine interpolate_debug_interface(self, stencil, interpolation, si, weights) + pure subroutine interpolate_with_stencil_of_rank_1_debug_interface(self, stencil, interpolation, si, weights) + !< Interpolate values (providing also debug values). + import :: interpolator_object, RPP + class(interpolator_object), intent(inout) :: self !< Interpolator. + real(RPP), intent(in) :: stencil(1 - self%S:) !< Stencil of the interpolation [1-S:-1+S]. + real(RPP), intent(out) :: interpolation !< Result of the interpolation. + real(RPP), intent(out) :: si(0:) !< Computed values of smoothness indicators [0:S-1]. + real(RPP), intent(out) :: weights(0:) !< Weights of the stencils, [0:S-1]. + endsubroutine interpolate_with_stencil_of_rank_1_debug_interface + + pure subroutine interpolate_with_stencil_of_rank_2_debug_interface(self, stencil, interpolation, si, weights) !< Interpolate values (providing also debug values). import :: interpolator_object, RPP class(interpolator_object), intent(inout) :: self !< Interpolator. @@ -48,15 +65,23 @@ pure subroutine interpolate_debug_interface(self, stencil, interpolation, si, we real(RPP), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2]. real(RPP), intent(out) :: si(1:, 0:) !< Computed values of smoothness indicators [1:2, 0:S-1]. real(RPP), intent(out) :: weights(1:, 0:) !< Weights of the stencils, [1:2, 0:S-1]. - endsubroutine interpolate_debug_interface + endsubroutine interpolate_with_stencil_of_rank_2_debug_interface + + pure subroutine interpolate_with_stencil_of_rank_1_standard_interface(self, stencil, interpolation) + !< Interpolate values (without providing debug values). + import :: interpolator_object, RPP + class(interpolator_object), intent(inout) :: self !< Interpolator. + real(RPP), intent(in) :: stencil(1 - self%S:) !< Stencil of the interpolation [1-S:-1+S]. + real(RPP), intent(out) :: interpolation !< Result of the interpolation. + endsubroutine interpolate_with_stencil_of_rank_1_standard_interface - pure subroutine interpolate_standard_interface(self, stencil, interpolation) + pure subroutine interpolate_with_stencil_of_rank_2_standard_interface(self, stencil, interpolation) !< Interpolate values (without providing debug values). import :: interpolator_object, RPP class(interpolator_object), intent(inout) :: self !< Interpolator. real(RPP), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S]. real(RPP), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2]. - endsubroutine interpolate_standard_interface + endsubroutine interpolate_with_stencil_of_rank_2_standard_interface endinterface endmodule wenoof_interpolator_object diff --git a/src/lib/abstract_objects/wenoof_kappa_object.F90 b/src/lib/abstract_objects/wenoof_kappa_object.F90 index c50bc83..b395b02 100644 --- a/src/lib/abstract_objects/wenoof_kappa_object.F90 +++ b/src/lib/abstract_objects/wenoof_kappa_object.F90 @@ -3,9 +3,9 @@ module wenoof_kappa_object !< Abstract Kappa (optimal, linear weights of stencil interpolations) object. #ifdef r16p -use penf, only: RPP=>R16P +use penf, only: I_P, RPP=>R16P #else -use penf, only: RPP=>R8P +use penf, only: I_P, RPP=>R8P #endif use wenoof_base_object @@ -16,23 +16,37 @@ module wenoof_kappa_object type, extends(base_object_constructor), abstract :: kappa_object_constructor !< Abstract kappa object constructor. + real(RPP), allocatable :: stencil(:) !< Stencil used for interpolation, [1-S:S-1]. + real(RPP) :: x_target !< Coordinate of the interpolation point. endtype kappa_object_constructor type, extends(base_object), abstract :: kappa_object !< Kappa (optimal, linear weights of stencil interpolations) object. - real(RPP), allocatable :: values(:,:) !< Kappa coefficients values [1:2,0:S-1]. + real(RPP), allocatable :: values_rank_1(:) !< Kappa coefficients values [0:S-1]. + real(RPP), allocatable :: values_rank_2(:,:) !< Kappa coefficients values [1:2,0:S-1]. contains - ! public deferred methods - procedure(compute_interface), pass(self), deferred :: compute !< Compute kappa. + ! public methods + generic :: compute => compute_kappa_rec, compute_kappa_int + ! deferred public methods + procedure(compute_kappa_rec_interface), pass(self), deferred :: compute_kappa_rec!< Compute interp. + procedure(compute_kappa_int_interface), pass(self), deferred :: compute_kappa_int!< Compute interp. endtype kappa_object abstract interface !< Abstract interfaces of [[kappa_object]]. - pure subroutine compute_interface(self) + pure subroutine compute_kappa_rec_interface(self) !< Compute kappa. import :: kappa_object - class(kappa_object), intent(inout) :: self !< Kappa. - endsubroutine compute_interface + class(kappa_object), intent(inout) :: self !< Kappa. + endsubroutine compute_kappa_rec_interface + + pure subroutine compute_kappa_int_interface(self, stencil, x_target) + !< Compute kappa. + import :: kappa_object, I_P, RPP + class(kappa_object), intent(inout) :: self !< Kappa. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for interpolation, [1-S:S-1]. + real(RPP), intent(in) :: x_target !< Coordinate of the interpolation point. + endsubroutine compute_kappa_int_interface endinterface endmodule wenoof_kappa_object diff --git a/src/lib/abstract_objects/wenoof_weights_object.F90 b/src/lib/abstract_objects/wenoof_weights_object.F90 index 3c6afc1..9d4c8be 100644 --- a/src/lib/abstract_objects/wenoof_weights_object.F90 +++ b/src/lib/abstract_objects/wenoof_weights_object.F90 @@ -20,28 +20,48 @@ module wenoof_weights_object type, extends(base_object), abstract :: weights_object !< Weights of stencil interpolations object. - real(RPP), allocatable :: values(:,:) !< Weights values of stencil interpolations [1:2,0:S-1]. + real(RPP), allocatable :: values_rank_1(:) !< Weights values of stencil interpolations [0:S-1]. + real(RPP), allocatable :: values_rank_2(:,:) !< Weights values of stencil interpolations [1:2,0:S-1]. contains + ! public methods + generic :: compute => compute_with_stencil_of_rank_1, compute_with_stencil_of_rank_2 + generic :: smoothness_indicators => smoothness_indicators_of_rank_1, smoothness_indicators_of_rank_2 ! deferred public methods - procedure(compute_interface), pass(self), deferred :: compute !< Compute weights. - procedure(smoothness_indicators_interface), pass(self), deferred :: smoothness_indicators !< Return smoothness indicators. + procedure(compute_with_stencil_of_rank_1_interface), pass(self), deferred :: compute_with_stencil_of_rank_1 !< Compute beta. + procedure(compute_with_stencil_of_rank_2_interface), pass(self), deferred :: compute_with_stencil_of_rank_2 !< Compute beta. + procedure(smoothness_indicators_of_rank_1_interface), pass(self), deferred :: smoothness_indicators_of_rank_1 !< Return IS. + procedure(smoothness_indicators_of_rank_2_interface), pass(self), deferred :: smoothness_indicators_of_rank_2 !< Return IS. endtype weights_object abstract interface !< Abstract interfaces of [[weights_object]]. - pure subroutine compute_interface(self, stencil) + pure subroutine compute_with_stencil_of_rank_1_interface(self, stencil) + !< Compute beta. + import :: weights_object, RPP + class(weights_object), intent(inout) :: self !< Weights. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + endsubroutine compute_with_stencil_of_rank_1_interface + + pure subroutine compute_with_stencil_of_rank_2_interface(self, stencil) !< Compute beta. import :: weights_object, RPP class(weights_object), intent(inout) :: self !< Weights. real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. - endsubroutine compute_interface + endsubroutine compute_with_stencil_of_rank_2_interface + + pure subroutine smoothness_indicators_of_rank_1_interface(self, si) + !< Return smoothness indicators. + import :: weights_object, RPP + class(weights_object), intent(in) :: self !< Weights. + real(RPP), intent(out) :: si(:) !< Smoothness indicators. + endsubroutine smoothness_indicators_of_rank_1_interface - pure function smoothness_indicators_interface(self) result(si) + pure subroutine smoothness_indicators_of_rank_2_interface(self, si) !< Return smoothness indicators. import :: weights_object, RPP - class(weights_object), intent(in) :: self !< Weights. - real(RPP), allocatable :: si(:,:) !< Smoothness indicators. - endfunction smoothness_indicators_interface + class(weights_object), intent(in) :: self !< Weights. + real(RPP), intent(out) :: si(:,:) !< Smoothness indicators. + endsubroutine smoothness_indicators_of_rank_2_interface endinterface endmodule wenoof_weights_object diff --git a/src/lib/concrete_objects/wenoof_alpha_int_js.F90 b/src/lib/concrete_objects/wenoof_alpha_int_js.F90 new file mode 100644 index 0000000..d59177d --- /dev/null +++ b/src/lib/concrete_objects/wenoof_alpha_int_js.F90 @@ -0,0 +1,90 @@ +!< Jiang-Shu alpha (non linear weights) object. +module wenoof_alpha_int_js +!< Jiang-Shu alpha (non linear weights) object. +!< +!< @note The provided alpha implements the alpha coefficients defined in *Efficient Implementation of Weighted ENO +!< Schemes*, Guang-Shan Jiang, Chi-Wang Shu, JCP, 1996, vol. 126, pp. 202--228, doi:10.1006/jcph.1996.0130. + +#ifdef r16p +use penf, only: I_P, RPP=>R16P, str +#else +use penf, only: I_P, RPP=>R8P, str +#endif +use wenoof_alpha_object +use wenoof_base_object +use wenoof_beta_object +use wenoof_kappa_object + +implicit none +private +public :: alpha_int_js +public :: alpha_int_js_constructor + +type, extends(alpha_object_constructor) :: alpha_int_js_constructor + !< Jiang-Shu alpha object constructor. +endtype alpha_int_js_constructor + +type, extends(alpha_object) :: alpha_int_js + !< Jiang-Shu alpha object. + !< + !< @note The provided WENO alpha implements the alpha coefficients defined in *Efficient Implementation of Weighted + !< ENO Schemes*, Guang-Shan Jiang, Chi-Wang Shu, JCP, 1996, vol. 126, pp. 202--228, doi:10.1006/jcph.1996.0130. + contains + ! public deferred methods + procedure, pass(self) :: create !< Create alpha. + procedure, pass(self) :: compute => compute_alpha_int !< Compute alpha. + procedure, pass(self) :: description !< Return alpha string-description. + procedure, pass(self) :: destroy !< Destroy alpha. +endtype alpha_int_js + +contains + ! deferred public methods + subroutine create(self, constructor) + !< Create alpha. + class(alpha_int_js), intent(inout) :: self !< Alpha. + class(base_object_constructor), intent(in) :: constructor !< Alpha constructor. + + call self%destroy + call self%create_(constructor=constructor) + allocate(self%values_rank_1(0:self%S - 1)) + associate(val => self%values_rank_1, val_sum => self%values_sum_rank_1) + val = 0._RPP + val_sum = 0._RPP + endassociate + endsubroutine create + + pure subroutine compute_alpha_int(self, beta, kappa) + !< Compute alpha. + class(alpha_int_js), intent(inout) :: self !< Alpha coefficient. + class(beta_object), intent(in) :: beta !< Beta coefficients. + class(kappa_object), intent(in) :: kappa !< Kappa coefficients. + integer(I_P) :: s1 !< Counter. + + associate(val => self%values_rank_1, val_sum => self%values_sum_rank_1) + val_sum = 0._RPP + do s1=0, self%S - 1 ! stencil loops + val(s1) = kappa%values_rank_1(s1)/(self%eps + beta%values_rank_1(s1)) ** self%S + val_sum = val_sum + val(s1) + enddo + endassociate + endsubroutine compute_alpha_int + + pure function description(self) result(string) + !< Return alpha string-descripition. + class(alpha_int_js), intent(in) :: self !< Alpha coefficient. + character(len=:), allocatable :: string !< String-description. + character(len=1), parameter :: nl=new_line('a') !< New line char. + + string = ' Jiang-Shu alpha coefficients for reconstructor:'//nl + string = string//' - S = '//trim(str(self%S))//nl + string = string//' - eps = '//trim(str(self%eps)) + endfunction description + + elemental subroutine destroy(self) + !< Destroy alpha. + class(alpha_int_js), intent(inout) :: self !< Alpha. + + call self%destroy_ + if (allocated(self%values_rank_1)) deallocate(self%values_rank_1) + endsubroutine destroy +endmodule wenoof_alpha_int_js diff --git a/src/lib/concrete_objects/wenoof_alpha_int_m.F90 b/src/lib/concrete_objects/wenoof_alpha_int_m.F90 new file mode 100644 index 0000000..40eb910 --- /dev/null +++ b/src/lib/concrete_objects/wenoof_alpha_int_m.F90 @@ -0,0 +1,131 @@ +!< Henrick alpha (non linear weights) object. +module wenoof_alpha_int_m +!< Henrick alpha (non linear weights) object. +!< +!< @note The provided alpha implements the alpha coefficients defined in *Mapped weighted essentially non-oscillatory schemes: +!< Achieving optimal order near critical points*, Andrew K. Henrick, Tariq D. Aslam, Joseph M. Powers, JCP, +!< 2005, vol. 207, pp. 542-567, doi:10.1016/j.jcp.2005.01.023 + +#ifdef r16p +use penf, only: I_P, RPP=>R16P, str +#else +use penf, only: I_P, RPP=>R8P, str +#endif +use wenoof_alpha_object +use wenoof_alpha_rec_js +use wenoof_alpha_rec_z +use wenoof_base_object +use wenoof_beta_object +use wenoof_kappa_object + +implicit none +private +public :: alpha_int_m +public :: alpha_int_m_constructor + +type, extends(alpha_object_constructor) :: alpha_int_m_constructor + !< Henrick alpha (non linear weights) object constructor. + character(len=:), allocatable :: base_type !< Base alpha coefficient type. +endtype alpha_int_m_constructor + +type, extends(alpha_object) :: alpha_int_m + !< Henrick alpha (non linear weights) object. + !< + !< @note The provided alpha implements the alpha coefficients defined in *Mapped weighted essentially non-oscillatory schemes: + !< Achieving optimal order near critical points*, Andrew K. Henrick, Tariq D. Aslam, Joseph M. Powers, + !< JCP, 2005, vol. 207, pp. 542-567, doi:10.1016/j.jcp.2005.01.023. + real(RPP), allocatable :: values(:) !< Alpha coefficients [0:S-1]. + real(RPP) :: values_sum !< Sum of alpha coefficients. + class(alpha_object), allocatable :: alpha_base !< Base alpha to be re-mapped. + contains + ! public deferred methods + procedure, pass(self) :: create !< Create alpha. + procedure, pass(self) :: compute => compute_alpha_int !< Compute alpha. + procedure, pass(self) :: description !< Return alpha string-description. + procedure, pass(self) :: destroy !< Destroy alpha. +endtype alpha_int_m + +contains + ! deferred public methods + subroutine create(self, constructor) + !< Create alpha. + class(alpha_int_m), intent(inout) :: self !< Alpha. + class(base_object_constructor), intent(in) :: constructor !< Alpha constructor. + + call self%destroy + call self%create_(constructor=constructor) + allocate(self%values_rank_1(0:self%S - 1)) + associate(val => self%values_rank_1, val_sum => self%values_sum_rank_1) + val = 0._RPP + val_sum = 0._RPP + endassociate + select type(constructor) + type is(alpha_int_m_constructor) + if (allocated(constructor%base_type)) then + select case(constructor%base_type) + case('JS') + if (allocated(self%alpha_base)) deallocate(self%alpha_base) + allocate(alpha_rec_js :: self%alpha_base) + call self%alpha_base%create(constructor=constructor) + case('Z') + if (allocated(self%alpha_base)) deallocate(self%alpha_base) + allocate(alpha_rec_z :: self%alpha_base) + call self%alpha_base%create(constructor=constructor) + endselect + endif + class default + ! @TODO add error handling + endselect + endsubroutine create + + pure subroutine compute_alpha_int(self, beta, kappa) + !< Compute alpha. + class(alpha_int_m), intent(inout) :: self !< Alpha. + class(beta_object), intent(in) :: beta !< Beta. + class(kappa_object), intent(in) :: kappa !< Kappa. + real(RPP) :: kappa_base !< Kappa evaluated from the base alphas. + integer(I_P) :: s1 !< Counter. + + associate(val => self%values_rank_1, val_sum => self%values_sum_rank_1) + val_sum = 0._RPP + call self%alpha_base%compute(beta=beta, kappa=kappa) + do s1=0, self%S - 1 ! stencil loops + kappa_base = self%alpha_base%values_rank_1(s1) / self%alpha_base%values_sum_rank_1 + val(s1) = & + (kappa_base * (kappa%values_rank_1(s1) + kappa%values_rank_1(s1) * kappa%values_rank_1(s1) - & + 3._RPP * kappa%values_rank_1(s1) * kappa_base + kappa_base * kappa_base)) / & + (kappa%values_rank_1(s1) * kappa%values_rank_1(s1) + kappa_base * & + (1._RPP - 2._RPP * kappa%values_rank_1(s1))) + val_sum = val_sum + val(s1) + enddo + endassociate + endsubroutine compute_alpha_int + + pure function description(self) result(string) + !< Return alpha string-descripition. + class(alpha_int_m), intent(in) :: self !< Alpha. + character(len=:), allocatable :: string !< String-description. + character(len=1), parameter :: nl=new_line('a') !< New line char. + + string = ' Henrick alpha coefficients for reconstructor:'//nl + string = string//' - S = '//trim(str(self%S))//nl + string = string//' - eps = '//trim(str(self%eps))//nl + associate(alpha_base=>self%alpha_base) + select type(alpha_base) + type is(alpha_rec_js) + string = string//' - base-mapped-alpha type = Jiang-Shu' + type is(alpha_rec_z) + string = string//' - base-mapped-alpha type = Bogeg' + endselect + endassociate + endfunction description + + elemental subroutine destroy(self) + !< Destroy alpha. + class(alpha_int_m), intent(inout) :: self !< Alpha. + + call self%destroy_ + if (allocated(self%values_rank_1)) deallocate(self%values_rank_1) + if (allocated(self%alpha_base)) deallocate(self%alpha_base) + endsubroutine destroy +endmodule wenoof_alpha_int_m diff --git a/src/lib/concrete_objects/wenoof_alpha_int_z.F90 b/src/lib/concrete_objects/wenoof_alpha_int_z.F90 new file mode 100644 index 0000000..c7c113a --- /dev/null +++ b/src/lib/concrete_objects/wenoof_alpha_int_z.F90 @@ -0,0 +1,125 @@ +!< Borges alpha (non linear weights) object. +module wenoof_alpha_int_z +!< Borges alpha (non linear weights) object. +!< +!< @note The provided WENO alpha implements the alpha coefficients defined in *An improved weighted essentially non-oscillatory +!< scheme for hyperbolic conservation laws*, Rafael Borges, Monique Carmona, Bruno Costa and Wai Sun Don, JCP, 2008, +!< vol. 227, pp. 3191-3211, doi: 10.1016/j.jcp.2007.11.038. + +#ifdef r16p +use penf, only: I_P, RPP=>R16P, str +#else +use penf, only: I_P, RPP=>R8P, str +#endif +use wenoof_alpha_object +use wenoof_base_object +use wenoof_beta_object +use wenoof_kappa_object + +implicit none +private +public :: alpha_int_z +public :: alpha_int_z_constructor + +type, extends(alpha_object_constructor) :: alpha_int_z_constructor + !< Borges alpha (non linear weights) object constructor. +endtype alpha_int_z_constructor + +type, extends(alpha_object) :: alpha_int_z + !< Borges alpha (non linear weights) object. + !< + !< @note The provided alpha implements the alpha coefficients defined in *An improved weighted essentially non-oscillatory + !< scheme for hyperbolic conservation laws*, Rafael Borges, Monique Carmona, Bruno Costa and Wai Sun Don, JCP, + !< 2008, vol. 227, pp. 3191-3211, doi: 10.1016/j.jcp.2007.11.038. + real(RPP), allocatable :: values(:) !< Alpha coefficients [0:S-1]. + real(RPP) :: values_sum !< Sum of alpha coefficients. + contains + ! public deferred methods + procedure, pass(self) :: create !< Create alpha. + procedure, pass(self) :: compute => compute_alpha_int !< Compute alpha. + procedure, pass(self) :: description !< Return alpha string-description. + procedure, pass(self) :: destroy !< Destroy alpha. +endtype alpha_int_z +contains + ! public deferred methods + subroutine create(self, constructor) + !< Create alpha. + class(alpha_int_z), intent(inout) :: self !< Alpha. + class(base_object_constructor), intent(in) :: constructor !< Alpha constructor. + + call self%destroy + call self%create_(constructor=constructor) + allocate(self%values_rank_1(0:self%S - 1)) + associate(val => self%values_rank_1, val_sum => self%values_sum_rank_1) + val = 0._RPP + val_sum = 0._RPP + endassociate + endsubroutine create + + pure subroutine compute_alpha_int(self, beta, kappa) + !< Compute alpha. + class(alpha_int_z), intent(inout) :: self !< Alpha. + class(beta_object), intent(in) :: beta !< Beta. + class(kappa_object), intent(in) :: kappa !< Kappa. + integer(I_P) :: s1 !< Counter. + + associate(val => self%values_rank_1, val_sum => self%values_sum_rank_1) + val_sum = 0._RPP + do s1=0, self%S - 1 ! stencil loops + val = kappa%values_rank_1(s1) * & + ((1._RPP + (tau(S=self%S, beta=beta%values_rank_1) / & + (self%eps + beta%values_rank_1(s1)))) ** (weno_exp(self%S))) + val_sum = val_sum + val(s1) + enddo + endassociate + endsubroutine compute_alpha_int + + pure function description(self) result(string) + !< Return alpha string-descripition. + class(alpha_int_z), intent(in) :: self !< Alpha coefficients. + character(len=:), allocatable :: string !< String-description. + character(len=1), parameter :: nl=new_line('a') !< New line char. + + string = ' Borges alpha coefficients for reconstructor:'//nl + string = string//' - S = '//trim(str(self%S))//nl + string = string//' - eps = '//trim(str(self%eps)) + + endfunction description + + elemental subroutine destroy(self) + !< Destroy alpha. + class(alpha_int_z), intent(inout) :: self !< Alpha. + + call self%destroy_ + if (allocated(self%values_rank_1)) deallocate(self%values_rank_1) + endsubroutine destroy + + ! private non TBP + pure function tau(S, beta) result(w_tau) + !< Compute the tau coefficient used in the WENO-Z alpha coefficients. + integer(I_P), intent(in) :: S !< Number of stencils used. + real(RPP), intent(in) :: beta(0:S-1) !< Smoothness indicators. + real(RPP) :: w_tau !< Tau coefficient. + + w_tau = abs(beta(0) - & + (1_I_P - weno_odd(S)) * beta(1) - & + (1_I_P - weno_odd(S)) * beta(S-2) + & + (1_I_P - 2_I_P * weno_odd(S)) * beta(S-1)) + endfunction tau + + pure function weno_exp(S) result(w_exp) + !< Compute the exponent used in the alpha function. + integer(I_P), intent(in) :: S !< Number of stencils used. + integer(I_P) :: w_exp !< Exponent used in the alpha function. + + w_exp = int(S, I_P) + endfunction weno_exp + + pure function weno_odd(S) result(w_odd) + !< Compute the distinguisher between odd and even number of stencils. + integer(I_P), intent(in) :: S !< Number of stencils used. + integer(I_P) :: w_odd !< Distinguishing between odd and even number of stencils. + + w_odd = int(mod(S, 2_I_P), I_P) + endfunction weno_odd +endmodule wenoof_alpha_int_z diff --git a/src/lib/concrete_objects/wenoof_alpha_rec_js.F90 b/src/lib/concrete_objects/wenoof_alpha_rec_js.F90 index 89b3c21..86f9ec4 100644 --- a/src/lib/concrete_objects/wenoof_alpha_rec_js.F90 +++ b/src/lib/concrete_objects/wenoof_alpha_rec_js.F90 @@ -31,10 +31,10 @@ module wenoof_alpha_rec_js !< ENO Schemes*, Guang-Shan Jiang, Chi-Wang Shu, JCP, 1996, vol. 126, pp. 202--228, doi:10.1006/jcph.1996.0130. contains ! public deferred methods - procedure, pass(self) :: create !< Create alpha. - procedure, pass(self) :: compute !< Compute alpha. - procedure, pass(self) :: description !< Return alpha string-description. - procedure, pass(self) :: destroy !< Destroy alpha. + procedure, pass(self) :: create !< Create alpha. + procedure, pass(self) :: compute => compute_alpha_rec !< Compute alpha. + procedure, pass(self) :: description !< Return alpha string-description. + procedure, pass(self) :: destroy !< Destroy alpha. endtype alpha_rec_js contains @@ -46,27 +46,31 @@ subroutine create(self, constructor) call self%destroy call self%create_(constructor=constructor) - allocate(self%values(1:2, 0:self%S - 1)) - allocate(self%values_sum(1:2)) - self%values = 0._RPP - self%values_sum = 0._RPP + allocate(self%values_rank_2(1:2, 0:self%S - 1)) + allocate(self%values_sum_rank_2(1:2)) + associate(val => self%values_rank_2, val_sum => self%values_sum_rank_2) + val = 0._RPP + val_sum = 0._RPP + endassociate endsubroutine create - pure subroutine compute(self, beta, kappa) + pure subroutine compute_alpha_rec(self, beta, kappa) !< Compute alpha. class(alpha_rec_js), intent(inout) :: self !< Alpha coefficient. class(beta_object), intent(in) :: beta !< Beta coefficients. class(kappa_object), intent(in) :: kappa !< Kappa coefficients. integer(I_P) :: f, s1 !< Counters. - self%values_sum = 0._RPP - do s1=0, self%S - 1 ! stencil loops - do f=self%f1, self%f2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) - self%values(f, s1) = kappa%values(f, s1)/(self%eps + beta%values(f, s1)) ** self%S - self%values_sum(f) = self%values_sum(f) + self%values(f, s1) + associate(val => self%values_rank_2, val_sum => self%values_sum_rank_2) + val_sum = 0._RPP + do s1=0, self%S - 1 ! stencil loops + do f=1, 2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) + val(f, s1) = kappa%values_rank_2(f, s1)/(self%eps + beta%values_rank_2(f, s1)) ** self%S + val_sum(f) = val_sum(f) + val(f, s1) + enddo enddo - enddo - endsubroutine compute + endassociate + endsubroutine compute_alpha_rec pure function description(self) result(string) !< Return alpha string-descripition. @@ -76,9 +80,6 @@ pure function description(self) result(string) string = ' Jiang-Shu alpha coefficients for reconstructor:'//nl string = string//' - S = '//trim(str(self%S))//nl - string = string//' - f1 = '//trim(str(self%f1))//nl - string = string//' - f2 = '//trim(str(self%f2))//nl - string = string//' - ff = '//trim(str(self%ff))//nl string = string//' - eps = '//trim(str(self%eps)) endfunction description @@ -87,7 +88,7 @@ elemental subroutine destroy(self) class(alpha_rec_js), intent(inout) :: self !< Alpha. call self%destroy_ - if (allocated(self%values)) deallocate(self%values) - if (allocated(self%values_sum)) deallocate(self%values_sum) + if (allocated(self%values_rank_2)) deallocate(self%values_rank_2) + if (allocated(self%values_sum_rank_2)) deallocate(self%values_sum_rank_2) endsubroutine destroy endmodule wenoof_alpha_rec_js diff --git a/src/lib/concrete_objects/wenoof_alpha_rec_m.F90 b/src/lib/concrete_objects/wenoof_alpha_rec_m.F90 index 289a9a1..7071b3e 100644 --- a/src/lib/concrete_objects/wenoof_alpha_rec_m.F90 +++ b/src/lib/concrete_objects/wenoof_alpha_rec_m.F90 @@ -34,13 +34,15 @@ module wenoof_alpha_rec_m !< @note The provided alpha implements the alpha coefficients defined in *Mapped weighted essentially non-oscillatory schemes: !< Achieving optimal order near critical points*, Andrew K. Henrick, Tariq D. Aslam, Joseph M. Powers, !< JCP, 2005, vol. 207, pp. 542-567, doi:10.1016/j.jcp.2005.01.023. - class(alpha_object), allocatable :: alpha_base !< Base alpha to be re-mapped. + real(RPP), allocatable :: values(:,:) !< Alpha coefficients [1:2,0:S-1]. + real(RPP), allocatable :: values_sum(:) !< Sum of alpha coefficients [1:2]. + class(alpha_object), allocatable :: alpha_base !< Base alpha to be re-mapped. contains ! public deferred methods - procedure, pass(self) :: create !< Create alpha. - procedure, pass(self) :: compute !< Compute alpha. - procedure, pass(self) :: description !< Return alpha string-description. - procedure, pass(self) :: destroy !< Destroy alpha. + procedure, pass(self) :: create !< Create alpha. + procedure, pass(self) :: compute => compute_alpha_rec !< Compute alpha. + procedure, pass(self) :: description !< Return alpha string-description. + procedure, pass(self) :: destroy !< Destroy alpha. endtype alpha_rec_m contains @@ -52,10 +54,12 @@ subroutine create(self, constructor) call self%destroy call self%create_(constructor=constructor) - allocate(self%values(1:2, 0:self%S - 1)) - allocate(self%values_sum(1:2)) - self%values = 0._RPP - self%values_sum = 0._RPP + allocate(self%values_rank_2(1:2, 0:self%S - 1)) + allocate(self%values_sum_rank_2(1:2)) + associate(val => self%values_rank_2, val_sum => self%values_sum_rank_2) + val = 0._RPP + val_sum = 0._RPP + endassociate select type(constructor) type is(alpha_rec_m_constructor) if (allocated(constructor%base_type)) then @@ -75,7 +79,7 @@ subroutine create(self, constructor) endselect endsubroutine create - pure subroutine compute(self, beta, kappa) + pure subroutine compute_alpha_rec(self, beta, kappa) !< Compute alpha. class(alpha_rec_m), intent(inout) :: self !< Alpha. class(beta_object), intent(in) :: beta !< Beta. @@ -83,21 +87,23 @@ pure subroutine compute(self, beta, kappa) real(RPP) :: kappa_base !< Kappa evaluated from the base alphas. integer(I_P) :: f, s1 !< Counters. - self%values_sum = 0._RPP + associate(val => self%values_rank_2, val_sum => self%values_sum_rank_2) + val_sum = 0._RPP call self%alpha_base%compute(beta=beta, kappa=kappa) do s1=0, self%S - 1 ! stencil loops - do f=self%f1, self%f2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) - kappa_base = self%alpha_base%values(f, s1) / self%alpha_base%values_sum(f) - self%values(f, s1) = & - (kappa_base * (kappa%values(f, s1) + kappa%values(f, s1) * kappa%values(f, s1) - & - 3._RPP * kappa%values(f, s1) * kappa_base + kappa_base * & - kappa_base)) / & - (kappa%values(f, s1) * kappa%values(f, s1) + kappa_base * & - (1._RPP - 2._RPP * kappa%values(f, s1))) - self%values_sum(f) = self%values_sum(f) + self%values(f, s1) + do f=1, 2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) + kappa_base = self%alpha_base%values_rank_2(f, s1) / self%alpha_base%values_sum_rank_2(f) + val(f, s1) = & + (kappa_base * (kappa%values_rank_2(f, s1) + kappa%values_rank_2(f, s1) * kappa%values_rank_2(f, s1) - & + 3._RPP * kappa%values_rank_2(f, s1) * kappa_base + kappa_base * & + kappa_base)) / & + (kappa%values_rank_2(f, s1) * kappa%values_rank_2(f, s1) + kappa_base * & + (1._RPP - 2._RPP * kappa%values_rank_2(f, s1))) + val_sum(f) = val_sum(f) + val(f, s1) enddo enddo - endsubroutine compute + endassociate + endsubroutine compute_alpha_rec pure function description(self) result(string) !< Return alpha string-descripition. @@ -107,9 +113,6 @@ pure function description(self) result(string) string = ' Henrick alpha coefficients for reconstructor:'//nl string = string//' - S = '//trim(str(self%S))//nl - string = string//' - f1 = '//trim(str(self%f1))//nl - string = string//' - f2 = '//trim(str(self%f2))//nl - string = string//' - ff = '//trim(str(self%ff))//nl string = string//' - eps = '//trim(str(self%eps))//nl associate(alpha_base=>self%alpha_base) select type(alpha_base) @@ -126,8 +129,8 @@ elemental subroutine destroy(self) class(alpha_rec_m), intent(inout) :: self !< Alpha. call self%destroy_ - if (allocated(self%values)) deallocate(self%values) - if (allocated(self%values_sum)) deallocate(self%values_sum) + if (allocated(self%values_rank_2)) deallocate(self%values_rank_2) + if (allocated(self%values_sum_rank_2)) deallocate(self%values_sum_rank_2) if (allocated(self%alpha_base)) deallocate(self%alpha_base) endsubroutine destroy endmodule wenoof_alpha_rec_m diff --git a/src/lib/concrete_objects/wenoof_alpha_rec_z.F90 b/src/lib/concrete_objects/wenoof_alpha_rec_z.F90 index 017d78d..75ca30d 100644 --- a/src/lib/concrete_objects/wenoof_alpha_rec_z.F90 +++ b/src/lib/concrete_objects/wenoof_alpha_rec_z.F90 @@ -31,12 +31,14 @@ module wenoof_alpha_rec_z !< @note The provided alpha implements the alpha coefficients defined in *An improved weighted essentially non-oscillatory !< scheme for hyperbolic conservation laws*, Rafael Borges, Monique Carmona, Bruno Costa and Wai Sun Don, JCP, !< 2008, vol. 227, pp. 3191-3211, doi: 10.1016/j.jcp.2007.11.038. + real(RPP), allocatable :: values(:,:) !< Alpha coefficients [1:2,0:S-1]. + real(RPP), allocatable :: values_sum(:) !< Sum of alpha coefficients [1:2]. contains ! public deferred methods - procedure, pass(self) :: create !< Create alpha. - procedure, pass(self) :: compute !< Compute alpha. - procedure, pass(self) :: description !< Return alpha string-description. - procedure, pass(self) :: destroy !< Destroy alpha. + procedure, pass(self) :: create !< Create alpha. + procedure, pass(self) :: compute => compute_alpha_rec !< Compute alpha. + procedure, pass(self) :: description !< Return alpha string-description. + procedure, pass(self) :: destroy !< Destroy alpha. endtype alpha_rec_z contains ! public deferred methods @@ -47,28 +49,33 @@ subroutine create(self, constructor) call self%destroy call self%create_(constructor=constructor) - allocate(self%values(1:2, 0:self%S - 1)) - allocate(self%values_sum(1:2)) - self%values = 0._RPP - self%values_sum = 0._RPP + allocate(self%values_rank_2(1:2, 0:self%S - 1)) + allocate(self%values_sum_rank_2(1:2)) + associate(val => self%values_rank_2, val_sum => self%values_sum_rank_2) + val = 0._RPP + val_sum = 0._RPP + endassociate endsubroutine create - pure subroutine compute(self, beta, kappa) + pure subroutine compute_alpha_rec(self, beta, kappa) !< Compute alpha. class(alpha_rec_z), intent(inout) :: self !< Alpha. class(beta_object), intent(in) :: beta !< Beta. class(kappa_object), intent(in) :: kappa !< Kappa. integer(I_P) :: f, s1 !< Counters. - self%values_sum = 0._RPP - do s1=0, self%S - 1 ! stencil loops - do f=self%f1, self%f2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) - self%values(f, s1) = kappa%values(f, s1) * & - ((1._RPP + (tau(S=self%S, beta=beta%values) / (self%eps + beta%values(f, s1)))) ** (weno_exp(self%S))) - self%values_sum(f) = self%values_sum(f) + self%values(f, s1) + associate(val => self%values_rank_2, val_sum => self%values_sum_rank_2) + val_sum = 0._RPP + do s1=0, self%S - 1 ! stencil loops + do f=1, 2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) + val(f, s1) = kappa%values_rank_2(f, s1) * & + ((1._RPP + (tau(S=self%S, beta=beta%values_rank_2) / & + (self%eps + beta%values_rank_2(f, s1)))) ** (weno_exp(self%S))) + val_sum(f) = val_sum(f) + val(f, s1) + enddo enddo - enddo - endsubroutine compute + endassociate + endsubroutine compute_alpha_rec pure function description(self) result(string) !< Return alpha string-descripition. @@ -78,9 +85,6 @@ pure function description(self) result(string) string = ' Borges alpha coefficients for reconstructor:'//nl string = string//' - S = '//trim(str(self%S))//nl - string = string//' - f1 = '//trim(str(self%f1))//nl - string = string//' - f2 = '//trim(str(self%f2))//nl - string = string//' - ff = '//trim(str(self%ff))//nl string = string//' - eps = '//trim(str(self%eps)) endfunction description @@ -90,8 +94,8 @@ elemental subroutine destroy(self) class(alpha_rec_z), intent(inout) :: self !< Alpha. call self%destroy_ - if (allocated(self%values)) deallocate(self%values) - if (allocated(self%values_sum)) deallocate(self%values_sum) + if (allocated(self%values_rank_2)) deallocate(self%values_rank_2) + if (allocated(self%values_sum_rank_2)) deallocate(self%values_sum_rank_2) endsubroutine destroy ! private non TBP diff --git a/src/lib/concrete_objects/wenoof_beta_int_js.F90 b/src/lib/concrete_objects/wenoof_beta_int_js.F90 new file mode 100644 index 0000000..9c3ca18 --- /dev/null +++ b/src/lib/concrete_objects/wenoof_beta_int_js.F90 @@ -0,0 +1,2420 @@ +!< Jiang-Shu and Gerolymos-Senechal-Vallet Beta coefficients (smoothness indicators of stencil interpolations) object. +module wenoof_beta_int_js +!< Jiang-Shu and Gerolymos-Senechal-Vallet Beta coefficients (smoothness indicators of stencil interpolations) object. +!< +!< @note The provided interpolations implement the Lagrange interpolations defined in *High Order Weighted Essentially +!< Nonoscillatory Schemes for Convection Dominated Problems*, Chi-Wang Shu, SIAM Review, 2009, vol. 51, pp. 82--126, +!< doi:10.1137/070679065. + +#ifdef r16p +use penf, only: I_P, RPP=>R16P +#else +use penf, only: I_P, RPP=>R8P +#endif +use wenoof_base_object +use wenoof_beta_object + +implicit none +private +public :: beta_int_js +public :: beta_int_js_constructor + +type, extends(beta_object_constructor) :: beta_int_js_constructor + !< Jiang-Shu and Gerolymos-Senechal-Vallet beta object constructor. +endtype beta_int_js_constructor + +type, extends(beta_object) :: beta_int_js + !< Jiang-Shu and Gerolymos-Senechal-Vallet Beta coefficients (smoothness indicators of stencil interpolations) object. + !< + !< @note The provided interpolations implement the Lagrange interpolations defined in *High Order Weighted Essentially + !< Nonoscillatory Schemes for Convection Dominated Problems*, Chi-Wang Shu, SIAM Review, 2009, vol. 51, pp. 82--126, + !< doi:10.1137/070679065. + private + real(RPP), allocatable :: coef(:,:,:) !< Beta coefficients [0:S-1,0:S-1,0:S-1]. + contains + ! public deferred methods + procedure, pass(self) :: create !< Create beta. + procedure, pass(self) :: compute_with_stencil_of_rank_1 !< Compute beta. + procedure, pass(self) :: compute_with_stencil_of_rank_2 !< Compute beta. + procedure, pass(self) :: description !< Return beta string-description. + procedure, pass(self) :: destroy !< Destroy beta. +endtype beta_int_js + +contains + ! public deferred methods + subroutine create(self, constructor) + !< Create beta. + class(beta_int_js), intent(inout) :: self !< Beta. + class(base_object_constructor), intent(in) :: constructor !< Beta constructor. + + call self%destroy + call self%create_(constructor=constructor) + allocate(self%values_rank_1(0:self%S - 1)) + self%values_rank_1 = 0._RPP + allocate(self%coef(0:self%S - 1, 0:self%S - 1, 0:self%S - 1)) + associate(c => self%coef) + select case(self%S) + case(2) ! 3rd order + ! stencil 0 + ! i*i ; (i-1)*i + c(0,0,0) = 1._RPP; c(1,0,0) = -2._RPP + ! / ; (i-1)*(i-1) + c(0,1,0) = 0._RPP; c(1,1,0) = 1._RPP + ! stencil 1 + ! (i+1)*(i+1) ; (i+1)*i + c(0,0,1) = 1._RPP; c(1,0,1) = -2._RPP + ! / ; i*i + c(0,1,1) = 0._RPP; c(1,1,1) = 1._RPP + case(3) ! 5th order + ! stencil 0 + ! i*i ; (i-1)*i ; (i-2)*i + c(0,0,0) = 10._RPP/3._RPP; c(1,0,0) = -31._RPP/3._RPP; c(2,0,0) = 11._RPP/3._RPP + ! / ; (i-1)*(i-1) ; (i-2)*(i-1) + c(0,1,0) = 0._RPP ; c(1,1,0) = 25._RPP/3._RPP; c(2,1,0) = -19._RPP/3._RPP + ! / ; / ; (i-2)*(i-2) + c(0,2,0) = 0._RPP ; c(1,2,0) = 0._RPP ; c(2,2,0) = 4._RPP/3._RPP + ! stencil 1 + ! (i+1)*(i+1) ; i*(i+1) ; (i-1)*(i+1) + c(0,0,1) = 4._RPP/3._RPP; c(1,0,1) = -13._RPP/3._RPP; c(2,0,1) = 5._RPP/3._RPP + ! / ; i*i ; (i-1)*i + c(0,1,1) = 0._RPP ; c(1,1,1) = 13._RPP/3._RPP; c(2,1,1) = -13._RPP/3._RPP + ! / ; / ; (i-1)*(i-1) + c(0,2,1) = 0._RPP ; c(1,2,1) = 0._RPP ; c(2,2,1) = 4._RPP/3._RPP + ! stencil 2 + ! (i+2)*(i+2) ; (i+1)*(i+2) ; i*(i+2) + c(0,0,2) = 4._RPP/3._RPP; c(1,0,2) = -19._RPP/3._RPP; c(2,0,2) = 11._RPP/3._RPP + ! / ; (i+1)*(i+1) ; i*(i+1) + c(0,1,2) = 0._RPP ; c(1,1,2) = 25._RPP/3._RPP; c(2,1,2) = -31._RPP/3._RPP + ! / ; / ; i*i + c(0,2,2) = 0._RPP ; c(1,2,2) = 0._RPP ; c(2,2,2) = 10._RPP/3._RPP + case(4) ! 7th order + ! stencil 0 + ! i*i ; (i-1)*i ; (i-2)*i + c(0,0,0) = 25729._RPP / 2880._RPP; c(1,0,0) = -6383._RPP / 160._RPP; c(2,0,0) = 14369._RPP / 480._RPP + ! (i-3)*i + c(3,0,0) =-11389._RPP / 1440._RPP + ! / ; (i-1)*(i-1) ; (i-2)*(i-1) + c(0,1,0) = 0._RPP ; c(1,1,0) = 44747._RPP / 960._RPP; c(2,1,0) =-35047._RPP / 480._RPP + ! (i-3)*(i-1) + c(3,1,0) = 9449._RPP / 480._RPP + ! / ; / ; (i-2)*(i-2) + c(0,2,0) = 0._RPP ; c(1,2,0) = 0._RPP ; c(2,2,0) = 28547._RPP / 960._RPP + ! (i-3)*(i-2) + c(3,2,0) = -2623._RPP / 160._RPP + ! / ; / ; / + c(0,3,0) = 0._RPP ; c(1,3,0) = 0._RPP ; c(2,3,0) = 0._RPP + ! (i-3)*(i-3) + c(3,3,0) = 6649._RPP / 2880._RPP + ! stencil 1 + ! (i+1)*(i+1) ; i*(i+1) ; (i-1)*(i+1) + c(0,0,1) = 6649._RPP / 2880._RPP; c(1,0,1) = -5069._RPP / 480._RPP; c(2,0,1) = 1283._RPP / 160._RPP + ! (i-2)*(i+1) + c(3,0,1) = -2989._RPP / 1440._RPP + ! / ; i*i ; (i-1)*i + c(0,1,1) = 0._RPP ; c(1,1,1) = 13667._RPP / 960._RPP; c(2,1,1) =-11767._RPP / 480._RPP + ! (i-2)*i + c(3,1,1) = 3169._RPP / 480._RPP + ! / ; / ; (i-1)*(i-1) + c(0,2,1) = 0._RPP ; c(1,2,1) = 0._RPP ; c(2,2,1) = 11147._RPP / 960._RPP + ! (i-2)*(i-1) + c(3,2,1) = -3229._RPP / 480._RPP + ! / ; / ; / + c(0,3,1) = 0._RPP ; c(1,3,1) = 0._RPP ; c(2,3,1) = 0._RPP + ! (i-2)*(i-2) + c(3,3,1) = 3169._RPP / 2880._RPP + ! stencil 2 + ! (i+2)*(i+2) ; (i+1)*(i+2) ; i*(i+2) + c(0,0,2) = 3169._RPP / 2880._RPP; c(1,0,2) = -3229._RPP / 480._RPP; c(2,0,2) = 3169._RPP / 480._RPP + ! (i-1)*(i+2) + c(3,0,2) = -2989._RPP / 1440._RPP + ! / ; (i+1)*(i+1) ; i*(i+1) + c(0,1,2) = 0._RPP ; c(1,1,2) = 11147._RPP / 960._RPP; c(2,1,2) =-11767._RPP / 480._RPP + ! (i-1)*(i+1) + c(3,1,2) = 1283._RPP / 160._RPP + ! / ; / ; i*i + c(0,2,2) = 0._RPP ; c(1,2,2) = 0._RPP ; c(2,2,2) = 13667._RPP / 960._RPP + ! (i-1)*i + c(3,2,2) = -5069._RPP / 480._RPP + ! / ; / ; / + c(0,3,2) = 0._RPP ; c(1,3,2) = 0._RPP ; c(2,3,2) = 0._RPP + ! (i-1)*(i-1) + c(3,3,2) = 6649._RPP / 2880._RPP + ! stencil 3 + ! (i+3)*(i+3) ; (i+2)*(i+3) ; (i+1)*(i+3) + c(0,0,3) = 6649._RPP / 2880._RPP; c(1,0,3) = -2623._RPP / 160._RPP; c(2,0,3) = 9449._RPP / 480._RPP + ! i*(i+3) + c(3,0,3) =-11389._RPP / 1440._RPP + ! / ; (i+2)*(i+2) ; (i+1)*(i+2) + c(0,1,3) = 0._RPP ; c(1,1,3) = 28547._RPP / 960._RPP; c(2,1,3) =-35047._RPP / 480._RPP + ! i*(i+2) + c(3,1,3) = 14369._RPP / 480._RPP + ! / ; / ; (i+1)*(i+1) + c(0,2,3) = 0._RPP ; c(1,2,3) = 0._RPP ; c(2,2,3) = 44747._RPP / 960._RPP + ! i*(i+1) + c(3,2,3) = -6383._RPP / 160._RPP + ! / ; / ; / + c(0,3,3) = 0._RPP ; c(1,3,3) = 0._RPP ; c(2,3,3) = 0._RPP + ! i*i + c(3,3,3) = 25729._RPP / 2880._RPP + case(5) ! 9th order + ! stencil 0 + ! i*i ; (i-1)*i ; (i-2)*i + c(0,0,0) = 668977._RPP / 30240._RPP; c(1,0,0) = -8055511._RPP / 60480._RPP; c(2,0,0) = 3141559._RPP / 20160._RPP + ! (i-3)*i ; (i-4)*i + c(3,0,0) = -5121853._RPP / 60480._RPP; c(4,0,0) = 1076779._RPP / 60480._RPP + ! / ; (i-1)*(i-1) ; (i-2)*(i-1) + c(0,1,0) = 0._RPP ; c(1,1,0) = 12627689._RPP / 60480._RPP; c(2,1,0) =-2536843._RPP / 5040._RPP + ! (i-3)*(i-1) ; (i-4)*(i-1) + c(3,1,0) = 8405471._RPP / 30240._RPP; c(4,1,0) = -3568693._RPP / 60480._RPP + ! / ; / ; (i-2)*(i-2) + c(0,2,0) = 0._RPP ; c(1,2,0) = 0._RPP ; c(2,2,0) = 2085371._RPP / 6720._RPP + ! (i-3)*(i-2) ; (i-4)*(i-2) + c(3,2,0) = -1751863._RPP / 5040._RPP; c(4,2,0) = 1501039._RPP / 20160._RPP + ! / ; / ; / + c(0,3,0) = 0._RPP ; c(1,3,0) = 0._RPP ; c(2,3,0) = 0._RPP + ! (i-3)*(i-3) ; (i-4)*(i-3) + c(3,3,0) = 5951369._RPP / 60480._RPP; c(4,3,0) = -2569471._RPP / 60480._RPP + ! / ; / ; / + c(0,4,0) = 0._RPP ; c(1,4,0) = 0._RPP ; c(2,4,0) = 0._RPP + ! / ; (i-4)*(i-4) + c(3,4,0) = 0._RPP ; c(4,4,0) = 139567._RPP / 30240._RPP + ! stencil 1 + ! (i+1)*(i+1) ; i*(i+1) ; (i-1)*(i+1) + c(0,0,1) = 139567._RPP / 30240._RPP; c(1,0,1) = -1714561._RPP / 60480._RPP; c(2,0,1) = 671329._RPP / 20160._RPP + ! (i-2)*(i+1) ; (i-3)*(i+1) + c(3,0,1) = -1079563._RPP / 60480._RPP; c(4,0,1) = 221869._RPP / 60480._RPP + ! / ; i*i ; (i-1)*i + c(0,1,1) = 0._RPP ; c(1,1,1) = 2932409._RPP / 60480._RPP; c(2,1,1) = -306569._RPP / 2520._RPP + ! (i-2)*i ; (i-3)*i + c(3,1,1) = 2027351._RPP / 30240._RPP; c(4,1,1) = -847303._RPP / 60480._RPP + ! / ; / ; (i-1)*(i-1) + c(0,2,1) = 0._RPP ; c(1,2,1) = 0._RPP ; c(2,2,1) = 539351._RPP / 6720._RPP + ! (i-2)*(i-1) ; (i-3)*(i-1) + c(3,2,1) = -57821._RPP / 630._RPP; c(4,2,1) = 395389._RPP / 20160._RPP + ! / ; / ; / + c(0,3,1) = 0._RPP ; c(1,3,1) = 0._RPP ; c(2,3,1) = 0._RPP + ! (i-2)*(i-2) ; (i-3)*(i-2) + c(3,3,1) = 1650569._RPP / 60480._RPP; c(4,3,1) = -725461._RPP / 60480._RPP + ! / ; / ; / + c(0,4,1) = 0._RPP ; c(1,4,1) = 0._RPP ; c(2,4,1) = 0._RPP + ! / ; (i-3)*(i-3) + c(3,4,1) = 0._RPP ; c(4,4,1) = 20591._RPP / 15120._RPP + ! stencil 2 + ! (i+2)*(i+2) ; (i+1)*(i+2) ; i*(i+2) + c(0,0,2) = 20591._RPP / 15120._RPP; c(1,0,2) = -601771._RPP / 60480._RPP; c(2,0,2) = 266659._RPP / 20160._RPP + ! (i-1)*(i+2) ; (i-2)*(i+2) + c(3,0,2) = -461113._RPP / 60480._RPP; c(4,0,2) = 98179._RPP / 60480._RPP + ! / ; (i+1)*(i+1) ; i*(i+1) + c(0,1,2) = 0._RPP ; c(1,1,2) = 1228889._RPP / 60480._RPP; c(2,1,2) = -291313._RPP / 5040._RPP + ! (i-1)*(i+1) ; (i-2)*(i+1) + c(3,1,2) = 1050431._RPP / 30240._RPP; c(4,1,2) = -461113._RPP / 60480._RPP + ! / ; / ; i*i + c(0,2,2) = 0._RPP ; c(1,2,2) = 0._RPP ; c(2,2,2) = 299531._RPP / 6720._RPP + ! (i-1)*i ; (i-2)*i + c(3,2,2) = -291313._RPP / 5040._RPP; c(4,2,2) = 266659._RPP / 20160._RPP + ! / ; / ; / + c(0,3,2) = 0._RPP ; c(1,3,2) = 0._RPP ; c(2,3,2) = 0._RPP + ! (i-1)*(i-1) ; (i-2)*(i-1) + c(3,3,2) = 1228889._RPP / 60480._RPP; c(4,3,2) = -601771._RPP / 60480._RPP + ! / ; / ; / + c(0,4,2) = 0._RPP ; c(1,4,2) = 0._RPP ; c(2,4,2) = 0._RPP + ! / ; (i-2)*(i-2) + c(3,4,2) = 0._RPP ; c(4,4,2) = 20591._RPP / 15120._RPP + ! stencil 3 + ! (i+3)*(i+3) ; (i+2)*(i+3) ; (i+1)*(i+3) + c(0,0,3) = 20591._RPP / 15120._RPP; c(1,0,3) = -725461._RPP / 60480._RPP; c(2,0,3) = 395389._RPP / 20160._RPP + ! i*(i+3) ; (i-1)*(i+3) + c(3,0,3) = -847303._RPP / 60480._RPP; c(4,0,3) = 221869._RPP / 60480._RPP + ! / ; (i+2)*(i+2) ; (i+1)*(i+2) + c(0,1,3) = 0._RPP ; c(1,1,3) = 1650569._RPP / 60480._RPP; c(2,1,3) = -57821._RPP / 630._RPP + ! i*(i+2) ; (i-1)*(i+2) + c(3,1,3) = 2027351._RPP / 30240._RPP; c(4,1,3) = -1079563._RPP / 60480._RPP + ! / ; / ; (i+1)*(i+1) + c(0,2,3) = 0._RPP ; c(1,2,3) = 0._RPP ; c(2,2,3) = 539351._RPP / 6720._RPP + ! i*(i+1) ; (i-1)*(i+1) + c(3,2,3) = -306569._RPP / 2520._RPP; c(4,2,3) = 671329._RPP / 20160._RPP + ! / ; / ; / + c(0,3,3) = 0._RPP ; c(1,3,3) = 0._RPP ; c(2,3,3) = 0._RPP + ! i*i ; (i-1)*i + c(3,3,3) = 2932409._RPP / 60480._RPP; c(4,3,3) = -1714561._RPP / 60480._RPP + ! / ; / ; / + c(0,4,3) = 0._RPP ; c(1,4,3) = 0._RPP ; c(2,4,3) = 0._RPP + ! / ; (i-1)*(i-1) + c(3,4,3) = 0._RPP ; c(4,4,3) = 139567._RPP / 30240._RPP + ! stencil 4 + ! (i+4)*(i+4) ; (i+3)*(i+4) ; (i+2)*(i+4) + c(0,0,4) = 139567._RPP / 30240._RPP; c(1,0,4) = -2569471._RPP / 60480._RPP; c(2,0,4) = 1501039._RPP / 20160._RPP + ! (i+1)*(i+4) ; i*(i+4) + c(3,0,4) = -3568693._RPP / 60480._RPP; c(4,0,4) = 1076779._RPP / 60480._RPP + ! / ; (i+3)*(i+3) ; (i+2)*(i+3) + c(0,1,4) = 0._RPP ; c(1,1,4) = 5951369._RPP / 60480._RPP; c(2,1,4) =-1751863._RPP / 5040._RPP + ! (i+1)*(i+3) ; i*(i+3) + c(3,1,4) = 8405471._RPP / 30240._RPP; c(4,1,4) = -5121853._RPP / 60480._RPP + ! / ; / ; (i+2)*(i+2) + c(0,2,4) = 0._RPP ; c(1,2,4) = 0._RPP ; c(2,2,4) = 2085371._RPP / 6720._RPP + ! (i+1)*(i+2) ; i*(i+2) + c(3,2,4) = -2536843._RPP / 5040._RPP; c(4,2,4) = 3141559._RPP / 20160._RPP + ! / ; / ; / + c(0,3,4) = 0._RPP ; c(1,3,4) = 0._RPP ; c(2,3,4) = 0._RPP + ! (i+1)*(i+1) ; i*(i+1) + c(3,3,4) = 12627689._RPP / 60480._RPP; c(4,3,4) = -8055511._RPP / 60480._RPP + ! / ; / ; / + c(0,4,4) = 0._RPP ; c(1,4,4) = 0._RPP ; c(2,4,4) = 0._RPP + ! / ; i*i + c(3,4,4) = 0._RPP ; c(4,4,4) = 668977._RPP / 30240._RPP + case(6) ! 11th order + ! stencil 0 + ! i*i ; (i-1)*i ; (i-2)*i + c(0,0,0) = 373189088._RPP/ 7027375._RPP; c(1,0,0) = -157371280._RPP/ 384113._RPP; c(2,0,0) = 497902688._RPP/ 756325._RPP + ! (i-3)*i ; (i-4)*i ; (i-5)*i + c(3,0,0) =-427867945._RPP/ 780329._RPP; c(4,0,0) = 295095211._RPP/ 1259192._RPP; c(5,0,0) = -131759526._RPP/ 3224383._RPP + + ! / ; (i-1)*(i-1) ; (i-2)*(i-1) + c(0,1,0) = 0._RPP ; c(1,1,0) = 498196769._RPP/ 609968._RPP; c(2,1,0) = -497421494._RPP/ 185427._RPP + ! (i-3)*(i-1) ; (i-4)*(i-1) ; (i-5)*(i-1) + c(3,1,0) =1150428332._RPP/ 508385._RPP; c(4,1,0) = -674462631._RPP/ 691651._RPP; c(5,1,0) = 112453613._RPP/ 657635._RPP + + ! / ; / ; (i-2)*(i-2) + c(0,2,0) = 0._RPP ; c(1,2,0) = 0._RPP ; c(2,2,0) = 2292397033._RPP/ 1024803._RPP + ! (i-3)*(i-2) ; (i-4)*(i-2) ; (i-5)*(i-2) + c(3,2,0) =-378281867._RPP/ 99229._RPP; c(4,2,0) = 1328498639._RPP/ 803154._RPP; c(5,2,0) = -115324682._RPP/ 395671._RPP + + ! / ; / ; / + c(0,3,0) = 0._RPP ; c(1,3,0) = 0._RPP ; c(2,3,0) = 0._RPP + ! (i-3)*(i-3) ; (i-4)*(i-3) ; (i-5)*(i-3) + c(3,3,0) =1406067637._RPP/ 859229._RPP; c(4,3,0) =-2146148426._RPP/ 1503065._RPP; c(5,3,0) = 586668707._RPP/ 2322432._RPP + + ! / ; / ; / + c(0,4,0) = 0._RPP ; c(1,4,0) = 0._RPP ; c(2,4,0) = 0._RPP + ! / ; (i-4)*(i-4) ; (i-5)*(i-4) + c(3,4,0) = 0._RPP ; c(4,4,0) = 453375035._RPP/ 1449454._RPP; c(5,4,0) = -504893127._RPP/ 4547012._RPP + + ! / ; / ; / + c(0,5,0) = 0._RPP ; c(1,5,0) = 0._RPP ; c(2,5,0) = 0._RPP + ! / ; / ; (i-5)*(i-5) + c(3,5,0) = 0._RPP ; c(4,5,0) = 0._RPP ; c(5,5,0) = 105552913._RPP/10682745._RPP + ! stencil 1 + ! (i+1)*(i+1) ; i*(i+1) ; (i-1)*(i+1) + c(0,0,1) = 105552913._RPP/10682745._RPP; c(1,0,1) = -338120165._RPP/ 4351341._RPP; c(2,0,1) = 356490569._RPP/ 2842289._RPP + ! (i-2)*(i+1) ; (i-3)*(i+1) ; (i-4)*(i+1) + c(3,0,1) =-146902225._RPP/ 1415767._RPP; c(4,0,1) = 195395281._RPP/ 4459947._RPP; c(5,0,1) = -24044484._RPP/ 3193217._RPP + + ! / ; i*i ; (i-1)*i + c(0,1,1) = 0._RPP ; c(1,1,1) = 169505788._RPP/ 1035915._RPP; c(2,1,1) =-2984991531._RPP/ 5434265._RPP + ! (i-2)*i ; (i-3)*i ; (i-4)*i + c(3,1,1) = 771393469._RPP/ 1663855._RPP; c(4,1,1) = -270758311._RPP/ 1365867._RPP; c(5,1,1) = 26449004._RPP/ 769961._RPP + + ! / ; / ; (i-1)*(i-1) + c(0,2,1) = 0._RPP ; c(1,2,1) = 0._RPP ; c(2,2,1) = 471933572._RPP/ 993629._RPP + ! (i-2)*(i-1) ; (i-3)*(i-1) ; (i-4)*(i-1) + c(3,2,1) =-479783044._RPP/ 585775._RPP; c(4,2,1) = 840802608._RPP/ 2367661._RPP; c(5,2,1) = -347085621._RPP/ 5587817._RPP + + ! / ; / ; / + c(0,3,1) = 0._RPP ; c(1,3,1) = 0._RPP ; c(2,3,1) = 0._RPP + ! (i-2)*(i-2) ; (i-3)*(i-2) ; (i-4)*(i-2) + c(3,3,1) =1031953342._RPP/ 2867575._RPP; c(4,3,1) = -288641753._RPP/ 912148._RPP; c(5,3,1) = 315600562._RPP/ 5645537._RPP + + ! / ; / ; / + c(0,4,1) = 0._RPP ; c(1,4,1) = 0._RPP ; c(2,4,1) = 0._RPP + ! / ; (i-3)*(i-3) ; (i-4)*(i-3) + c(3,4,1) = 0._RPP ; c(4,4,1) = 142936745._RPP/ 2029182._RPP; c(5,4,1) = -109600459._RPP/ 4359925._RPP + + ! / ; / ; / + c(0,5,1) = 0._RPP ; c(1,5,1) = 0._RPP ; c(2,5,1) = 0._RPP + ! / ; / ; (i-4)*(i-4) + c(3,5,1) = 0._RPP ; c(4,5,1) = 0._RPP ; c(5,5,1) = 30913579._RPP/13651507._RPP + ! stencil 2 + ! (i+2)*(i+2) ; (i+1)*(i+2) ; i*(i+2) + c(0,0,2) = 30913579._RPP/13651507._RPP; c(1,0,2) = -87214523._RPP/ 4439774._RPP; c(2,0,2) = 99590409._RPP/ 2965471._RPP + ! (i-1)*(i+2) ; (i-2)*(i+2) ; (i-3)*(i+2) + c(3,0,2) = -95644735._RPP/ 3360137._RPP; c(4,0,2) = 79135747._RPP/ 6577234._RPP; c(5,0,2) = -28962993._RPP/14228092._RPP + + ! / ; (i+1)*(i+1) ; i*(i+1) + c(0,1,2) = 0._RPP ; c(1,1,2) = 24025059._RPP/ 519766._RPP; c(2,1,2) = -370146220._RPP/ 2226351._RPP + ! (i-1)*(i+1) ; (i-2)*(i+1) ; (i-3)*(i+1) + c(3,1,2) = 87743770._RPP/ 602579._RPP; c(4,1,2) =-1512485867._RPP/24006092._RPP; c(5,1,2) = 251883319._RPP/23224320._RPP + + ! / ; / ; i*i + c(0,2,2) = 0._RPP ; c(1,2,2) = 0._RPP ; c(2,2,2) = 200449727._RPP/ 1269707._RPP + ! (i-1)*i ; (i-2)*i ; (i-3)*i + c(3,2,2) =-274966489._RPP/ 950662._RPP; c(4,2,2) = 201365679._RPP/ 1563055._RPP; c(5,2,2) = -61673356._RPP/ 2721737._RPP + + ! / ; / ; / + c(0,3,2) = 0._RPP ; c(1,3,2) = 0._RPP ; c(2,3,2) = 0._RPP + ! (i-1)*(i-1) ; (i-2)*(i-1) ; (i-3)*(i-1) + c(3,3,2) = 586743463._RPP/ 4237706._RPP; c(4,3,2) = -723607356._RPP/ 5654437._RPP; c(5,3,2) = 268747951._RPP/11612160._RPP + + ! / ; / ; / + c(0,4,2) = 0._RPP ; c(1,4,2) = 0._RPP ; c(2,4,2) = 0._RPP + ! / ; (i-2)*(i-2) ; (i-3)*(i-2) + c(3,4,2) = 0._RPP ; c(4,4,2) = 113243845._RPP/ 3672222._RPP; c(5,4,2) = -74146214._RPP/ 6413969._RPP + + ! / ; / ; / + c(0,5,2) = 0._RPP ; c(1,5,2) = 0._RPP ; c(2,5,2) = 0._RPP + ! / ; / ; (i-3)*(i-3) + c(3,5,2) = 0._RPP ; c(4,5,2) = 0._RPP ; c(5,5,2) = 15418339._RPP/13608685._RPP + ! stencil 3 + ! (i+3)*(i+3) ; (i+2)*(i+3) ; (i+1)*(i+3) + c(0,0,3) = 15418339._RPP/13608685._RPP; c(1,0,3) = -74146214._RPP/ 6413969._RPP; c(2,0,3) = 268747951._RPP/11612160._RPP + ! i*(i+3) ; (i-1)*(i+3) ; (i-2)*(i+3) + c(3,0,3) = -61673356._RPP/ 2721737._RPP; c(4,0,3) = 251883319._RPP/23224320._RPP; c(5,0,3) = -28962993._RPP/14228092._RPP + + ! / ; (i+2)*(i+2) ; (i+1)*(i+2) + c(0,1,3) = 0._RPP ; c(1,1,3) = 113243845._RPP/ 3672222._RPP; c(2,1,3) = -723607356._RPP/ 5654437._RPP + ! i*(i+2) ; (i-1)*(i+2) ; (i-2)*(i+2) + c(3,1,3) = 201365679._RPP/ 1563055._RPP; c(4,1,3) =-1512485867._RPP/24006092._RPP; c(5,1,3) = 79135747._RPP/ 6577234._RPP + + ! / ; / ; (i+1)*(i+1) + c(0,2,3) = 0._RPP ; c(1,2,3) = 0._RPP ; c(2,2,3) = 586743463._RPP/ 4237706._RPP + ! i*(i+1) ; (i-1)*(i+1) ; (i-2)*(i+1) + c(3,2,3) =-274966489._RPP/ 950662._RPP; c(4,2,3) = 87743770._RPP/ 602579._RPP; c(5,2,3) = -95644735._RPP/ 3360137._RPP + + ! / ; / ; / + c(0,3,3) = 0._RPP ; c(1,3,3) = 0._RPP ; c(2,3,3) = 0._RPP + ! i*i ; (i-1)*i ; (i-2)*i + c(3,3,3) = 200449727._RPP/ 1269707._RPP; c(4,3,3) = -370146220._RPP/ 2226351._RPP; c(5,3,3) = 99590409._RPP/ 2965471._RPP + + ! / ; / ; / + c(0,4,3) = 0._RPP ; c(1,4,3) = 0._RPP ; c(2,4,3) = 0._RPP + ! / ; (i-1)*(i-1) ; (i-2)*(i-1) + c(3,4,3) = 0._RPP ; c(4,4,3) = 24025059._RPP/ 519766._RPP; c(5,4,3) = -87214523._RPP/ 4439774._RPP + + ! / ; / ; / + c(0,5,3) = 0._RPP ; c(1,5,3) = 0._RPP ; c(2,5,3) = 0._RPP + ! / ; / ; (i-2)*(i-2) + c(3,5,3) = 0._RPP ; c(4,5,3) = 0._RPP ; c(5,5,3) = 30913579._RPP/13651507._RPP + ! stencil 4 + ! (i+4)*(i+4) ; (i+3)*(i+4) ; (i+2)*(i+4) + c(0,0,4) = 30913579._RPP/13651507._RPP; c(1,0,4) = -109600459._RPP/ 4359925._RPP; c(2,0,4) = 315600562._RPP/ 5645537._RPP + ! (i+1)*(i+4) ; i*(i+4) ; (i-1)*(i+4) + c(3,0,4) =-347085621._RPP/ 5587817._RPP; c(4,0,4) = 26449004._RPP/ 769961._RPP; c(5,0,4) = -24044484._RPP/ 3193217._RPP + + ! / ; (i+3)*(i+3) ; (i+2)*(i+3) + c(0,1,4) = 0._RPP ; c(1,1,4) = 142936745._RPP/ 2029182._RPP; c(2,1,4) = -288641753._RPP/ 912148._RPP + ! (i+1)*(i+3) ; i*(i+3) ; (i-1)*(i+3) + c(3,1,4) = 840802608._RPP/ 2367661._RPP; c(4,1,4) = -270758311._RPP/ 1365867._RPP; c(5,1,4) = 195395281._RPP/ 4459947._RPP + + ! / ; / ; (i+2)*(i+2) + c(0,2,4) = 0._RPP ; c(1,2,4) = 0._RPP ; c(2,2,4) = 1031953342._RPP/ 2867575._RPP + ! (i+1)*(i+2) ; i*(i+2) ; (i-1)*(i+2) + c(3,2,4) =-479783044._RPP/ 585775._RPP; c(4,2,4) = 771393469._RPP/ 1663855._RPP; c(5,2,4) = -146902225._RPP/ 1415767._RPP + + ! / ; / ; / + c(0,3,4) = 0._RPP ; c(1,3,4) = 0._RPP ; c(2,3,4) = 0._RPP + ! (i+1)*(i+1) ; i*(i+1) ; (i-1)*(i+1) + c(3,3,4) = 471933572._RPP/ 993629._RPP; c(4,3,4) =-2984991531._RPP/ 5434265._RPP; c(5,3,4) = 356490569._RPP/ 2842289._RPP + + ! / ; / ; / + c(0,4,4) = 0._RPP ; c(1,4,4) = 0._RPP ; c(2,4,4) = 0._RPP + ! / ; i*i ; (i-1)*i + c(3,4,4) = 0._RPP ; c(4,4,4) = 169505788._RPP/ 1035915._RPP; c(5,4,4) = -338120165._RPP/ 4351341._RPP + + ! / ; / ; / + c(0,5,4) = 0._RPP ; c(1,5,4) = 0._RPP ; c(2,5,4) = 0._RPP + ! / ; / ; (i-1)*(i-1) + c(3,5,4) = 0._RPP ; c(4,5,4) = 0._RPP ; c(5,5,4) = 105552913._RPP/10682745._RPP + ! stencil 5 + ! (i+5)*(i+5) ; (i+4)*(i+5) ; (i+3)*(i+5) + c(0,0,5) = 105552913._RPP/10682745._RPP; c(1,0,5) = -504893127._RPP/ 4547012._RPP; c(2,0,5) = 586668707._RPP/ 2322432._RPP + ! (i+2)*(i+5) ; (i+1)*(i+5) ; i*(i+5) + c(3,0,5) =-115324682._RPP/ 395671._RPP; c(4,0,5) = 112453613._RPP/ 657635._RPP; c(5,0,5) = -131759526._RPP/ 3224383._RPP + + ! / ; (i+4)*(i+3) ; (i+3)*(i+3) + c(0,1,5) = 0._RPP ; c(1,1,5) = 453375035._RPP/ 1449454._RPP; c(2,1,5) =-2146148426._RPP/ 1503065._RPP + ! (i+2)*(i+3) ; (i+1)*(i+3) ; i*(i+3) + c(3,1,5) =1328498639._RPP/ 803154._RPP; c(4,1,5) = -674462631._RPP/ 691651._RPP; c(5,1,5) = 295095211._RPP/ 1259192._RPP + + ! / ; / ; (i+3)*(i+2) + c(0,2,5) = 0._RPP ; c(1,2,5) = 0._RPP ; c(2,2,5) = 1406067637._RPP/ 859229._RPP + ! (i+2)*(i+2) ; (i+1)*(i+2) ; i*(i+2) + c(3,2,5) =-378281867._RPP/ 99229._RPP; c(4,2,5) = 1150428332._RPP/ 508385._RPP; c(5,2,5) = -427867945._RPP/ 780329._RPP + + ! / ; / ; / + c(0,3,5) = 0._RPP ; c(1,3,5) = 0._RPP ; c(2,3,5) = 0._RPP + ! (i+2)*(i+1) ; (i+1)*(i+1) ; i*(i+1) + c(3,3,5) =2292397033._RPP/ 1024803._RPP; c(4,3,5) = -497421494._RPP/ 185427._RPP; c(5,3,5) = 497902668._RPP/ 756325._RPP + + ! / ; / ; / + c(0,4,5) = 0._RPP ; c(1,4,5) = 0._RPP ; c(2,4,5) = 0._RPP + ! / ; (i+1)*i ; i*i + c(3,4,5) = 0._RPP ; c(4,4,5) = 498196769._RPP/ 609968._RPP; c(5,4,5) = -157371280._RPP/ 384113._RPP + + ! / ; / ; / + c(0,5,5) = 0._RPP ; c(1,5,5) = 0._RPP ; c(2,5,5) = 0._RPP + ! / ; / ; i*(i-1) + c(3,5,5) = 0._RPP ; c(4,5,5) = 0._RPP ; c(5,5,5) = 373189088._RPP/ 7027375._RPP + case(7) ! 13th order + ! stencil 0 + ! i*i ; (i-1)*i + c(0,0,0) = 307570060._RPP/2438487._RPP; c(1,0,0) = -842151863._RPP/702281._RPP + ! (i-2)*i ; (i-3)*i + c(2,0,0) = 1025357155._RPP/415733._RPP; c(3,0,0) = -882134137._RPP/316505._RPP + ! (i-4)*i ; (i-5)*i + c(4,0,0) = 2375865880._RPP/1312047._RPP; c(5,0,0) = -418267211._RPP/655432._RPP + ! (i-6)*i + c(6,0,0) = 65647731._RPP/691205._RPP + + ! / ; (i-1)*(i-1) + c(0,1,0) = 0._RPP; c(1,1,0) = 1267010831._RPP/433225._RPP + ! (i-2)*(i-1) ; (i-3)*(i-1) + c(2,1,0) = -2727583905._RPP/223057._RPP; c(3,1,0) = 2854637563._RPP/204507._RPP + ! (i-4)*(i-1) ; (i-5)*(i-1) + c(4,1,0) = -550697211._RPP/60310._RPP; c(5,1,0) = 803154527._RPP/248375._RPP + ! (i-6)*(i-1) + c(6,1,0) = -299800985._RPP/620702._RPP + + ! / ; / + c(0,2,0) = 0._RPP; c(1,2,0) = 0._RPP + ! (i-2)*(i-2) ; (i-3)*(i-2) + c(2,2,0) = 2398154453._RPP/185516._RPP; c(3,2,0) = -485497721._RPP/16325._RPP + ! (i-4)*(i-2) ; (i-5)*(i-2) + c(4,2,0) = 3315206316._RPP/169489._RPP; c(5,2,0) = -1068783425._RPP/153683._RPP + ! (i-6)*(i-2) + c(6,2,0) = 412399715._RPP/395812._RPP + + ! / ; / + c(0,3,0) = 0._RPP; c(1,3,0) = 0._RPP + ! / ; (i-3)*(i-3) + c(2,3,0) = 0._RPP; c(3,3,0) = 2558389867._RPP/148729._RPP + ! (i-4)*(i-3) ; (i-5)*(i-3) + c(4,3,0) = -1833856939._RPP/80705._RPP; c(5,3,0) = 2369766527._RPP/292389._RPP + ! (i-6)*(i-3) + c(6,3,0) = -219701291._RPP/180490._RPP + + ! / ; / + c(0,4,0) = 0._RPP; c(1,4,0) = 0._RPP + ! / ; / + c(2,4,0) = 0._RPP; c(3,4,0) = 0._RPP + ! (i-4)*(i-4) ; (i-5)*(i-4) + c(4,4,0) = 384888217._RPP/51123._RPP; c(5,4,0) = -3101495154._RPP/576017._RPP + ! (i-6)*(i-4) + c(6,4,0) = 562957181._RPP/694753._RPP + + ! / ; / + c(0,5,0) = 0._RPP; c(1,5,0) = 0._RPP + ! / ; / + c(2,5,0) = 0._RPP; c(3,5,0) = 0._RPP + ! / ; (i-5)*(i-5) + c(4,5,0) = 0._RPP; c(5,5,0) = 368117849._RPP/381597._RPP + ! (i-6)*(i-5) + c(6,5,0) = -484093752._RPP/1664533._RPP + + ! / ; / + c(0,6,0) = 0._RPP; c(1,6,0) = 0._RPP + ! / ; / + c(2,6,0) = 0._RPP; c(3,6,0) = 0._RPP + ! / ; / + c(4,6,0) = 0._RPP; c(5,6,0) = 0._RPP + ! (i-6)*(i-6) + c(6,6,0) = 118739219._RPP/5409702._RPP + ! stencil 1 + ! (i+1)*(i+1) ; i*(i+1) + c(0,0,1) = 118739219._RPP/5409702._RPP; c(1,0,1) = -258813979._RPP/1219012._RPP + ! (i-1)*(i+1) ; (i-2)*(i+1) + c(2,0,1) = 451414666._RPP/1028589._RPP; c(3,0,1) = -219042731._RPP/442919._RPP + ! (i-3)*(i+1) ; (i-4)*(i+1) + c(4,0,1) = 200564827._RPP/628331._RPP; c(5,0,1) = -1157045253._RPP/10370330._RPP + ! (i-5)*(i+1) + c(6,0,1) = 43003346._RPP/2612319._RPP + + ! / ; i*(i-1) + c(0,1,1) = 0._RPP; c(1,1,1) = 151821033._RPP/282817._RPP + ! (i-1)*(i-1) ; (i-2)*(i-1) + c(2,1,1) = -2876116249._RPP/1263255._RPP; c(3,1,1) = 6598378479._RPP/2533904._RPP + ! (i-3)*(i-1) ; (i-4)*(i-1) + c(4,1,1) = -448069659._RPP/263978._RPP; c(5,1,1) = 1029357835._RPP/1723277._RPP + ! (i-5)*(i-1) + c(6,1,1) = -265505701._RPP/2998139._RPP + + ! / ; / + c(0,2,1) = 0._RPP; c(1,2,1) = 0._RPP + ! (i-1)*(i-2) ; (i-3)*(i-2) + c(2,2,1) = 3295939303._RPP/1339169._RPP; c(3,2,1) = -952714155._RPP/166894._RPP + ! (i-4)*(i-2) ; (i-5)*(i-2) + c(4,2,1) = 656116894._RPP/174649._RPP; c(5,2,1) = -577579349._RPP/433921._RPP + ! (i-6)*(i-2) + c(6,2,1) = 265135851._RPP/1336964._RPP + + ! / ; / + c(0,3,1) = 0._RPP; c(1,3,1) = 0._RPP + ! / ; (i-2)*(i-3) + c(2,3,1) = 0._RPP; c(3,3,1) = 353679247._RPP/105637._RPP + ! (i-3)*(i-3) ; (i-4)*(i-3) + c(4,3,1) = -1397796418._RPP/314477._RPP; c(5,3,1) = 498890606._RPP/314761._RPP + ! (i-5)*(i-3) + c(6,3,1) = -246865952._RPP/1040433._RPP + + ! / ; / + c(0,4,1) = 0._RPP; c(1,4,1) = 0._RPP + ! / ; / + c(2,4,1) = 0._RPP; c(3,4,1) = 0._RPP + ! (i-3)*(i-4) ; (i-4)*(i-4) + c(4,4,1) = 1142129285._RPP/768659._RPP; c(5,4,1) = -185662673._RPP/174204._RPP + ! (i-5)*(i-4) + c(6,4,1) = 1743860591._RPP/10881504._RPP + + ! / ; / + c(0,5,1) = 0._RPP; c(1,5,1) = 0._RPP + ! / ; / + c(2,5,1) = 0._RPP; c(3,5,1) = 0._RPP + ! / ; (i-5)*(i-5) + c(4,5,1) = 0._RPP; c(5,5,1) = 393580372._RPP/2049353._RPP + ! (i-6)*(i-5) + c(6,5,1) = -483420287._RPP/8336284._RPP + + ! / ; / + c(0,6,1) = 0._RPP; c(1,6,1) = 0._RPP + ! / ; / + c(2,6,1) = 0._RPP; c(3,6,1) = 0._RPP + ! / ; / + c(4,6,1) = 0._RPP; c(5,6,1) = 0._RPP + ! (i-6)*(i-5) + c(6,6,1) = 76695443._RPP/17458022._RPP + ! stencil 2 + ! (i+2)*i ; (i+1)*i + c(0,0,2) = 76695443._RPP/17458022._RPP; c(1,0,2) = -303410983._RPP/6736159._RPP + ! i*i ; (i-1)*i + c(2,0,2) = 305770890._RPP/3186613._RPP; c(3,0,2) = -337645273._RPP/3091776._RPP + ! (i-2)*i ; (i-3)*i + c(4,0,2) = 164871587._RPP/2347023._RPP; c(5,0,2) = -205305705._RPP/8465339._RPP + ! (i-4)*i + c(6,0,2) = 77150072._RPP/21955151._RPP + + ! / ; (i+1)*(i-1) + c(0,1,2) = 0._RPP; c(1,1,2) = 266980515._RPP/2188712._RPP + ! i*(i-1) ; (i-1)*(i-1) + c(2,1,2) = -470895955._RPP/874781._RPP; c(3,1,2) = 337717185._RPP/538487._RPP + ! (i-2)*(i-1) ; (i-3)*(i-1) + c(4,1,2) = -1002866209._RPP/2445347._RPP; c(5,1,2) = 154914521._RPP/1081252._RPP + ! (i-4)*(i-1) + c(6,1,2) = -98152843._RPP/4687720._RPP + + ! / ; / + c(0,2,2) = 0._RPP; c(1,2,2) = 0._RPP + ! i*(i-1) ; (i-1)*(i-2) + c(2,2,2) = 576629617._RPP/938378._RPP; c(3,2,2) = -631316405._RPP/429286._RPP + ! (i-2)*(i-2) ; (i-3)*(i-2) + c(4,2,2) = 750365573._RPP/765885._RPP; c(5,2,2) = -251896262._RPP/725959._RPP + ! (i-4)*(i-2) + c(6,2,2) = 143992467._RPP/2811164._RPP + + ! / ; / + c(0,3,2) = 0._RPP; c(1,3,2) = 0._RPP + ! / ; (i-1)*(i-3) + c(2,3,2) = 0._RPP; c(3,3,2) = 449371687._RPP/498274._RPP + ! (i-2)*(i-3) ; (i-3)*(i-3) + c(4,3,2) = -660635886._RPP/538753._RPP; c(5,3,2) = 13260333719._RPP/30064515._RPP + ! (i-4)*(i-3) + c(6,3,2) = -177311125._RPP/2691566._RPP + + ! / ; / + c(0,4,2) = 0._RPP; c(1,4,2) = 0._RPP + ! / ; / + c(2,4,2) = 0._RPP; c(3,4,2) = 0._RPP + ! (i-2)*(i-4) ; (i-3)*(i-4) + c(4,4,2) = 787491691._RPP/1852394._RPP; c(5,4,2) = -393831298._RPP/1266551._RPP + ! (i-4)*(i-4) + c(6,4,2) = 85769455._RPP/1822342._RPP + + ! / ; / + c(0,5,2) = 0._RPP; c(1,5,2) = 0._RPP + ! / ; / + c(2,5,2) = 0._RPP; c(3,5,2) = 0._RPP + ! / ; (i-3)*(i-5) + c(4,5,2) = 0._RPP; c(5,5,2) = 309673793._RPP/5357421._RPP + ! (i-4)*(i-5) + c(6,5,2) = -86513123._RPP/4872070._RPP + + ! / ; / + c(0,6,2) = 0._RPP; c(1,6,2) = 0._RPP + ! / ; / + c(2,6,2) = 0._RPP; c(3,6,2) = 0._RPP + ! / ; / + c(4,6,2) = 0._RPP; c(5,6,2) = 0._RPP + ! (i-4)*(i-5) + c(6,6,2) = 20823809._RPP/15031645._RPP + ! stencil 3 + ! (i+3)*i ; (i+2)*i + c(0,0,3) = 20823809._RPP/15031645._RPP; c(1,0,3) = -85952276._RPP/5412389._RPP + ! (i+1)*i ; i*i + c(2,0,3) = 97747719._RPP/2624408._RPP; c(3,0,3) = -77947404._RPP/1703711._RPP + ! (i-1)*i ; (i-2)*i + c(4,0,3) = 78098218._RPP/2511469._RPP; c(5,0,3) = -31210580._RPP/2807109._RPP + ! (i-3)*i + c(6,0,3) = 29187600._RPP/17822477._RPP + + ! / ; (i+1)*(i-1) + c(0,1,3) = 0._RPP; c(1,1,3) = 151133283._RPP/3169976._RPP + ! i*(i-1) ; (i-1)*(i-1) + c(2,1,3) = -735436149._RPP/3170423._RPP; c(3,1,3) = 212799192._RPP/725717._RPP + ! (i-2)*(i-1) ; (i-3)*(i-1) + c(4,1,3) = -7192946466._RPP/35277791._RPP; c(5,1,3) = 143433946._RPP/1930931._RPP + ! (i-4)*(i-1) + c(6,1,3) = -31210580._RPP/2807109._RPP + + ! / ; / + c(0,2,3) = 0._RPP; c(1,2,3) = 0._RPP + ! i*(i-1) ; (i-1)*(i-2) + c(2,2,3) = 330842346._RPP/1128355._RPP; c(3,2,3) = -478256390._RPP/624157._RPP + ! (i-2)*(i-2) ; (i-3)*(i-2) + c(4,2,3) = 1046376941._RPP/1911720._RPP; c(5,2,3) = -7192946466._RPP/35277791._RPP + ! (i-4)*(i-2) + c(6,2,3) = 78098218._RPP/2511469._RPP + + ! / ; / + c(0,3,3) = 0._RPP; c(1,3,3) = 0._RPP + ! / ; (i-1)*(i-3) + c(2,3,3) = 0._RPP; c(3,3,3) = 1393876129._RPP/2686891._RPP + ! (i-2)*(i-3) ; (i-3)*(i-3) + c(4,3,3) = -478256390._RPP/624157._RPP; c(5,3,3) = 212799192._RPP/725717._RPP + ! (i-4)*(i-3) + c(6,3,3) = -77947404._RPP/1703711._RPP + + ! / ; / + c(0,4,3) = 0._RPP; c(1,4,3) = 0._RPP + ! / ; / + c(2,4,3) = 0._RPP; c(3,4,3) = 0._RPP + ! (i-2)*(i-4) ; (i-3)*(i-4) + c(4,4,3) = 330842346._RPP/1128355._RPP; c(5,4,3) = -735436149._RPP/3170423._RPP + ! (i-4)*(i-4) + c(6,4,3) = 97747719._RPP/2624408._RPP + + ! / ; / + c(0,5,3) = 0._RPP; c(1,5,3) = 0._RPP + ! / ; / + c(2,5,3) = 0._RPP; c(3,5,3) = 0._RPP + ! / ; (i-3)*(i-5) + c(4,5,3) = 0._RPP; c(5,5,3) = 151133283._RPP/3169976._RPP + ! (i-4)*(i-5) + c(6,5,3) = -85952276._RPP/5412389._RPP + + ! / ; / + c(0,6,3) = 0._RPP; c(1,6,3) = 0._RPP + ! / ; / + c(2,6,3) = 0._RPP; c(3,6,3) = 0._RPP + ! / ; / + c(4,6,3) = 0._RPP; c(5,6,3) = 0._RPP + ! (i-4)*(i-5) + c(6,6,3) = 20823809._RPP/15031645._RPP + ! stencil 4 + ! (i+3)*i ; (i+2)*i + c(0,0,4) = 20823809._RPP/15031645._RPP; c(1,0,4) = -86513123._RPP/4872070._RPP + ! (i+1)*i ; i*i + c(2,0,4) = 85769455._RPP/1822342._RPP; c(3,0,4) = -177311125._RPP/2691566._RPP + ! (i-1)*i ; (i-2)*i + c(4,0,4) = 143992467._RPP/2811164._RPP; c(5,0,4) = -98152843._RPP/4687720._RPP + ! (i-3)*i + c(6,0,4) = 77150072._RPP/21955151._RPP + + ! / ; (i+1)*(i-1) + c(0,1,4) = 0._RPP; c(1,1,4) = 309673793._RPP/5357421._RPP + ! i*(i-1) ; (i-1)*(i-1) + c(2,1,4) = -393831298._RPP/1266551._RPP; c(3,1,4) = 13260333719._RPP/30064515._RPP + ! (i-2)*(i-1) ; (i-3)*(i-1) + c(4,1,4) = -251896262._RPP/725959._RPP; c(5,1,4) = 154914521._RPP/1081252._RPP + ! (i-4)*(i-1) + c(6,1,4) = -205305705._RPP/8465339._RPP + + ! / ; / + c(0,2,4) = 0._RPP; c(1,2,4) = 0._RPP + ! i*(i-1) ; (i-1)*(i-2) + c(2,2,4) = 787491691._RPP/1852394._RPP; c(3,2,4) = -660635886._RPP/538753._RPP + ! (i-2)*(i-2) ; (i-3)*(i-2) + c(4,2,4) = 750365573._RPP/765885._RPP; c(5,2,4) = -1002866209._RPP/2445347._RPP + ! (i-4)*(i-2) + c(6,2,4) = 164871587._RPP/2347023._RPP + + ! / ; / + c(0,3,4) = 0._RPP; c(1,3,4) = 0._RPP + ! / ; (i-1)*(i-3) + c(2,3,4) = 0._RPP; c(3,3,4) = 449371687._RPP/498274._RPP + ! (i-2)*(i-3) ; (i-3)*(i-3) + c(4,3,4) = -631316405._RPP/429286._RPP; c(5,3,4) = 337717185._RPP/538487._RPP + ! (i-4)*(i-3) + c(6,3,4) = -337645273._RPP/3091776._RPP + + ! / ; / + c(0,4,4) = 0._RPP; c(1,4,4) = 0._RPP + ! / ; / + c(2,4,4) = 0._RPP; c(3,4,4) = 0._RPP + ! (i-2)*(i-4) ; (i-3)*(i-4) + c(4,4,4) = 576629617._RPP/938378._RPP; c(5,4,4) = -470895955._RPP/874781._RPP + ! (i-4)*(i-4) + c(6,4,4) = 305770890._RPP/3186613._RPP + + ! / ; / + c(0,5,4) = 0._RPP; c(1,5,4) = 0._RPP + ! / ; / + c(2,5,4) = 0._RPP; c(3,5,4) = 0._RPP + ! / ; (i-3)*(i-5) + c(4,5,4) = 0._RPP; c(5,5,4) = 266980515._RPP/2188712._RPP + ! (i-4)*(i-5) + c(6,5,4) = -303410983._RPP/6736159._RPP + + ! / ; / + c(0,6,4) = 0._RPP; c(1,6,4) = 0._RPP + ! / ; / + c(2,6,4) = 0._RPP; c(3,6,4) = 0._RPP + ! / ; / + c(4,6,4) = 0._RPP; c(5,6,4) = 0._RPP + ! (i-4)*(i-5) + c(6,6,4) = 76695443._RPP/17458022._RPP + ! stencil 5 + ! (i+3)*i ; (i+2)*i + c(0,0,5) = 76695443._RPP/17458022._RPP; c(1,0,5) = -483420287._RPP/8336284._RPP + ! (i+1)*i ; i*i + c(2,0,5) = 1743860591._RPP/10881504._RPP; c(3,0,5) = -246865952._RPP/1040433._RPP + ! (i-1)*i ; (i-2)*i + c(4,0,5) = 265135851._RPP/1336964._RPP; c(5,0,5) = -265505701._RPP/2998139._RPP + ! (i-3)*i + c(6,0,5) = 43003346._RPP/2612319._RPP + + ! / ; (i+1)*(i-1) + c(0,1,5) = 0._RPP; c(1,1,5) = 393580372._RPP/2049353._RPP + ! i*(i-1) ; (i-1)*(i-1) + c(2,1,5) = -185662673._RPP/174204._RPP; c(3,1,5) = 498890606._RPP/314761._RPP + ! (i-2)*(i-1) ; (i-3)*(i-1) + c(4,1,5) = -577579349._RPP/433921._RPP; c(5,1,5) = 1029357835._RPP/1723277._RPP + ! (i-4)*(i-1) + c(6,1,5) = -1157045253._RPP/10370330._RPP + + ! / ; / + c(0,2,5) = 0._RPP; c(1,2,5) = 0._RPP + ! i*(i-1) ; (i-1)*(i-2) + c(2,2,5) = 1142129285._RPP/768659._RPP; c(3,2,5) = -1397796418._RPP/314477._RPP + ! (i-2)*(i-2) ; (i-3)*(i-2) + c(4,2,5) = 656116894._RPP/174649._RPP; c(5,2,5) = -448069659._RPP/263978._RPP + ! (i-4)*(i-2) + c(6,2,5) = 200564827._RPP/628331._RPP + + ! / ; / + c(0,3,5) = 0._RPP; c(1,3,5) = 0._RPP + ! / ; (i-1)*(i-3) + c(2,3,5) = 0._RPP; c(3,3,5) = 353679247._RPP/105637._RPP + ! (i-2)*(i-3) ; (i-3)*(i-3) + c(4,3,5) = -952714155._RPP/166894._RPP; c(5,3,5) = 6598378479._RPP/2533904._RPP + ! (i-4)*(i-3) + c(6,3,5) = -219042731._RPP/442919._RPP + + ! / ; / + c(0,4,5) = 0._RPP; c(1,4,5) = 0._RPP + ! / ; / + c(2,4,5) = 0._RPP; c(3,4,5) = 0._RPP + ! (i-2)*(i-4) ; (i-3)*(i-4) + c(4,4,5) = 3295939303._RPP/1339169._RPP; c(5,4,5) = -2876116249._RPP/1263255._RPP + ! (i-4)*(i-4) + c(6,4,5) = 451414666._RPP/1028589._RPP + + ! / ; / + c(0,5,5) = 0._RPP; c(1,5,5) = 0._RPP + ! / ; / + c(2,5,5) = 0._RPP; c(3,5,5) = 0._RPP + ! / ; (i-3)*(i-5) + c(4,5,5) = 0._RPP; c(5,5,5) = 151821033._RPP/282817._RPP + ! (i-4)*(i-5) + c(6,5,5) = -258813979._RPP/1219012._RPP + + ! / ; / + c(0,6,5) = 0._RPP; c(1,6,5) = 0._RPP + ! / ; / + c(2,6,5) = 0._RPP; c(3,6,5) = 0._RPP + ! / ; / + c(4,6,5) = 0._RPP; c(5,6,5) = 0._RPP + ! (i-4)*(i-5) + c(6,6,5) = 118739219._RPP/5409702._RPP + ! stencil 6 + ! (i+3)*i ; (i+2)*i + c(0,0,6) = 118739219._RPP/5409702._RPP; c(1,0,6) = -484093752._RPP/1664533._RPP + ! (i+1)*i ; i*i + c(2,0,6) = 562957181._RPP/694753._RPP; c(3,0,6) = -219701291._RPP/180490._RPP + ! (i-1)*i ; (i-2)*i + c(4,0,6) = 412399715._RPP/395812._RPP; c(5,0,6) = -299800985._RPP/620702._RPP + ! (i-3)*i + c(6,0,6) = 65647731._RPP/691205._RPP + + ! / ; (i+1)*(i-1) + c(0,1,6) = 0._RPP; c(1,1,6) = 368117849._RPP/381597._RPP + ! i*(i-1) ; (i-1)*(i-1) + c(2,1,6) = -3101495154._RPP/576017._RPP; c(3,1,6) = 2369766527._RPP/292389._RPP + ! (i-2)*(i-1) ; (i-3)*(i-1) + c(4,1,6) = -1068783425._RPP/153683._RPP; c(5,1,6) = 803154527._RPP/248375._RPP + ! (i-4)*(i-1) + c(6,1,6) = -418267211._RPP/655432._RPP + + ! / ; / + c(0,2,6) = 0._RPP; c(1,2,6) = 0._RPP + ! i*(i-1) ; (i-1)*(i-2) + c(2,2,6) = 384888217._RPP/51123._RPP; c(3,2,6) = -1833856939._RPP/80705._RPP + ! (i-2)*(i-2) ; (i-3)*(i-2) + c(4,2,6) = 3315206316._RPP/169489._RPP; c(5,2,6) = -550697211._RPP/60310._RPP + ! (i-4)*(i-2) + c(6,2,6) = 2375865880._RPP/1312047._RPP + + ! / ; / + c(0,3,6) = 0._RPP; c(1,3,6) = 0._RPP + ! / ; (i-1)*(i-3) + c(2,3,6) = 0._RPP; c(3,3,6) = 2558389867._RPP/148729._RPP + ! (i-2)*(i-3) ; (i-3)*(i-3) + c(4,3,6) = -485497721._RPP/16325._RPP; c(5,3,6) = 2854637563._RPP/204507._RPP + ! (i-4)*(i-3) + c(6,3,6) = -882134137._RPP/316505._RPP + + ! / ; / + c(0,4,6) = 0._RPP; c(1,4,6) = 0._RPP + ! / ; / + c(2,4,6) = 0._RPP; c(3,4,6) = 0._RPP + ! (i-2)*(i-4) ; (i-3)*(i-4) + c(4,4,6) = 2398154453._RPP/185516._RPP; c(5,4,6) = -2727583905._RPP/223057._RPP + ! (i-4)*(i-4) + c(6,4,6) = 1025357155._RPP/415733._RPP + + ! / ; / + c(0,5,6) = 0._RPP; c(1,5,6) = 0._RPP + ! / ; / + c(2,5,6) = 0._RPP; c(3,5,6) = 0._RPP + ! / ; (i-3)*(i-5) + c(4,5,6) = 0._RPP; c(5,5,6) = 1267010831._RPP/433225._RPP + ! (i-4)*(i-5) + c(6,5,6) = -842151863._RPP/702281._RPP + + ! / ; / + c(0,6,6) = 0._RPP; c(1,6,6) = 0._RPP + ! / ; / + c(2,6,6) = 0._RPP; c(3,6,6) = 0._RPP + ! / ; / + c(4,6,6) = 0._RPP; c(5,6,6) = 0._RPP + ! (i-4)*(i-5) + c(6,6,6) = 307570060._RPP/2438487._RPP + case(8) ! 15th order + ! stencil 0 + ! / ; / + c(0,0,0) = 561955582._RPP/ 1878967._RPP; c(1,0,0) = -1353623375._RPP/ 398213._RPP + ! / ; / + c(2,0,0) = 1512171950._RPP/ 176773._RPP; c(3,0,0) = -1384199219._RPP/ 112909._RPP + ! / ; / + c(4,0,0) = 1191775685._RPP/ 110969._RPP; c(5,0,0) = -6701525420._RPP/ 1169941._RPP + ! / ; / + c(6,0,0) = 1730988313._RPP/ 1007913._RPP; c(7,0,0) = -167817292._RPP/ 753123._RPP + + ! / ; / + c(0,1,0) = 0._RPP; c(1,1,0) = 5230798390._RPP/ 531001._RPP + ! / ; / + c(2,1,0) = -6783346413._RPP/ 135128._RPP; c(3,1,0) = 2653665219._RPP/ 36590._RPP + ! / ; / + c(4,1,0) = -2650855638._RPP/ 41489._RPP; c(5,1,0) = 3436464517._RPP/ 100426._RPP + ! / ; / + c(6,1,0) = -8115803171._RPP/ 788565._RPP; c(7,1,0) = 1606637628._RPP/ 1200199._RPP + + ! / ; / + c(0,2,0) = 0._RPP; c(1,2,0) = 0._RPP + ! / ; / + c(2,2,0) = 3382169379._RPP/ 52433._RPP; c(3,2,0) = -4461330800._RPP/ 23793._RPP + ! / ; / + c(4,2,0) = 2354499851._RPP/ 14191._RPP; c(5,2,0) = -9679034365._RPP/ 108568._RPP + ! / ; / + c(6,2,0) = 4477231643._RPP/ 166549._RPP; c(7,2,0) = -2034860005._RPP/ 580787._RPP + + ! / ; / + c(0,3,0) = 0._RPP; c(1,3,0) = 0._RPP + ! / ; / + c(2,3,0) = 0._RPP; c(3,3,0) = 5383551615._RPP/ 39332._RPP + ! / ; / + c(4,3,0) = -10453320754._RPP/ 43009._RPP; c(5,3,0) = 7936751861._RPP/ 60613._RPP + ! / ; / + c(6,3,0) = -3946887082._RPP/ 99757._RPP; c(7,3,0) = 1168472761._RPP/ 226223._RPP + + ! / ; / + c(0,4,0) = 0._RPP; c(1,4,0) = 0._RPP + ! / ; / + c(2,4,0) = 0._RPP; c(3,4,0) = 0._RPP + ! / ; / + c(4,4,0) = 15685259234._RPP/ 144989._RPP; c(5,4,0) = -2087501693._RPP/ 17871._RPP + ! / ; / + c(6,4,0) = 12211598186._RPP/ 345407._RPP; c(7,4,0) = -1774088813._RPP/ 383858._RPP + + ! / ; / + c(0,5,0) = 0._RPP; c(1,5,0) = 0._RPP + ! / ; / + c(2,5,0) = 0._RPP; c(3,5,0) = 0._RPP + ! / ; / + c(4,5,0) = 0._RPP; c(5,5,0) = 5633451919._RPP/ 178362._RPP + ! / ; / + c(6,5,0) = -1307164757._RPP/ 68276._RPP; c(7,5,0) = 4932843539._RPP/ 1968706._RPP + + ! / ; / + c(0,6,0) = 0._RPP; c(1,6,0) = 0._RPP + ! / ; / + c(2,6,0) = 0._RPP; c(3,6,0) = 0._RPP + ! / ; / + c(4,6,0) = 0._RPP; c(5,6,0) = 0._RPP + ! / ; / + c(6,6,0) = 1285415788._RPP/ 442547._RPP; c(7,6,0) = -508083143._RPP/ 667663._RPP + + ! / ; / + c(0,7,0) = 0._RPP; c(1,7,0) = 0._RPP + ! / ; / + c(2,7,0) = 0._RPP; c(3,7,0) = 0._RPP + ! / ; / + c(4,7,0) = 0._RPP; c(5,7,0) = 0._RPP + ! / ; / + c(6,7,0) = 0._RPP; c(7,7,0) = 151567467._RPP/ 3038449._RPP + + ! stencil 1 + ! / ; / + c(0,0,1) = 151567467._RPP/ 3038449._RPP; c(1,0,1) = -464902845._RPP/ 808102._RPP + ! / ; / + c(2,0,1) = 234353207._RPP/ 161088._RPP; c(3,0,1) = -2546573797._RPP/ 1222381._RPP + ! / ; / + c(4,0,1) = 847040497._RPP/ 465789._RPP; c(5,0,1) = -12689783695._RPP/ 13147542._RPP + ! / ; / + c(6,0,1) = 362054965._RPP/ 1257877._RPP; c(7,0,1) = -115902052._RPP/ 3120403._RPP + + ! / ; / + c(0,1,1) = 0._RPP; c(1,1,1) = 960477863._RPP/ 562021._RPP + ! / ; / + c(2,1,1) = -2039339988._RPP/ 231781._RPP; c(3,1,1) = 3431063476._RPP/ 269267._RPP + ! / ; / + c(4,1,1) = -3161084857._RPP/ 282001._RPP; c(5,1,1) = 4037906091._RPP/ 674921._RPP + ! / ; / + c(6,1,1) = -850151296._RPP/ 474539._RPP; c(7,1,1) = 513945629._RPP/ 2216079._RPP + + ! / ; / + c(0,2,1) = 0._RPP; c(1,2,1) = 0._RPP + ! / ; / + c(2,2,1) = 4802121175._RPP/ 418404._RPP; c(3,2,1) = -2609137409._RPP/ 77728._RPP + ! / ; / + c(4,2,1) = 4919628784._RPP/ 165435._RPP; c(5,2,1) = -2029186932._RPP/ 127189._RPP + ! / ; / + c(6,2,1) = 2674480859._RPP/ 557634._RPP; c(7,2,1) = -724803819._RPP/ 1163906._RPP + + ! / ; / + c(0,3,1) = 0._RPP; c(1,3,1) = 0._RPP + ! / ; / + c(2,3,1) = 0._RPP; c(3,3,1) = 3485486425._RPP/ 140912._RPP + ! / ; / + c(4,3,1) = -5435379710._RPP/ 123283._RPP; c(5,3,1) = 1773946113._RPP/ 74654._RPP + ! / ; / + c(6,3,1) = -1907782262._RPP/ 266123._RPP; c(7,3,1) = 779780282._RPP/ 835427._RPP + + ! / ; / + c(0,4,1) = 0._RPP; c(1,4,1) = 0._RPP + ! / ; / + c(2,4,1) = 0._RPP; c(3,4,1) = 0._RPP + ! / ; / + c(4,4,1) = 3163565270._RPP/ 160241._RPP; c(5,4,1) = -1674462641._RPP/ 78375._RPP + ! / ; / + c(6,4,1) = 2349626332._RPP/ 363399._RPP; c(7,4,1) = -1403389204._RPP/ 1662883._RPP + + ! / ; / + c(0,5,1) = 0._RPP; c(1,5,1) = 0._RPP + ! / ; / + c(2,5,1) = 0._RPP; c(3,5,1) = 0._RPP + ! / ; / + c(4,5,1) = 0._RPP; c(5,5,1) = 3171324093._RPP/ 546871._RPP + ! / ; / + c(6,5,1) = -686664647._RPP/ 195106._RPP; c(7,5,1) = 281051417._RPP/ 610454._RPP + + ! / ; / + c(0,6,1) = 0._RPP; c(1,6,1) = 0._RPP + ! / ; / + c(2,6,1) = 0._RPP; c(3,6,1) = 0._RPP + ! / ; / + c(4,6,1) = 0._RPP; c(5,6,1) = 0._RPP + ! / ; / + c(6,6,1) = 48179335._RPP/ 90019._RPP; c(7,6,1) = -255613952._RPP/ 1821943._RPP + + ! / ; / + c(0,7,1) = 0._RPP; c(1,7,1) = 0._RPP + ! / ; / + c(2,7,1) = 0._RPP; c(3,7,1) = 0._RPP + ! / ; / + c(4,7,1) = 0._RPP; c(5,7,1) = 0._RPP + ! / ; / + c(6,7,1) = 0._RPP; c(7,7,1) = 79932001._RPP/ 8679360._RPP + + ! stencil 2 + ! / ; / + c(0,0,2) = 79932001._RPP/ 8679360._RPP; c(1,0,2) = -655235691._RPP/ 5945464._RPP + ! / ; / + c(2,0,2) = 205707004._RPP/ 724801._RPP; c(3,0,2) = -559020701._RPP/ 1367726._RPP + ! / ; / + c(4,0,2) = 610690841._RPP/ 1715763._RPP; c(5,0,2) = -179578697._RPP/ 957716._RPP + ! / ; / + c(6,0,2) = 112959697._RPP/ 2041527._RPP; c(7,0,2) = -44754099._RPP/ 6344939._RPP + + ! / ; / + c(0,1,2) = 0._RPP; c(1,1,2) = 403846727._RPP/ 1180353._RPP + ! / ; / + c(2,1,2) = -1032899132._RPP/ 571995._RPP; c(3,1,2) = 554363127._RPP/ 209623._RPP + ! / ; / + c(4,1,2) = -699001320._RPP/ 299911._RPP; c(5,1,2) = 324962019._RPP/ 262375._RPP + ! / ; / + c(6,1,2) = -649079478._RPP/ 1764673._RPP; c(7,1,2) = 129766396._RPP/ 2754429._RPP + + ! / ; / + c(0,2,2) = 0._RPP; c(1,2,2) = 0._RPP + ! / ; / + c(2,2,2) = 5814856284._RPP/ 2387539._RPP; c(3,2,2) = -1300201595._RPP/ 179203._RPP + ! / ; / + c(4,2,2) = 1056954815._RPP/ 163259._RPP; c(5,2,2) = -8089971196._RPP/ 2329825._RPP + ! / ; / + c(6,2,2) = 501175243._RPP/ 482649._RPP; c(7,2,2) = -270604594._RPP/ 2024029._RPP + + ! / ; / + c(0,3,2) = 0._RPP; c(1,3,2) = 0._RPP + ! / ; / + c(2,3,2) = 0._RPP; c(3,3,2) = 7318753887._RPP/ 1334341._RPP + ! / ; / + c(4,3,2) = -823868037._RPP/ 83150._RPP; c(5,3,2) = 4782113096._RPP/ 891381._RPP + ! / ; / + c(6,3,2) = -694807489._RPP/ 429931._RPP; c(7,3,2) = 430661427._RPP/ 2058148._RPP + + ! / ; / + c(0,4,2) = 0._RPP; c(1,4,2) = 0._RPP + ! / ; / + c(2,4,2) = 0._RPP; c(3,4,2) = 0._RPP + ! / ; / + c(4,4,2) = 1492354285._RPP/ 329872._RPP; c(5,4,2) = -799191084._RPP/ 161641._RPP + ! / ; / + c(6,4,2) = 559782185._RPP/ 373076._RPP; c(7,4,2) = -114044024._RPP/ 583601._RPP + + ! / ; / + c(0,5,2) = 0._RPP; c(1,5,2) = 0._RPP + ! / ; / + c(2,5,2) = 0._RPP; c(3,5,2) = 0._RPP + ! / ; / + c(4,5,2) = 0._RPP; c(5,5,2) = 257028097._RPP/ 188691._RPP + ! / ; / + c(6,5,2) = -493139495._RPP/ 592214._RPP; c(7,5,2) = 401318077._RPP/ 3678649._RPP + + ! / ; / + c(0,6,2) = 0._RPP; c(1,6,2) = 0._RPP + ! / ; / + c(2,6,2) = 0._RPP; c(3,6,2) = 0._RPP + ! / ; / + c(4,6,2) = 0._RPP; c(5,6,2) = 0._RPP + ! / ; / + c(6,6,2) = 629957047._RPP/ 4917482._RPP; c(7,6,2) = -141509768._RPP/ 4191221._RPP + + ! / ; / + c(0,7,2) = 0._RPP; c(1,7,2) = 0._RPP + ! / ; / + c(2,7,2) = 0._RPP; c(3,7,2) = 0._RPP + ! / ; / + c(4,7,2) = 0._RPP; c(5,7,2) = 0._RPP + ! / ; / + c(6,7,2) = 0._RPP; c(7,7,2) = 35501666._RPP/ 15868715._RPP + + ! stencil 3 + ! / ; / + c(0,0,3) = 35501666._RPP/ 15868715._RPP; c(1,0,3) = -63831289._RPP/ 2220847._RPP + ! / ; / + c(2,0,3) = 268720507._RPP/ 3437558._RPP; c(3,0,3) = -134406712._RPP/ 1150037._RPP + ! / ; / + c(4,0,3) = 148443265._RPP/ 1427854._RPP; c(5,0,3) = -103772319._RPP/ 1881526._RPP + ! / ; / + c(6,0,3) = 141070919._RPP/ 8713488._RPP; c(7,0,3) = -21873377._RPP/ 10764442._RPP + + ! / ; / + c(0,1,3) = 0._RPP; c(1,1,3) = 204776677._RPP/ 2133916._RPP + ! / ; / + c(2,1,3) = -234383777._RPP/ 435589._RPP; c(3,1,3) = 3507914221._RPP/ 4258272._RPP + ! / ; / + c(4,1,3) = -311872754._RPP/ 417681._RPP; c(5,1,3) = 422372886._RPP/ 1050263._RPP + ! / ; / + c(6,1,3) = -386869123._RPP/ 3236626._RPP; c(7,1,3) = 69576681._RPP/ 4589819._RPP + + ! / ; / + c(0,2,3) = 0._RPP; c(1,2,3) = 0._RPP + ! / ; / + c(2,2,3) = 360251831._RPP/ 463656._RPP; c(3,2,3) = -809595667._RPP/ 331812._RPP + ! / ; / + c(4,2,3) = 1441974426._RPP/ 638695._RPP; c(5,2,3) = -84200903._RPP/ 68084._RPP + ! / ; / + c(6,2,3) = 693020919._RPP/ 1859333._RPP; c(7,2,3) = -398300903._RPP/ 8329274._RPP + + ! / ; / + c(0,3,3) = 0._RPP; c(1,3,3) = 0._RPP + ! / ; / + c(2,3,3) = 0._RPP; c(3,3,3) = 755335167._RPP/ 384508._RPP + ! / ; / + c(4,3,3) = -1353219397._RPP/ 363901._RPP; c(5,3,3) = 520921076._RPP/ 250961._RPP + ! / ; / + c(6,3,3) = -543724576._RPP/ 855585._RPP; c(7,3,3) = 200885069._RPP/ 2431769._RPP + + ! / ; / + c(0,4,3) = 0._RPP; c(1,4,3) = 0._RPP + ! / ; / + c(2,4,3) = 0._RPP; c(3,4,3) = 0._RPP + ! / ; / + c(4,4,3) = 1014659207._RPP/ 563712._RPP; c(5,4,3) = -1022198433._RPP/ 498364._RPP + ! / ; / + c(6,4,3) = 379000051._RPP/ 592915._RPP; c(7,4,3) = -65777185._RPP/ 779772._RPP + + ! / ; / + c(0,5,3) = 0._RPP; c(1,5,3) = 0._RPP + ! / ; / + c(2,5,3) = 0._RPP; c(3,5,3) = 0._RPP + ! / ; / + c(4,5,3) = 0._RPP; c(5,5,3) = 789836795._RPP/ 1323609._RPP + ! / ; / + c(6,5,3) = -540913157._RPP/ 1426197._RPP; c(7,5,3) = 108380895._RPP/ 2128121._RPP + + ! / ; / + c(0,6,3) = 0._RPP; c(1,6,3) = 0._RPP + ! / ; / + c(2,6,3) = 0._RPP; c(3,6,3) = 0._RPP + ! / ; / + c(4,6,3) = 0._RPP; c(5,6,3) = 0._RPP + ! / ; / + c(6,6,3) = 358821925._RPP/ 5833643._RPP; c(7,6,3) = -39287533._RPP/ 2331609._RPP + + ! / ; / + c(0,7,3) = 0._RPP; c(1,7,3) = 0._RPP + ! / ; / + c(2,7,3) = 0._RPP; c(3,7,3) = 0._RPP + ! / ; / + c(4,7,3) = 0._RPP; c(5,7,3) = 0._RPP + ! / ; / + c(6,7,3) = 0._RPP; c(7,7,3) = 12431715._RPP/ 10534253._RPP + + ! stencil 4 + ! / ; / + c(0,0,4) = 12431715._RPP/ 10534253._RPP; c(1,0,4) = -39287533._RPP/ 2331609._RPP + ! / ; / + c(2,0,4) = 108380895._RPP/ 2128121._RPP; c(3,0,4) = -65777185._RPP/ 779772._RPP + ! / ; / + c(4,0,4) = 200885069._RPP/ 2431769._RPP; c(5,0,4) = -398300903._RPP/ 8329274._RPP + ! / ; / + c(6,0,4) = 69576681._RPP/ 4589819._RPP; c(7,0,4) = -21873377._RPP/ 10764442._RPP + + ! / ; / + c(0,1,4) = 0._RPP; c(1,1,4) = 358821925._RPP/ 5833643._RPP + ! / ; / + c(2,1,4) = -540913157._RPP/ 1426197._RPP; c(3,1,4) = 379000051._RPP/ 592915._RPP + ! / ; / + c(4,1,4) = -543724576._RPP/ 855585._RPP; c(5,1,4) = 693020919._RPP/ 1859333._RPP + ! / ; / + c(6,1,4) = -386869123._RPP/ 3236626._RPP; c(7,1,4) = 141070919._RPP/ 8713488._RPP + + ! / ; / + c(0,2,4) = 0._RPP; c(1,2,4) = 0._RPP + ! / ; / + c(2,2,4) = 789836795._RPP/ 1323609._RPP; c(3,2,4) = -1022198433._RPP/ 498364._RPP + ! / ; / + c(4,2,4) = 520921076._RPP/ 250961._RPP; c(5,2,4) = -84200903._RPP/ 68084._RPP + ! / ; / + c(6,2,4) = 422372886._RPP/ 1050263._RPP; c(7,2,4) = -103772319._RPP/ 1881526._RPP + + ! / ; / + c(0,3,4) = 0._RPP; c(1,3,4) = 0._RPP + ! / ; / + c(2,3,4) = 0._RPP; c(3,3,4) = 1014659207._RPP/ 563712._RPP + ! / ; / + c(4,3,4) = -1353219397._RPP/ 363901._RPP; c(5,3,4) = 1441974426._RPP/ 638695._RPP + ! / ; / + c(6,3,4) = -311872754._RPP/ 417681._RPP; c(7,3,4) = 148443265._RPP/ 1427854._RPP + + ! / ; / + c(0,4,4) = 0._RPP; c(1,4,4) = 0._RPP + ! / ; / + c(2,4,4) = 0._RPP; c(3,4,4) = 0._RPP + ! / ; / + c(4,4,4) = 755335167._RPP/ 384508._RPP; c(5,4,4) = -809595667._RPP/ 331812._RPP + ! / ; / + c(6,4,4) = 3507914221._RPP/ 4258272._RPP; c(7,4,4) = -134406712._RPP/ 1150037._RPP + + ! / ; / + c(0,5,4) = 0._RPP; c(1,5,4) = 0._RPP + ! / ; / + c(2,5,4) = 0._RPP; c(3,5,4) = 0._RPP + ! / ; / + c(4,5,4) = 0._RPP; c(5,5,4) = 360251831._RPP/ 463656._RPP + ! / ; / + c(6,5,4) = -234383777._RPP/ 435589._RPP; c(7,5,4) = 268720507._RPP/ 3437558._RPP + + ! / ; / + c(0,6,4) = 0._RPP; c(1,6,4) = 0._RPP + ! / ; / + c(2,6,4) = 0._RPP; c(3,6,4) = 0._RPP + ! / ; / + c(4,6,4) = 0._RPP; c(5,6,4) = 0._RPP + ! / ; / + c(6,6,4) = 204776677._RPP/ 2133916._RPP; c(7,6,4) = -63831289._RPP/ 2220847._RPP + + ! / ; / + c(0,7,4) = 0._RPP; c(1,7,4) = 0._RPP + ! / ; / + c(2,7,4) = 0._RPP; c(3,7,4) = 0._RPP + ! / ; / + c(4,7,4) = 0._RPP; c(5,7,4) = 0._RPP + ! / ; / + c(6,7,4) = 0._RPP; c(7,7,4) = 35501666._RPP/ 15868715._RPP + ! stencil 5 + ! / ; / + c(0,0,5) = 35501666._RPP/ 15868715._RPP; c(1,0,5) = -141509768._RPP/ 4191221._RPP + ! / ; / + c(2,0,5) = 401318077._RPP/ 3678649._RPP; c(3,0,5) = -114044024._RPP/ 583601._RPP + ! / ; / + c(4,0,5) = 430661427._RPP/ 2058148._RPP; c(5,0,5) = -270604594._RPP/ 2024029._RPP + ! (i-4)*(i-5) ; + c(6,0,5) = 129766396._RPP/ 2754429._RPP; c(7,0,5) = -44754099._RPP/ 6344939._RPP + + ! / ; / + c(0,1,5) = 0._RPP; c(1,1,5) = 629957047._RPP/ 4917482._RPP + ! / ; / + c(2,1,5) = -493139495._RPP/ 592214._RPP; c(3,1,5) = 559782185._RPP/ 373076._RPP + ! / ; / + c(4,1,5) = -694807489._RPP/ 429931._RPP; c(5,1,5) = 501175243._RPP/ 482649._RPP + ! (i-4)*(i-5) ; + c(6,1,5) = -649079478._RPP/ 1764673._RPP; c(7,1,5) = 112959697._RPP/ 2041527._RPP + + ! / ; / + c(0,2,5) = 0._RPP; c(1,2,5) = 0._RPP + ! / ; / + c(2,2,5) = 257028097._RPP/ 188691._RPP; c(3,2,5) = -799191084._RPP/ 161641._RPP + ! / ; / + c(4,2,5) = 4782113096._RPP/ 891381._RPP; c(5,2,5) = -8089971196._RPP/ 2329825._RPP + ! (i-4)*(i-5) ; + c(6,2,5) = 324962019._RPP/ 262375._RPP; c(7,2,5) = -179578697._RPP/ 957716._RPP + + ! / ; / + c(0,3,5) = 0._RPP; c(1,3,5) = 0._RPP + ! / ; / + c(2,3,5) = 0._RPP; c(3,3,5) = 1492354285._RPP/ 329872._RPP + ! / ; / + c(4,3,5) = -823868037._RPP/ 83150._RPP; c(5,3,5) = 1056954815._RPP/ 163259._RPP + ! (i-4)*(i-5) ; + c(6,3,5) = -699001320._RPP/ 299911._RPP; c(7,3,5) = 610690841._RPP/ 1715763._RPP + + ! / ; / + c(0,4,5) = 0._RPP; c(1,4,5) = 0._RPP + ! / ; / + c(2,4,5) = 0._RPP; c(3,4,5) = 0._RPP + ! / ; / + c(4,4,5) = 7318753887._RPP/ 1334341._RPP; c(5,4,5) = -1300201595._RPP/ 179203._RPP + ! (i-4)*(i-5) ; + c(6,4,5) = 554363127._RPP/ 209623._RPP; c(7,4,5) = -559020701._RPP/ 1367726._RPP + + ! / ; / + c(0,5,5) = 0._RPP; c(1,5,5) = 0._RPP + ! / ; / + c(2,5,5) = 0._RPP; c(3,5,5) = 0._RPP + ! / ; / + c(4,5,5) = 0._RPP; c(5,5,5) = 5814856284._RPP/ 2387539._RPP + ! (i-4)*(i-5) ; + c(6,5,5) = -1032899132._RPP/ 571995._RPP; c(7,5,5) = 205707004._RPP/ 724801._RPP + + ! / ; / + c(0,6,5) = 0._RPP; c(1,6,5) = 0._RPP + ! / ; / + c(2,6,5) = 0._RPP; c(3,6,5) = 0._RPP + ! / ; / + c(4,6,5) = 0._RPP; c(5,6,5) = 0._RPP + ! (i-4)*(i-5) ; + c(6,6,5) = 403846727._RPP/ 1180353._RPP; c(7,6,5) = -655235691._RPP/ 5945464._RPP + + ! / ; / + c(0,7,5) = 0._RPP; c(1,7,5) = 0._RPP + ! / ; / + c(2,7,5) = 0._RPP; c(3,7,5) = 0._RPP + ! / ; / + c(4,7,5) = 0._RPP; c(5,7,5) = 0._RPP + ! (i-4)*(i-5) ; + c(6,7,5) = 0._RPP; c(7,7,5) = 79932001._RPP/ 8679360._RPP + + ! stencil 6 + ! / ; / + c(0,0,6) = 79932001._RPP/ 8679360._RPP; c(1,0,6) = -255613952._RPP/ 1821943._RPP + ! / ; / + c(2,0,6) = 281051417._RPP/ 610454._RPP; c(3,0,6) = -1403389204._RPP/ 1662883._RPP + ! / ; / + c(4,0,6) = 779780282._RPP/ 835427._RPP; c(5,0,6) = -724803819._RPP/ 1163906._RPP + ! (i-4)*(i-5) ; + c(6,0,6) = 513945629._RPP/ 2216079._RPP; c(7,0,6) = -115902052._RPP/ 3120403._RPP + + ! / ; / + c(0,1,6) = 0._RPP; c(1,1,6) = 48179335._RPP/ 90019._RPP + ! / ; / + c(2,1,6) = -686664647._RPP/ 195106._RPP; c(3,1,6) = 2349626332._RPP/ 363399._RPP + ! / ; / + c(4,1,6) = -1907782262._RPP/ 266123._RPP; c(5,1,6) = 2674480859._RPP/ 557634._RPP + ! (i-4)*(i-5) ; + c(6,1,6) = -850151296._RPP/ 474539._RPP; c(7,1,6) = 362054965._RPP/ 1257877._RPP + + ! / ; / + c(0,2,6) = 0._RPP; c(1,2,6) = 0._RPP + ! / ; / + c(2,2,6) = 3171324093._RPP/ 546871._RPP; c(3,2,6) = -1674462641._RPP/ 78375._RPP + ! / ; / + c(4,2,6) = 1773946113._RPP/ 74654._RPP; c(5,2,6) = -2029186932._RPP/ 127189._RPP + ! (i-4)*(i-5) ; + c(6,2,6) = 4037906091._RPP/ 674921._RPP; c(7,2,6) = -12689783695._RPP/ 13147542._RPP + + ! / ; / + c(0,3,6) = 0._RPP; c(1,3,6) = 0._RPP + ! / ; / + c(2,3,6) = 0._RPP; c(3,3,6) = 3163565270._RPP/ 160241._RPP + ! / ; / + c(4,3,6) = -5435379710._RPP/ 123283._RPP; c(5,3,6) = 4919628784._RPP/ 165435._RPP + ! (i-4)*(i-5) ; + c(6,3,6) = -3161084857._RPP/ 282001._RPP; c(7,3,6) = 847040497._RPP/ 465789._RPP + + ! / ; / + c(0,4,6) = 0._RPP; c(1,4,6) = 0._RPP + ! / ; / + c(2,4,6) = 0._RPP; c(3,4,6) = 0._RPP + ! / ; / + c(4,4,6) = 3485486425._RPP/ 140912._RPP; c(5,4,6) = -2609137409._RPP/ 77728._RPP + ! (i-4)*(i-5) ; + c(6,4,6) = 3431063476._RPP/ 269267._RPP; c(7,4,6) = -2546573797._RPP/ 1222381._RPP + + ! / ; / + c(0,5,6) = 0._RPP; c(1,5,6) = 0._RPP + ! / ; / + c(2,5,6) = 0._RPP; c(3,5,6) = 0._RPP + ! / ; / + c(4,5,6) = 0._RPP; c(5,5,6) = 4802121175._RPP/ 418404._RPP + ! (i-4)*(i-5) ; + c(6,5,6) = -2039339988._RPP/ 231781._RPP; c(7,5,6) = 234353207._RPP/ 161088._RPP + + ! / ; / + c(0,6,6) = 0._RPP; c(1,6,6) = 0._RPP + ! / ; / + c(2,6,6) = 0._RPP; c(3,6,6) = 0._RPP + ! / ; / + c(4,6,6) = 0._RPP; c(5,6,6) = 0._RPP + ! (i-4)*(i-5) ; + c(6,6,6) = 960477863._RPP/ 562021._RPP; c(7,6,6) = -464902845._RPP/ 808102._RPP + + ! / ; / + c(0,7,6) = 0._RPP; c(1,7,6) = 0._RPP + ! / ; / + c(2,7,6) = 0._RPP; c(3,7,6) = 0._RPP + ! / ; / + c(4,7,6) = 0._RPP; c(5,7,6) = 0._RPP + ! (i-4)*(i-5) ; + c(6,7,6) = 0._RPP; c(7,7,6) = 151567467._RPP/ 3038449._RPP + + ! stencil 7 + ! / ; / + c(0,0,7) = 151567467._RPP/ 3038449._RPP; c(1,0,7) = -508083143._RPP/ 667663._RPP + ! / ; / + c(2,0,7) = 4932843539._RPP/ 1968706._RPP; c(3,0,7) = -1774088813._RPP/ 383858._RPP + ! / ; / + c(4,0,7) = 1168472761._RPP/ 226223._RPP; c(5,0,7) = -2034860005._RPP/ 580787._RPP + ! (i-4)*(i-5) ; + c(6,0,7) = 1606637628._RPP/ 1200199._RPP; c(7,0,7) = -167817292._RPP/ 753123._RPP + + ! / ; / + c(0,1,7) = 0._RPP; c(1,1,7) = 1285415788._RPP/ 442547._RPP + ! / ; / + c(2,1,7) = -1307164757._RPP/ 68276._RPP; c(3,1,7) = 12211598186._RPP/ 345407._RPP + ! / ; / + c(4,1,7) = -3946887082._RPP/ 99757._RPP; c(5,1,7) = 4477231643._RPP/ 166549._RPP + ! (i-4)*(i-5) ; + c(6,1,7) = -8115803171._RPP/ 788565._RPP; c(7,1,7) = 1730988313._RPP/ 1007913._RPP + + ! / ; / + c(0,2,7) = 0._RPP; c(1,2,7) = 0._RPP + ! / ; / + c(2,2,7) = 5633451919._RPP/ 178362._RPP; c(3,2,7) = -2087501693._RPP/ 17871._RPP + ! / ; / + c(4,2,7) = 7936751861._RPP/ 60613._RPP; c(5,2,7) = -9679034365._RPP/ 108568._RPP + ! (i-4)*(i-5) ; + c(6,2,7) = 3436464517._RPP/ 100426._RPP; c(7,2,7) = -6701525420._RPP/ 1169941._RPP + + ! / ; / + c(0,3,7) = 0._RPP; c(1,3,7) = 0._RPP + ! / ; / + c(2,3,7) = 0._RPP; c(3,3,7) = 15685259234._RPP/ 144989._RPP + ! / ; / + c(4,3,7) = -10453320754._RPP/ 43009._RPP; c(5,3,7) = 2354499851._RPP/ 14191._RPP + ! (i-4)*(i-5) ; + c(6,3,7) = -2650855638._RPP/ 41489._RPP; c(7,3,7) = 1191775685._RPP/ 110969._RPP + + ! / ; / + c(0,4,7) = 0._RPP; c(1,4,7) = 0._RPP + ! / ; / + c(2,4,7) = 0._RPP; c(3,4,7) = 0._RPP + ! / ; / + c(4,4,7) = 5383551615._RPP/ 39332._RPP; c(5,4,7) = -4461330800._RPP/ 23793._RPP + ! (i-4)*(i-5) ; + c(6,4,7) = 2653665219._RPP/ 36590._RPP; c(7,4,7) = -1384199219._RPP/ 112909._RPP + + ! / ; / + c(0,5,7) = 0._RPP; c(1,5,7) = 0._RPP + ! / ; / + c(2,5,7) = 0._RPP; c(3,5,7) = 0._RPP + ! / ; / + c(4,5,7) = 0._RPP; c(5,5,7) = 3382169379._RPP/ 52433._RPP + ! (i-4)*(i-5) ; + c(6,5,7) = -6783346413._RPP/ 135128._RPP; c(7,5,7) = 1512171950._RPP/ 176773._RPP + + ! / ; / + c(0,6,7) = 0._RPP; c(1,6,7) = 0._RPP + ! / ; / + c(2,6,7) = 0._RPP; c(3,6,7) = 0._RPP + ! / ; / + c(4,6,7) = 0._RPP; c(5,6,7) = 0._RPP + ! (i-4)*(i-5) ; + c(6,6,7) = 5230798390._RPP/ 531001._RPP; c(7,6,7) = -1353623375._RPP/ 398213._RPP + + ! / ; / + c(0,7,7) = 0._RPP; c(1,7,7) = 0._RPP + ! / ; / + c(2,7,7) = 0._RPP; c(3,7,7) = 0._RPP + ! / ; / + c(4,7,7) = 0._RPP; c(5,7,7) = 0._RPP + ! (i-4)*(i-5) ; + c(6,7,7) = 0._RPP; c(7,7,7) = 561955582._RPP/ 1878967._RPP + case(9) ! 17th order + ! stencil 0 + ! / ; / + c(0,0,0) = 191906863._RPP/ 270061._RPP;c(1,0,0) = -1291706883._RPP/ 137012._RPP + ! / ; / + c(2,0,0) = 1051885279._RPP/37394._RPP;c(3,0,0) = -6519672839._RPP/ 133134._RPP + ! / ; / + c(4,0,0) = 8028408627._RPP/ 148285._RPP;c(5,0,0) = -12858081715._RPP/331389._RPP + ! / ; / + c(6,0,0) = 7116193241._RPP/405236._RPP;c(7,0,0) = -1382011106._RPP/301683._RPP + ! / ; / + c(8,0,0) = 380112881._RPP/ 721737._RPP + + ! / ; / + c(0,1,0) = 0._RPP;c(1,1,0) = 2789709824._RPP/ 87891._RPP + ! / ; / + c(2,1,0) = -2523726139._RPP/ 13197._RPP;c(3,1,0) = 10624327325._RPP/ 31707._RPP + ! / ; / + c(4,1,0) = -14121568547._RPP/ 37942._RPP;c(5,1,0) = 13666821827._RPP/ 51060._RPP + ! / ; / + c(6,1,0) = -7097325924._RPP/ 58429._RPP;c(7,1,0) = 962141663._RPP/ 30298._RPP + ! / ; / + c(8,1,0) = -1039356853._RPP/284187._RPP + + ! / ; / + c(0,2,0) = 0._RPP;c(1,2,0) = 0._RPP + ! / ; / + c(2,2,0) = 958711850795._RPP/ 3306139._RPP;c(3,2,0) = -32612776236._RPP/ 31939._RPP + ! / ; / + c(4,2,0) = 29334155111._RPP/ 25771._RPP;c(5,2,0) = -13491549889._RPP/ 16436._RPP + ! / ; / + c(6,2,0) = 8640690184._RPP/ 23145._RPP;c(7,2,0) = -7469836609._RPP/ 76401._RPP + ! / ; / + c(8,2,0) = 2160095091._RPP/191558._RPP + + ! / ; / + c(0,3,0) = 0._RPP;c(1,3,0) = 0._RPP + ! / ; / + c(2,3,0) = 0._RPP;c(3,3,0) = 26479157148._RPP/ 29351._RPP + ! / ; / + c(4,3,0) = -34046474687._RPP/ 16880._RPP;c(5,3,0) = 25425670807._RPP/ 17442._RPP + ! / ; / + c(6,3,0) = -13534679320._RPP/ 20379._RPP;c(7,3,0) = 8534140303._RPP/ 48995._RPP + ! / ; / + c(8,3,0) = -16400242834._RPP/815393._RPP + + ! / ; / + c(0,4,0) = 0._RPP;c(1,4,0) = 0._RPP + ! / ; / + c(2,4,0) = 0._RPP;c(3,4,0) = 0._RPP + ! / ; / + c(4,4,0) = 7211727349._RPP/ 6383._RPP;c(5,4,0) = -32852743324._RPP/ 20081._RPP + ! / ; / + c(6,4,0) = 9817971019._RPP/ 13153._RPP;c(7,4,0) = -29831101642._RPP/ 152201._RPP + ! / ; / + c(8,4,0) = 1211629703._RPP/ 53483._RPP + + ! / ; / + c(0,5,0) = 0._RPP;c(1,5,0) = 0._RPP + ! / ; / + c(2,5,0) = 0._RPP;c(3,5,0) = 0._RPP + ! / ; / + c(4,5,0) = 0._RPP;c(5,5,0) = 181942554161._RPP/ 306771._RPP + ! / ; / + c(6,5,0) = -10120501295._RPP/ 18678._RPP;c(7,5,0) = 6203677189._RPP/ 43561._RPP + ! / ; / + c(8,5,0) = -800361473._RPP/ 48582._RPP + + ! / ; / + c(0,6,0) = 0._RPP;c(1,6,0) = 0._RPP + ! / ; / + c(2,6,0) = 0._RPP;c(3,6,0) = 0._RPP + ! / ; / + c(4,6,0) = 0._RPP;c(5,6,0) = 0._RPP + ! / ; / + c(6,6,0) = 9873545067._RPP/ 79705._RPP;c(7,6,0) = -5910597075._RPP/ 90694._RPP + ! / ; / + c(8,6,0) = 2005851423._RPP/265880._RPP + + ! / ; / + c(0,7,0) = 0._RPP;c(1,7,0) = 0._RPP + ! / ; / + c(2,7,0) = 0._RPP;c(3,7,0) = 0._RPP + ! / ; / + c(4,7,0) = 0._RPP;c(5,7,0) = 0._RPP + ! / ; / + c(6,7,0) = 0._RPP;c(7,7,0) = 1207396129._RPP/140764._RPP + ! / ; / + c(8,7,0) = -989259649._RPP/ 497859._RPP + + ! / ; / + c(0,8,0) = 0._RPP;c(1,8,0) = 0._RPP + ! / ; / + c(2,8,0) = 0._RPP;c(3,8,0) = 0._RPP + ! / ; / + c(4,8,0) = 0._RPP;c(5,8,0) = 0._RPP + ! / ; / + c(6,8,0) = 0._RPP;c(7,8,0) = 0._RPP + ! / ; / + c(8,8,0) = 23000337._RPP/ 199768._RPP + + ! stencil 1 + ! / ; / + c(0,0,1) = 23000337._RPP/ 199768._RPP;c(1,0,1) = -1605498941._RPP/ 1038640._RPP + ! / ; / + c(2,0,1) = 1919279425._RPP/ 414313._RPP;c(3,0,1) = -351689199._RPP/43600._RPP + ! / ; / + c(4,0,1) = 2318146475._RPP/ 260443._RPP;c(5,0,1) = -1432715713._RPP/225284._RPP + ! / ; / + c(6,0,1) = 1206026846._RPP/420471._RPP;c(7,0,1) = -433682386._RPP/ 581703._RPP + ! / ; / + c(8,0,1) = 192493416._RPP/2253847._RPP + + ! / ; / + c(0,1,1) = 0._RPP;c(1,1,1) = 8788336457._RPP/1659246._RPP + ! / ; / + c(2,1,1) = -6349489117._RPP/ 197436._RPP;c(3,1,1) = 17759778441._RPP/ 314408._RPP + ! / ; / + c(4,1,1) = -2463944763._RPP/ 39286._RPP;c(5,1,1) = 2631734550._RPP/ 58459._RPP + ! / ; / + c(6,1,1) = -684405583._RPP/ 33590._RPP;c(7,1,1) = 1632642660._RPP/ 307433._RPP + ! / ; / + c(8,1,1) = -759205271._RPP/1245236._RPP + + ! / ; / + c(0,2,1) = 0._RPP;c(1,2,1) = 0._RPP + ! / ; / + c(2,2,1) = 138686396638._RPP/ 2813507._RPP;c(3,2,1) = -12258216466._RPP/ 70285._RPP + ! / ; / + c(4,2,1) = 8450768743._RPP/ 43407._RPP;c(5,2,1) = -30871077827._RPP/ 220014._RPP + ! / ; / + c(6,2,1) = 2904329890._RPP/ 45589._RPP;c(7,2,1) = -2519869819._RPP/ 151381._RPP + ! / ; / + c(8,2,1) = 2064497172._RPP/1078127._RPP + + ! / ; / + c(0,3,1) = 0._RPP;c(1,3,1) = 0._RPP + ! / ; / + c(2,3,1) = 0._RPP;c(3,3,1) = 7222761881._RPP/ 46553._RPP + ! / ; / + c(4,3,1) = -21436202114._RPP/ 61611._RPP;c(5,3,1) = 21903079582._RPP/ 87043._RPP + ! / ; / + c(6,3,1) = -5737609802._RPP/ 50081._RPP;c(7,3,1) = 2675355119._RPP/ 89174._RPP + ! / ; / + c(8,3,1) = -1275601375._RPP/368936._RPP + + ! / ; / + c(0,4,1) = 0._RPP;c(1,4,1) = 0._RPP + ! / ; / + c(2,4,1) = 0._RPP;c(3,4,1) = 0._RPP + ! / ; / + c(4,4,1) = 5232843359._RPP/ 26730._RPP;c(5,4,1) = -32956224478._RPP/ 116041._RPP + ! / ; / + c(6,4,1) = 4693138545._RPP/ 36209._RPP;c(7,4,1) = -5136703769._RPP/ 151046._RPP + ! / ; / + c(8,4,1) = 1990119523._RPP/ 506979._RPP + + ! / ; / + c(0,5,1) = 0._RPP;c(1,5,1) = 0._RPP + ! / ; / + c(2,5,1) = 0._RPP;c(3,5,1) = 0._RPP + ! / ; / + c(4,5,1) = 0._RPP;c(5,5,1) = 10194856899._RPP/ 98734._RPP + ! / ; / + c(6,5,1) = -7652084383._RPP/ 81028._RPP;c(7,5,1) = 1696424402._RPP/ 68349._RPP + ! / ; / + c(8,5,1) = -557744521._RPP/194407._RPP + + ! / ; / + c(0,6,1) = 0._RPP;c(1,6,1) = 0._RPP + ! / ; / + c(2,6,1) = 0._RPP;c(3,6,1) = 0._RPP + ! / ; / + c(4,6,1) = 0._RPP;c(5,6,1) = 0._RPP + ! / ; / + c(6,6,1) = 3171898228._RPP/ 146643._RPP;c(7,6,1) = -1486183058._RPP/ 130527._RPP + ! / ; / + c(8,6,1) = 1414733955._RPP/1073627._RPP + + ! / ; / + c(0,7,1) = 0._RPP;c(1,7,1) = 0._RPP + ! / ; / + c(2,7,1) = 0._RPP;c(3,7,1) = 0._RPP + ! / ; / + c(4,7,1) = 0._RPP;c(5,7,1) = 0._RPP + ! / ; / + c(6,7,1) = 0._RPP;c(7,7,1) = 550334507._RPP/ 366830._RPP + ! / ; / + c(8,7,1) = -296572045._RPP/ 853161._RPP + + ! / ; / + c(0,8,1) = 0._RPP;c(1,8,1) = 0._RPP + ! / ; / + c(2,8,1) = 0._RPP;c(3,8,1) = 0._RPP + ! / ; / + c(4,8,1) = 0._RPP;c(5,8,1) = 0._RPP + ! / ; / + c(6,8,1) = 0._RPP;c(7,8,1) = 0._RPP + ! / ; / + c(8,8,1) = 36409563._RPP/ 1806520._RPP + + ! stencil 2 + ! / ; / + c(0,0,2) = 36409563._RPP/ 1806520._RPP;c(1,0,2) = -699447262._RPP/ 2521667._RPP + ! / ; / + c(2,0,2) = 277579576._RPP/329887._RPP;c(3,0,2) = -289784372._RPP/196989._RPP + ! / ; / + c(4,0,2) = 306856831._RPP/ 189251._RPP;c(5,0,2) = -61463934._RPP/53285._RPP + ! / ; / + c(6,0,2) = 688214053._RPP/1331147._RPP;c(7,0,2) = -173397370._RPP/1299717._RPP + ! / ; / + c(8,0,2) = 265338548._RPP/17495633._RPP + + ! / ; / + c(0,1,2) = 0._RPP;c(1,1,2) = 526012837._RPP/537300._RPP + ! / ; / + c(2,1,2) = -1651888798._RPP/ 273307._RPP;c(3,1,2) = 2363787227._RPP/ 220958._RPP + ! / ; / + c(4,1,2) = -10107954583._RPP/ 849559._RPP;c(5,1,2) = 5241495620._RPP/ 615127._RPP + ! / ; / + c(6,1,2) = -2367490577._RPP/ 616772._RPP;c(7,1,2) = 127754174._RPP/ 128481._RPP + ! / ; / + c(8,1,2) = -264553111._RPP/ 2333462._RPP + + ! / ; / + c(0,2,2) = 0._RPP;c(1,2,2) = 0._RPP + ! / ; / + c(2,2,2) = 3248190394._RPP/ 343067._RPP;c(3,2,2) = -2028942806._RPP/ 59843._RPP + ! / ; / + c(4,2,2) = 1334723167._RPP/ 35090._RPP;c(5,2,2) = -765629878._RPP/ 27919._RPP + ! / ; / + c(6,2,2) = 2097415117._RPP/ 168915._RPP;c(7,2,2) = -676787627._RPP/ 209575._RPP + ! / ; / + c(8,2,2) = 383212815._RPP/1037536._RPP + + ! / ; / + c(0,3,2) = 0._RPP;c(1,3,2) = 0._RPP + ! / ; / + c(2,3,2) = 0._RPP;c(3,3,2) = 2631362108._RPP/ 85845._RPP + ! / ; / + c(4,3,2) = -4882065990._RPP/ 70417._RPP;c(5,3,2) = 3655479387._RPP/ 72668._RPP + ! / ; / + c(6,3,2) = -2468363819._RPP/ 107827._RPP;c(7,3,2) = 1268411423._RPP/ 212206._RPP + ! / ; / + c(8,3,2) = -427576737._RPP/623480._RPP + + ! / ; / + c(0,4,2) = 0._RPP;c(1,4,2) = 0._RPP + ! / ; / + c(2,4,2) = 0._RPP;c(3,4,2) = 0._RPP + ! / ; / + c(4,4,2) = 11322353265._RPP/ 286802._RPP;c(5,4,2) = -7546651472._RPP/ 130969._RPP + ! / ; / + c(6,4,2) = 451561861._RPP/ 17139._RPP;c(7,4,2) = -2267814051._RPP/ 328385._RPP + ! / ; / + c(8,4,2) = 537364516._RPP/ 676097._RPP + + ! / ; / + c(0,5,2) = 0._RPP;c(1,5,2) = 0._RPP + ! / ; / + c(2,5,2) = 0._RPP;c(3,5,2) = 0._RPP + ! / ; / + c(4,5,2) = 0._RPP;c(5,5,2) = 3256858005._RPP/ 154108._RPP + ! / ; / + c(6,5,2) = -5961122741._RPP/ 307109._RPP;c(7,5,2) = 982680142._RPP/ 192447._RPP + ! / ; / + c(8,5,2) = -823497572._RPP/1397105._RPP + + ! / ; / + c(0,6,2) = 0._RPP;c(1,6,2) = 0._RPP + ! / ; / + c(2,6,2) = 0._RPP;c(3,6,2) = 0._RPP + ! / ; / + c(4,6,2) = 0._RPP;c(5,6,2) = 0._RPP + ! / ; / + c(6,6,2) = 2952652193._RPP/ 659941._RPP;c(7,6,2) = -1883344606._RPP/ 797417._RPP + ! / ; / + c(8,6,2) = 329649921._RPP/ 1205744._RPP + + ! / ; / + c(0,7,2) = 0._RPP;c(1,7,2) = 0._RPP + ! / ; / + c(2,7,2) = 0._RPP;c(3,7,2) = 0._RPP + ! / ; / + c(4,7,2) = 0._RPP;c(5,7,2) = 0._RPP + ! / ; / + c(6,7,2) = 0._RPP;c(7,7,2) = 267692197._RPP/856297._RPP + ! / ; / + c(8,7,2) = -178701734._RPP/ 2462661._RPP + + ! / ; / + c(0,8,2) = 0._RPP;c(1,8,2) = 0._RPP + ! / ; / + c(2,8,2) = 0._RPP;c(3,8,2) = 0._RPP + ! / ; / + c(4,8,2) = 0._RPP;c(5,8,2) = 0._RPP + ! / ; / + c(6,8,2) = 0._RPP;c(7,8,2) = 0._RPP + ! / ; / + c(8,8,2) = 14225607._RPP/ 3370285._RPP + + ! stencil 3 + ! / ; / + c(0,0,3) = 14225607._RPP/ 3370285._RPP;c(1,0,3) = -186193587._RPP/ 3061888._RPP + ! / ; / + c(2,0,3) = 103779883._RPP/544689._RPP;c(3,0,3) = -597649141._RPP/ 1759029._RPP + ! / ; / + c(4,0,3) = 348597468._RPP/ 922523._RPP;c(5,0,3) = -709458479._RPP/2638758._RPP + ! / ; / + c(6,0,3) = 184615935._RPP/1542601._RPP;c(7,0,3) = -417266048._RPP/13678797._RPP + ! / ; / + c(8,0,3) = 33222819._RPP/ 9738314._RPP + + ! / ; / + c(0,1,3) = 0._RPP;c(1,1,3) = 308180301._RPP/1366333._RPP + ! / ; / + c(2,1,3) = -522065981._RPP/ 360998._RPP;c(3,1,3) = 5590654438._RPP/ 2129495._RPP + ! / ; / + c(4,1,3) = -787874261._RPP/ 266082._RPP;c(5,1,3) = 1034492709._RPP/ 485618._RPP + ! / ; / + c(6,1,3) = -931274285._RPP/ 973468._RPP;c(7,1,3) = 544135101._RPP/ 2215768._RPP + ! / ; / + c(8,1,3) = -243832589._RPP/8827552._RPP + + ! / ; / + c(0,2,3) = 0._RPP;c(1,2,3) = 0._RPP + ! / ; / + c(2,2,3) = 2349998749._RPP/ 992475._RPP;c(3,2,3) = -3054791233._RPP/ 349036._RPP + ! / ; / + c(4,2,3) = 966000775._RPP/ 96443._RPP;c(5,2,3) = -828515195._RPP/ 113623._RPP + ! / ; / + c(6,2,3) = 1033739711._RPP/ 312683._RPP;c(7,2,3) = -767075415._RPP/ 896921._RPP + ! / ; / + c(8,2,3) = 83373698._RPP/861333._RPP + + ! / ; / + c(0,3,3) = 0._RPP;c(1,3,3) = 0._RPP + ! / ; / + c(2,3,3) = 0._RPP;c(3,3,3) = 1879971092._RPP/ 228557._RPP + ! / ; / + c(4,3,3) = -305554133._RPP/ 15991._RPP;c(5,3,3) = 3662929022._RPP/ 260087._RPP + ! / ; / + c(6,3,3) = -295058921._RPP/ 45739._RPP;c(7,3,3) = 654146656._RPP/ 388723._RPP + ! / ; / + c(8,3,3) = -135160981._RPP/704829._RPP + + ! / ; / + c(0,4,3) = 0._RPP;c(1,4,3) = 0._RPP + ! / ; / + c(2,4,3) = 0._RPP;c(3,4,3) = 0._RPP + ! / ; / + c(4,4,3) = 1548885060._RPP/ 137633._RPP;c(5,4,3) = -8099595796._RPP/ 482187._RPP + ! / ; / + c(6,4,3) = 1581790037._RPP/ 203396._RPP;c(7,4,3) = -6738238495._RPP/ 3291754._RPP + ! / ; / + c(8,4,3) = 85841095._RPP/ 365273._RPP + + ! / ; / + c(0,5,3) = 0._RPP;c(1,5,3) = 0._RPP + ! / ; / + c(2,5,3) = 0._RPP;c(3,5,3) = 0._RPP + ! / ; / + c(4,5,3) = 0._RPP;c(5,5,3) = 4054421226._RPP/ 639143._RPP + ! / ; / + c(6,5,3) = -628691758._RPP/ 105883._RPP;c(7,5,3) = 855538459._RPP/ 542278._RPP + ! / ; / + c(8,5,3) = -185363617._RPP/ 1015232._RPP + + ! / ; / + c(0,6,3) = 0._RPP;c(1,6,3) = 0._RPP + ! / ; / + c(2,6,3) = 0._RPP;c(3,6,3) = 0._RPP + ! / ; / + c(4,6,3) = 0._RPP;c(5,6,3) = 0._RPP + ! / ; / + c(6,6,3) = 2253530669._RPP/ 1605103._RPP;c(7,6,3) = -491966393._RPP/ 653081._RPP + ! / ; / + c(8,6,3) = 67366110._RPP/766169._RPP + + ! / ; / + c(0,7,3) = 0._RPP;c(1,7,3) = 0._RPP + ! / ; / + c(2,7,3) = 0._RPP;c(3,7,3) = 0._RPP + ! / ; / + c(4,7,3) = 0._RPP;c(5,7,3) = 0._RPP + ! / ; / + c(6,7,3) = 0._RPP;c(7,7,3) = 193935861._RPP/1901234._RPP + ! / ; / + c(8,7,3) = -28933143._RPP/ 1204235._RPP + + ! / ; / + c(0,8,3) = 0._RPP;c(1,8,3) = 0._RPP + ! / ; / + c(2,8,3) = 0._RPP;c(3,8,3) = 0._RPP + ! / ; / + c(4,8,3) = 0._RPP;c(5,8,3) = 0._RPP + ! / ; / + c(6,8,3) = 0._RPP;c(7,8,3) = 0._RPP + ! / ; / + c(8,8,3) = 25595175._RPP/ 17925332._RPP + + ! stencil 4 + ! / ; / + c(0,0,4) = 25595175._RPP/ 17925332._RPP;c(1,0,4) = -471882251._RPP/ 21169910._RPP + ! / ; / + c(2,0,4) = 48978927._RPP/ 651442._RPP;c(3,0,4) = -81991005._RPP/573014._RPP + ! / ; / + c(4,0,4) = 323192477._RPP/ 1923068._RPP;c(5,0,4) = -247486780._RPP/1982753._RPP + ! / ; / + c(6,0,4) = 179193514._RPP/3127239._RPP;c(7,0,4) = -42281552._RPP/ 2841263._RPP + ! / ; / + c(8,0,4) = 21701959._RPP/12951510._RPP + + ! / ; / + c(0,1,4) = 0._RPP;c(1,1,4) = 206821378._RPP/2319277._RPP + ! / ; / + c(2,1,4) = -257255959._RPP/ 418532._RPP;c(3,1,4) = 1066785823._RPP/ 895146._RPP + ! / ; / + c(4,1,4) = -659953893._RPP/ 463955._RPP;c(5,1,4) = 889068808._RPP/ 829823._RPP + ! / ; / + c(6,1,4) = -379006664._RPP/ 761061._RPP;c(7,1,4) = 145478651._RPP/ 1112277._RPP + ! / ; / + c(8,1,4) = -42281552._RPP/ 2841263._RPP + + ! / ; / + c(0,2,4) = 0._RPP;c(1,2,4) = 0._RPP + ! / ; / + c(2,2,4) = 467443989._RPP/ 432139._RPP;c(3,2,4) = -1014379655._RPP/ 237166._RPP + ! / ; / + c(4,2,4) = 1427976276._RPP/ 274865._RPP;c(5,2,4) = -1288674710._RPP/ 324261._RPP + ! / ; / + c(6,2,4) = 56509897._RPP/ 30173._RPP;c(7,2,4) = -379006664._RPP/ 761061._RPP + ! / ; / + c(8,2,4) = 179193514._RPP/3127239._RPP + + ! / ; / + c(0,3,4) = 0._RPP;c(1,3,4) = 0._RPP + ! / ; / + c(2,3,4) = 0._RPP;c(3,3,4) = 1224163507._RPP/ 283894._RPP + ! / ; / + c(4,3,4) = -1890391470._RPP/ 177121._RPP;c(5,3,4) = 2682354099._RPP/ 322987._RPP + ! / ; / + c(6,3,4) = -1288674710._RPP/ 324261._RPP;c(7,3,4) = 889068808._RPP/ 829823._RPP + ! / ; / + c(8,3,4) = -247486780._RPP/1982753._RPP + + ! / ; / + c(0,4,4) = 0._RPP;c(1,4,4) = 0._RPP + ! / ; / + c(2,4,4) = 0._RPP;c(3,4,4) = 0._RPP + ! / ; / + c(4,4,4) = 7446840373._RPP/ 1106172._RPP;c(5,4,4) = -1890391470._RPP/ 177121._RPP + ! / ; / + c(6,4,4) = 1427976276._RPP/ 274865._RPP;c(7,4,4) = -659953893._RPP/ 463955._RPP + ! / ; / + c(8,4,4) = 323192477._RPP/ 1923068._RPP + + ! / ; / + c(0,5,4) = 0._RPP;c(1,5,4) = 0._RPP + ! / ; / + c(2,5,4) = 0._RPP;c(3,5,4) = 0._RPP + ! / ; / + c(4,5,4) = 0._RPP;c(5,5,4) = 1224163507._RPP/ 283894._RPP + ! / ; / + c(6,5,4) = -1014379655._RPP/ 237166._RPP;c(7,5,4) = 1066785823._RPP/ 895146._RPP + ! / ; / + c(8,5,4) = -81991005._RPP/573014._RPP + + ! / ; / + c(0,6,4) = 0._RPP;c(1,6,4) = 0._RPP + ! / ; / + c(2,6,4) = 0._RPP;c(3,6,4) = 0._RPP + ! / ; / + c(4,6,4) = 0._RPP;c(5,6,4) = 0._RPP + ! / ; / + c(6,6,4) = 467443989._RPP/ 432139._RPP;c(7,6,4) = -257255959._RPP/ 418532._RPP + ! / ; / + c(8,6,4) = 48978927._RPP/ 651442._RPP + + ! / ; / + c(0,7,4) = 0._RPP;c(1,7,4) = 0._RPP + ! / ; / + c(2,7,4) = 0._RPP;c(3,7,4) = 0._RPP + ! / ; / + c(4,7,4) = 0._RPP;c(5,7,4) = 0._RPP + ! / ; / + c(6,7,4) = 0._RPP;c(7,7,4) = 206821378._RPP/2319277._RPP + ! / ; / + c(8,7,4) = -471882251._RPP/ 21169910._RPP + + ! / ; / + c(0,8,4) = 0._RPP;c(1,8,4) = 0._RPP + ! / ; / + c(2,8,4) = 0._RPP;c(3,8,4) = 0._RPP + ! / ; / + c(4,8,4) = 0._RPP;c(5,8,4) = 0._RPP + ! / ; / + c(6,8,4) = 0._RPP;c(7,8,4) = 0._RPP + ! / ; / + c(8,8,4) = 25595175._RPP/ 17925332._RPP + + ! stencil 5 + ! / ; / + c(0,0,5) = 25595175._RPP/ 17925332._RPP;c(1,0,5) = -28933143._RPP/ 1204235._RPP + ! / ; / + c(2,0,5) = 67366110._RPP/766169._RPP;c(3,0,5) = -185363617._RPP/ 1015232._RPP + ! / ; / + c(4,0,5) = 85841095._RPP/ 365273._RPP;c(5,0,5) = -135160981._RPP/704829._RPP + ! / ; / + c(6,0,5) = 83373698._RPP/861333._RPP;c(7,0,5) = -243832589._RPP/8827552._RPP + ! / ; / + c(8,0,5) = 33222819._RPP/ 9738314._RPP + + ! / ; / + c(0,1,5) = 0._RPP;c(1,1,5) = 193935861._RPP/1901234._RPP + ! / ; / + c(2,1,5) = -491966393._RPP/ 653081._RPP;c(3,1,5) = 855538459._RPP/ 542278._RPP + ! / ; / + c(4,1,5) = -6738238495._RPP/ 3291754._RPP;c(5,1,5) = 654146656._RPP/ 388723._RPP + ! / ; / + c(6,1,5) = -767075415._RPP/ 896921._RPP;c(7,1,5) = 544135101._RPP/ 2215768._RPP + ! / ; / + c(8,1,5) = -417266048._RPP/13678797._RPP + + ! / ; / + c(0,2,5) = 0._RPP;c(1,2,5) = 0._RPP + ! / ; / + c(2,2,5) = 2253530669._RPP/ 1605103._RPP;c(3,2,5) = -628691758._RPP/ 105883._RPP + ! / ; / + c(4,2,5) = 1581790037._RPP/ 203396._RPP;c(5,2,5) = -295058921._RPP/ 45739._RPP + ! / ; / + c(6,2,5) = 1033739711._RPP/ 312683._RPP;c(7,2,5) = -931274285._RPP/ 973468._RPP + ! / ; / + c(8,2,5) = 184615935._RPP/1542601._RPP + + ! / ; / + c(0,3,5) = 0._RPP;c(1,3,5) = 0._RPP + ! / ; / + c(2,3,5) = 0._RPP;c(3,3,5) = 4054421226._RPP/ 639143._RPP + ! / ; / + c(4,3,5) = -8099595796._RPP/ 482187._RPP;c(5,3,5) = 3662929022._RPP/ 260087._RPP + ! / ; / + c(6,3,5) = -828515195._RPP/ 113623._RPP;c(7,3,5) = 1034492709._RPP/ 485618._RPP + ! / ; / + c(8,3,5) = -709458479._RPP/2638758._RPP + + ! / ; / + c(0,4,5) = 0._RPP;c(1,4,5) = 0._RPP + ! / ; / + c(2,4,5) = 0._RPP;c(3,4,5) = 0._RPP + ! / ; / + c(4,4,5) = 1548885060._RPP/ 137633._RPP;c(5,4,5) = -305554133._RPP/ 15991._RPP + ! / ; / + c(6,4,5) = 966000775._RPP/ 96443._RPP;c(7,4,5) = -787874261._RPP/ 266082._RPP + ! / ; / + c(8,4,5) = 348597468._RPP/ 922523._RPP + + ! / ; / + c(0,5,5) = 0._RPP;c(1,5,5) = 0._RPP + ! / ; / + c(2,5,5) = 0._RPP;c(3,5,5) = 0._RPP + ! / ; / + c(4,5,5) = 0._RPP;c(5,5,5) = 1879971092._RPP/ 228557._RPP + ! / ; / + c(6,5,5) = -3054791233._RPP/ 349036._RPP;c(7,5,5) = 5590654438._RPP/ 2129495._RPP + ! / ; / + c(8,5,5) = -597649141._RPP/ 1759029._RPP + + ! / ; / + c(0,6,5) = 0._RPP;c(1,6,5) = 0._RPP + ! / ; / + c(2,6,5) = 0._RPP;c(3,6,5) = 0._RPP + ! / ; / + c(4,6,5) = 0._RPP;c(5,6,5) = 0._RPP + ! / ; / + c(6,6,5) = 2349998749._RPP/ 992475._RPP;c(7,6,5) = -522065981._RPP/ 360998._RPP + ! / ; / + c(8,6,5) = 103779883._RPP/544689._RPP + + ! / ; / + c(0,7,5) = 0._RPP;c(1,7,5) = 0._RPP + ! / ; / + c(2,7,5) = 0._RPP;c(3,7,5) = 0._RPP + ! / ; / + c(4,7,5) = 0._RPP;c(5,7,5) = 0._RPP + ! / ; / + c(6,7,5) = 0._RPP;c(7,7,5) = 308180301._RPP/1366333._RPP + ! / ; / + c(8,7,5) = -186193587._RPP/ 3061888._RPP + + ! / ; / + c(0,8,5) = 0._RPP;c(1,8,5) = 0._RPP + ! / ; / + c(2,8,5) = 0._RPP;c(3,8,5) = 0._RPP + ! / ; / + c(4,8,5) = 0._RPP;c(5,8,5) = 0._RPP + ! / ; / + c(6,8,5) = 0._RPP;c(7,8,5) = 0._RPP + ! / ; / + c(8,8,5) = 14225607._RPP/ 3370285._RPP + + ! stencil 6 + ! / ; / + c(0,0,6) = 14225607._RPP/ 3370285._RPP;c(1,0,6) = -178701734._RPP/ 2462661._RPP + ! / ; / + c(2,0,6) = 329649921._RPP/ 1205744._RPP;c(3,0,6) = -823497572._RPP/1397105._RPP + ! / ; / + c(4,0,6) = 537364516._RPP/ 676097._RPP;c(5,0,6) = -427576737._RPP/623480._RPP + ! / ; / + c(6,0,6) = 383212815._RPP/1037536._RPP;c(7,0,6) = -264553111._RPP/ 2333462._RPP + ! / ; / + c(8,0,6) = 265338548._RPP/17495633._RPP + + ! / ; / + c(0,1,6) = 0._RPP;c(1,1,6) = 267692197._RPP/856297._RPP + ! / ; / + c(2,1,6) = -1883344606._RPP/ 797417._RPP;c(3,1,6) = 982680142._RPP/ 192447._RPP + ! / ; / + c(4,1,6) = -2267814051._RPP/ 328385._RPP;c(5,1,6) = 1268411423._RPP/ 212206._RPP + ! / ; / + c(6,1,6) = -676787627._RPP/ 209575._RPP;c(7,1,6) = 127754174._RPP/ 128481._RPP + ! / ; / + c(8,1,6) = -173397370._RPP/1299717._RPP + + ! / ; / + c(0,2,6) = 0._RPP;c(1,2,6) = 0._RPP + ! / ; / + c(2,2,6) = 2952652193._RPP/ 659941._RPP;c(3,2,6) = -5961122741._RPP/ 307109._RPP + ! / ; / + c(4,2,6) = 451561861._RPP/ 17139._RPP;c(5,2,6) = -2468363819._RPP/ 107827._RPP + ! / ; / + c(6,2,6) = 2097415117._RPP/ 168915._RPP;c(7,2,6) = -2367490577._RPP/ 616772._RPP + ! / ; / + c(8,2,6) = 688214053._RPP/1331147._RPP + + ! / ; / + c(0,3,6) = 0._RPP;c(1,3,6) = 0._RPP + ! / ; / + c(2,3,6) = 0._RPP;c(3,3,6) = 3256858005._RPP/ 154108._RPP + ! / ; / + c(4,3,6) = -7546651472._RPP/ 130969._RPP;c(5,3,6) = 3655479387._RPP/ 72668._RPP + ! / ; / + c(6,3,6) = -765629878._RPP/ 27919._RPP;c(7,3,6) = 5241495620._RPP/ 615127._RPP + ! / ; / + c(8,3,6) = -61463934._RPP/53285._RPP + + ! / ; / + c(0,4,6) = 0._RPP;c(1,4,6) = 0._RPP + ! / ; / + c(2,4,6) = 0._RPP;c(3,4,6) = 0._RPP + ! / ; / + c(4,4,6) = 11322353265._RPP/ 286802._RPP;c(5,4,6) = -4882065990._RPP/ 70417._RPP + ! / ; / + c(6,4,6) = 1334723167._RPP/ 35090._RPP;c(7,4,6) = -10107954583._RPP/ 849559._RPP + ! / ; / + c(8,4,6) = 306856831._RPP/ 189251._RPP + + ! / ; / + c(0,5,6) = 0._RPP;c(1,5,6) = 0._RPP + ! / ; / + c(2,5,6) = 0._RPP;c(3,5,6) = 0._RPP + ! / ; / + c(4,5,6) = 0._RPP;c(5,5,6) = 2631362108._RPP/ 85845._RPP + ! / ; / + c(6,5,6) = -2028942806._RPP/ 59843._RPP;c(7,5,6) = 2363787227._RPP/ 220958._RPP + ! / ; / + c(8,5,6) = -289784372._RPP/196989._RPP + + ! / ; / + c(0,6,6) = 0._RPP;c(1,6,6) = 0._RPP + ! / ; / + c(2,6,6) = 0._RPP;c(3,6,6) = 0._RPP + ! / ; / + c(4,6,6) = 0._RPP;c(5,6,6) = 0._RPP + ! / ; / + c(6,6,6) = 3248190394._RPP/ 343067._RPP;c(7,6,6) = -1651888798._RPP/ 273307._RPP + ! / ; / + c(8,6,6) = 277579576._RPP/329887._RPP + + ! / ; / + c(0,7,6) = 0._RPP;c(1,7,6) = 0._RPP + ! / ; / + c(2,7,6) = 0._RPP;c(3,7,6) = 0._RPP + ! / ; / + c(4,7,6) = 0._RPP;c(5,7,6) = 0._RPP + ! / ; / + c(6,7,6) = 0._RPP;c(7,7,6) = 526012837._RPP/537300._RPP + ! / ; / + c(8,7,6) = -699447262._RPP/ 2521667._RPP + + ! / ; / + c(0,8,6) = 0._RPP;c(1,8,6) = 0._RPP + ! / ; / + c(2,8,6) = 0._RPP;c(3,8,6) = 0._RPP + ! / ; / + c(4,8,6) = 0._RPP;c(5,8,6) = 0._RPP + ! / ; / + c(6,8,6) = 0._RPP;c(7,8,6) = 0._RPP + ! / ; / + c(8,8,6) = 36409563._RPP/ 1806520._RPP + + ! stencil 7 + ! / ; / + c(0,0,7) = 36409563._RPP/ 1806520._RPP;c(1,0,7) = -296572045._RPP/ 853161._RPP + ! / ; / + c(2,0,7) = 1414733955._RPP/1073627._RPP;c(3,0,7) = -557744521._RPP/194407._RPP + ! / ; / + c(4,0,7) = 1990119523._RPP/ 506979._RPP;c(5,0,7) = -1275601375._RPP/368936._RPP + ! / ; / + c(6,0,7) = 2064497172._RPP/1078127._RPP;c(7,0,7) = -759205271._RPP/1245236._RPP + ! / ; / + c(8,0,7) = 192493416._RPP/2253847._RPP + + ! / ; / + c(0,1,7) = 0._RPP;c(1,1,7) = 550334507._RPP/ 366830._RPP + ! / ; / + c(2,1,7) = -1486183058._RPP/ 130527._RPP;c(3,1,7) = 1696424402._RPP/ 68349._RPP + ! / ; / + c(4,1,7) = -5136703769._RPP/ 151046._RPP;c(5,1,7) = 2675355119._RPP/ 89174._RPP + ! / ; / + c(6,1,7) = -2519869819._RPP/ 151381._RPP;c(7,1,7) = 1632642660._RPP/ 307433._RPP + ! / ; / + c(8,1,7) = -433682386._RPP/ 581703._RPP + + ! / ; / + c(0,2,7) = 0._RPP;c(1,2,7) = 0._RPP + ! / ; / + c(2,2,7) = 3171898228._RPP/ 146643._RPP;c(3,2,7) = -7652084383._RPP/ 81028._RPP + ! / ; / + c(4,2,7) = 4693138545._RPP/ 36209._RPP;c(5,2,7) = -5737609802._RPP/ 50081._RPP + ! / ; / + c(6,2,7) = 2904329890._RPP/ 45589._RPP;c(7,2,7) = -684405583._RPP/ 33590._RPP + ! / ; / + c(8,2,7) = 1206026846._RPP/420471._RPP + + ! / ; / + c(0,3,7) = 0._RPP;c(1,3,7) = 0._RPP + ! / ; / + c(2,3,7) = 0._RPP;c(3,3,7) = 10194856899._RPP/ 98734._RPP + ! / ; / + c(4,3,7) = -32956224478._RPP/ 116041._RPP;c(5,3,7) = 21903079582._RPP/ 87043._RPP + ! / ; / + c(6,3,7) = -30871077827._RPP/ 220014._RPP;c(7,3,7) = 2631734550._RPP/ 58459._RPP + ! / ; / + c(8,3,7) = -1432715713._RPP/225284._RPP + + ! / ; / + c(0,4,7) = 0._RPP;c(1,4,7) = 0._RPP + ! / ; / + c(2,4,7) = 0._RPP;c(3,4,7) = 0._RPP + ! / ; / + c(4,4,7) = 5232843359._RPP/ 26730._RPP;c(5,4,7) = -21436202114._RPP/ 61611._RPP + ! / ; / + c(6,4,7) = 8450768743._RPP/ 43407._RPP;c(7,4,7) = -2463944763._RPP/ 39286._RPP + ! / ; / + c(8,4,7) = 2318146475._RPP/ 260443._RPP + + ! / ; / + c(0,5,7) = 0._RPP;c(1,5,7) = 0._RPP + ! / ; / + c(2,5,7) = 0._RPP;c(3,5,7) = 0._RPP + ! / ; / + c(4,5,7) = 0._RPP;c(5,5,7) = 7222761881._RPP/ 46553._RPP + ! / ; / + c(6,5,7) = -12258216466._RPP/ 70285._RPP;c(7,5,7) = 17759778441._RPP/ 314408._RPP + ! / ; / + c(8,5,7) = -351689199._RPP/43600._RPP + + ! / ; / + c(0,6,7) = 0._RPP;c(1,6,7) = 0._RPP + ! / ; / + c(2,6,7) = 0._RPP;c(3,6,7) = 0._RPP + ! / ; / + c(4,6,7) = 0._RPP;c(5,6,7) = 0._RPP + ! / ; / + c(6,6,7) = 138686396638._RPP/ 2813507._RPP;c(7,6,7) = -6349489117._RPP/ 197436._RPP + ! / ; / + c(8,6,7) = 1919279425._RPP/ 414313._RPP + + ! / ; / + c(0,7,7) = 0._RPP;c(1,7,7) = 0._RPP + ! / ; / + c(2,7,7) = 0._RPP;c(3,7,7) = 0._RPP + ! / ; / + c(4,7,7) = 0._RPP;c(5,7,7) = 0._RPP + ! / ; / + c(6,7,7) = 0._RPP;c(7,7,7) = 8788336457._RPP/1659246._RPP + ! / ; / + c(8,7,7) = -1605498941._RPP/ 1038640._RPP + + ! / ; / + c(0,8,7) = 0._RPP;c(1,8,7) = 0._RPP + ! / ; / + c(2,8,7) = 0._RPP;c(3,8,7) = 0._RPP + ! / ; / + c(4,8,7) = 0._RPP;c(5,8,7) = 0._RPP + ! / ; / + c(6,8,7) = 0._RPP;c(7,8,7) = 0._RPP + ! / ; / + c(8,8,7) = 23000337._RPP/ 199768._RPP + + ! stencil 8 + ! / ; / + c(0,0,8) = 23000337._RPP/ 199768._RPP;c(1,0,8) = -989259649._RPP/ 497859._RPP + ! / ; / + c(2,0,8) = 2005851423._RPP/265880._RPP;c(3,0,8) = -800361473._RPP/ 48582._RPP + ! / ; / + c(4,0,8) = 1211629703._RPP/ 53483._RPP;c(5,0,8) = -16400242834._RPP/815393._RPP + ! / ; / + c(6,0,8) = 2160095091._RPP/191558._RPP;c(7,0,8) = -1039356853._RPP/284187._RPP + ! / ; / + c(8,0,8) = 380112881._RPP/ 721737._RPP + + ! / ; / + c(0,1,8) = 0._RPP;c(1,1,8) = 1207396129._RPP/140764._RPP + ! / ; / + c(2,1,8) = -5910597075._RPP/ 90694._RPP;c(3,1,8) = 6203677189._RPP/ 43561._RPP + ! / ; / + c(4,1,8) = -29831101642._RPP/ 152201._RPP;c(5,1,8) = 8534140303._RPP/ 48995._RPP + ! / ; / + c(6,1,8) = -7469836609._RPP/ 76401._RPP;c(7,1,8) = 962141663._RPP/ 30298._RPP + ! / ; / + c(8,1,8) = -1382011106._RPP/301683._RPP + + ! / ; / + c(0,2,8) = 0._RPP;c(1,2,8) = 0._RPP + ! / ; / + c(2,2,8) = 9873545067._RPP/ 79705._RPP;c(3,2,8) = -10120501295._RPP/ 18678._RPP + ! / ; / + c(4,2,8) = 9817971019._RPP/ 13153._RPP;c(5,2,8) = -13534679320._RPP/ 20379._RPP + ! / ; / + c(6,2,8) = 8640690184._RPP/ 23145._RPP;c(7,2,8) = -7097325924._RPP/ 58429._RPP + ! / ; / + c(8,2,8) = 7116193241._RPP/405236._RPP + + ! / ; / + c(0,3,8) = 0._RPP;c(1,3,8) = 0._RPP + ! / ; / + c(2,3,8) = 0._RPP;c(3,3,8) = 181942554161._RPP/ 306771._RPP + ! / ; / + c(4,3,8) = -32852743324._RPP/ 20081._RPP;c(5,3,8) = 25425670807._RPP/ 17442._RPP + ! / ; / + c(6,3,8) = -13491549889._RPP/ 16436._RPP;c(7,3,8) = 13666821827._RPP/ 51060._RPP + ! / ; / + c(8,3,8) = -12858081715._RPP/331389._RPP + + ! / ; / + c(0,4,8) = 0._RPP;c(1,4,8) = 0._RPP + ! / ; / + c(2,4,8) = 0._RPP;c(3,4,8) = 0._RPP + ! / ; / + c(4,4,8) = 7211727349._RPP/ 6383._RPP;c(5,4,8) = -34046474687._RPP/ 16880._RPP + ! / ; / + c(6,4,8) = 29334155111._RPP/ 25771._RPP;c(7,4,8) = -14121568547._RPP/ 37942._RPP + ! / ; / + c(8,4,8) = 8028408627._RPP/ 148285._RPP + + ! / ; / + c(0,5,8) = 0._RPP;c(1,5,8) = 0._RPP + ! / ; / + c(2,5,8) = 0._RPP;c(3,5,8) = 0._RPP + ! / ; / + c(4,5,8) = 0._RPP;c(5,5,8) = 26479157148._RPP/ 29351._RPP + ! / ; / + c(6,5,8) = -32612776236._RPP/ 31939._RPP;c(7,5,8) = 10624327325._RPP/ 31707._RPP + ! / ; / + c(8,5,8) = -6519672839._RPP/ 133134._RPP + + ! / ; / + c(0,6,8) = 0._RPP;c(1,6,8) = 0._RPP + ! / ; / + c(2,6,8) = 0._RPP;c(3,6,8) = 0._RPP + ! / ; / + c(4,6,8) = 0._RPP;c(5,6,8) = 0._RPP + ! / ; / + c(6,6,8) = 958711850795._RPP/ 3306139._RPP;c(7,6,8) = -2523726139._RPP/ 13197._RPP + ! / ; / + c(8,6,8) = 1051885279._RPP/37394._RPP + + ! / ; / + c(0,7,8) = 0._RPP;c(1,7,8) = 0._RPP + ! / ; / + c(2,7,8) = 0._RPP;c(3,7,8) = 0._RPP + ! / ; / + c(4,7,8) = 0._RPP;c(5,7,8) = 0._RPP + ! / ; / + c(6,7,8) = 0._RPP;c(7,7,8) = 2789709824._RPP/ 87891._RPP + ! / ; / + c(8,7,8) = -1291706883._RPP/ 137012._RPP + + ! / ; / + c(0,8,8) = 0._RPP;c(1,8,8) = 0._RPP + ! / ; / + c(2,8,8) = 0._RPP;c(3,8,8) = 0._RPP + ! / ; / + c(4,8,8) = 0._RPP;c(5,8,8) = 0._RPP + ! / ; / + c(6,8,8) = 0._RPP;c(7,8,8) = 0._RPP + ! / ; / + c(8,8,8) = 191906863._RPP/ 270061._RPP + endselect + endassociate + endsubroutine create + + pure subroutine compute_with_stencil_of_rank_1(self, stencil) + !< Compute beta. + class(beta_int_js), intent(inout) :: self !< Beta. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + integer(I_P) :: s1, s2, s3 !< Counters. + + associate(val => self%values_rank_1) + do s1=0, self%S - 1 ! stencils loop + val(s1) = 0._RPP + do s2=0, self%S - 1 + do s3=0, self%S - 1 + val(s1) = val(s1) + self%coef(s3, s2, s1) * stencil(s1 - s3) * stencil(s1 - s2) + enddo + enddo + enddo + endassociate + endsubroutine compute_with_stencil_of_rank_1 + + pure subroutine compute_with_stencil_of_rank_2(self, stencil) + !< Compute beta. + class(beta_int_js), intent(inout) :: self !< Beta. + real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. + + ! Empty subroutine. + endsubroutine compute_with_stencil_of_rank_2 + + pure function description(self) result(string) + !< Return beta string-description. + class(beta_int_js), intent(in) :: self !< Beta. + character(len=:), allocatable :: string !< String-description. + +#ifndef DEBUG + ! error stop in pure procedure is a F2015 feature not yet supported in debug mode + error stop 'beta_int_js%description to be implemented, do not use!' +#endif + endfunction description + + elemental subroutine destroy(self) + !< Destroy beta. + class(beta_int_js), intent(inout) :: self !< Beta. + + call self%destroy_ + if (allocated(self%values_rank_1)) deallocate(self%values_rank_1) + if (allocated(self%coef)) deallocate(self%coef) + endsubroutine destroy +endmodule wenoof_beta_int_js diff --git a/src/lib/concrete_objects/wenoof_beta_rec_js.F90 b/src/lib/concrete_objects/wenoof_beta_rec_js.F90 index bf79b96..94a34e0 100644 --- a/src/lib/concrete_objects/wenoof_beta_rec_js.F90 +++ b/src/lib/concrete_objects/wenoof_beta_rec_js.F90 @@ -32,13 +32,14 @@ module wenoof_beta_rec_js !< *Very-high-order weno schemes*, G. A. Gerolymos, D. Senechal, I. Vallet, JCP, 2009, vol. 228, pp. 8481-8524, !< doi:10.1016/j.jcp.2009.07.039 private - real(RPP), allocatable :: coef(:,:,:) !< Beta coefficients [1:2,0:S-1,0:S-1]. + real(RPP), allocatable :: coef(:,:,:) !< Beta coefficients [0:S-1,0:S-1,0:S-1]. contains ! public deferred methods - procedure, pass(self) :: create !< Create beta. - procedure, pass(self) :: compute !< Compute beta. - procedure, pass(self) :: description !< Return beta string-description. - procedure, pass(self) :: destroy !< Destroy beta. + procedure, pass(self) :: create !< Create beta. + procedure, pass(self) :: compute_with_stencil_of_rank_1 !< Compute beta. + procedure, pass(self) :: compute_with_stencil_of_rank_2 !< Compute beta. + procedure, pass(self) :: description !< Return beta string-description. + procedure, pass(self) :: destroy !< Destroy beta. endtype beta_rec_js contains @@ -50,8 +51,8 @@ subroutine create(self, constructor) call self%destroy call self%create_(constructor=constructor) - allocate(self%values(1:2, 0:self%S - 1)) - self%values = 0._RPP + allocate(self%values_rank_2(1:2, 0:self%S - 1)) + self%values_rank_2 = 0._RPP allocate(self%coef(0:self%S - 1, 0:self%S - 1, 0:self%S - 1)) associate(c => self%coef) select case(self%S) @@ -2373,24 +2374,33 @@ subroutine create(self, constructor) endassociate endsubroutine create - pure subroutine compute(self, stencil) + pure subroutine compute_with_stencil_of_rank_1(self, stencil) + !< Compute beta. + class(beta_rec_js), intent(inout) :: self !< Beta. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + + ! Empty routine. + endsubroutine compute_with_stencil_of_rank_1 + + pure subroutine compute_with_stencil_of_rank_2(self, stencil) !< Compute beta. class(beta_rec_js), intent(inout) :: self !< Beta. real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. integer(I_P) :: s1, s2, s3, f !< Counters. - do s1=0, self%S - 1 ! stencils loop - do f=self%f1, self%f2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) - self%values(f, s1) = 0._RPP - do s2=0, self%S - 1 - do s3=0, self%S - 1 - self%values(f, s1) = self%values(f, s1) + & - self%coef(s3, s2, s1) * stencil(f + self%ff, s1 - s3) * stencil(f + self%ff, s1 - s2) + associate(val => self%values_rank_2) + do s1=0, self%S - 1 ! stencils loop + do f=1, 2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) + val(f, s1) = 0._RPP + do s2=0, self%S - 1 + do s3=0, self%S - 1 + val(f, s1) = val(f, s1) + self%coef(s3, s2, s1) * stencil(f, s1 - s3) * stencil(f, s1 - s2) + enddo enddo enddo enddo - enddo - endsubroutine compute + endassociate + endsubroutine compute_with_stencil_of_rank_2 pure function description(self) result(string) !< Return beta string-description. @@ -2408,7 +2418,7 @@ elemental subroutine destroy(self) class(beta_rec_js), intent(inout) :: self !< Beta. call self%destroy_ - if (allocated(self%values)) deallocate(self%values) + if (allocated(self%values_rank_2)) deallocate(self%values_rank_2) if (allocated(self%coef)) deallocate(self%coef) endsubroutine destroy endmodule wenoof_beta_rec_js diff --git a/src/lib/concrete_objects/wenoof_interpolations_int_js.F90 b/src/lib/concrete_objects/wenoof_interpolations_int_js.F90 new file mode 100644 index 0000000..ae072e2 --- /dev/null +++ b/src/lib/concrete_objects/wenoof_interpolations_int_js.F90 @@ -0,0 +1,393 @@ +!< Jiang-Shu (Lagrange) interpolations object for function interpolation. +module wenoof_interpolations_int_js +!< Jiang-Shu (Lagrange) interpolations object for function interpolation. +!< +!< @note The provided interpolations implement the Lagrange interpolations defined in *High Order Weighted Essentially +!< Nonoscillatory Schemes for Convection Dominated Problems*, Chi-Wang Shu, SIAM Review, 2009, vol. 51, pp. 82--126, +!< doi:10.1137/070679065. + +#ifdef r16p +use penf, only: I_P, RPP=>R16P +#else +use penf, only: I_P, RPP=>R8P +#endif +use wenoof_base_object +use wenoof_interpolations_object + +implicit none +private +public :: interpolations_int_js +public :: interpolations_int_js_constructor + +type, extends(interpolations_object_constructor) :: interpolations_int_js_constructor + !< Jiang-Shu (Lagrange) interpolations object for function interpolation constructor. +endtype interpolations_int_js_constructor + +type, extends(interpolations_object) :: interpolations_int_js + !< Jiang-Shu (Lagrange) interpolations object for function interpolation. + !< + !< @note The provided interpolations implement the Lagrange interpolations defined in *High Order Weighted Essentially + !< Nonoscillatory Schemes for Convection Dominated Problems*, Chi-Wang Shu, SIAM Review, 2009, vol. 51, pp. 82--126, + !< doi:10.1137/070679065. + real(RPP), allocatable :: coef(:,:) !< Polynomial coefficients [0:S-1,0:S-1]. + contains + ! public deferred methods + procedure, pass(self) :: create !< Create interpolations. + procedure, pass(self) :: compute_with_stencil_of_rank_1 !< Compute interpolations. + procedure, pass(self) :: compute_with_stencil_of_rank_2 !< Compute interpolations. + procedure, pass(self) :: description !< Return interpolations string-description. + procedure, pass(self) :: destroy !< Destroy interpolations. +endtype interpolations_int_js + +contains + ! public deferred methods + subroutine create(self, constructor) + !< Create interpolations. + class(interpolations_int_js), intent(inout) :: self !< Interpolations. + class(base_object_constructor), intent(in) :: constructor !< Interpolations constructor. + real(RPP), allocatable :: f(:,:) !< Temporary variable. + real(RPP) :: prod !< Temporary variable. + real(RPP) :: c_sum !< Temporary variable. + integer(I_P) :: i, j, k !< Counters. + + call self%destroy + call self%create_(constructor=constructor) + allocate(self%values_rank_1(0:self%S - 1)) + self%values_rank_1 = 0._RPP + allocate(self%coef(0:self%S - 1, 0:self%S - 1)) + select type(constructor) + type is(interpolations_int_js_constructor) + associate(S => self%S, c => self%coef, stencil => constructor%stencil, x_target => constructor%x_target) + if(x_target==-0.5_RPP) then + ! left interface (i-1/2) + select case(S) + case(2) ! 3rd order + ! cell 1 ; cell 0 + c(1,0)= 0.5_RPP; c(0,0)= 0.5_RPP ! stencil 0 + c(1,1)= 1.5_RPP; c(0,1)= -0.5_RPP ! stencil 1 + case(3) ! 5th order + ! cell 2 ; cell 1 ; cell 0 + c(2,0)= -1._RPP/8._RPP; c(1,0)= 3._RPP/4._RPP; c(0,0)= 3._RPP/8._RPP ! stencil 0 + c(2,1)= 3._RPP/8._RPP; c(1,1)= 3._RPP/4._RPP; c(0,1)= -1._RPP/8._RPP ! stencil 1 + c(2,2)= 15._RPP/8._RPP; c(1,2)= -5._RPP/4._RPP; c(0,2)= 3._RPP/8._RPP ! stencil 2 + case(4) ! 7th order + ! cell 3 ; cell 2 ; cell 1 ; cell 0 + c(3,0)= 1._RPP/16._RPP; c(2,0)= -5._RPP/16._RPP; c(1,0)= 15._RPP/16._RPP; c(0,0)= 5._RPP/16._RPP ! stencil 0 + c(3,1)= -1._RPP/16._RPP; c(2,1)= 9._RPP/16._RPP; c(1,1)= 9._RPP/16._RPP; c(0,1)= -1._RPP/16._RPP ! stencil 1 + c(3,2)= 5._RPP/16._RPP; c(2,2)= 15._RPP/16._RPP; c(1,2)= -5._RPP/16._RPP; c(0,2)= 1._RPP/16._RPP ! stencil 2 + c(3,3)= 35._RPP/16._RPP; c(2,3)=-35._RPP/16._RPP; c(1,3)= 21._RPP/16._RPP; c(0,3)= -5._RPP/16._RPP ! stencil 3 + case(5) ! 9th order + ! cell 4 ; cell 3 ; cell 2 ; cell 1 + c(4,0)= -5._RPP/128._RPP; c(3,0)= 7._RPP/32._RPP ; c(2,0)= -35._RPP/64._RPP ; c(1,0)= 35._RPP/32._RPP ! stencil 0 + c(4,1)= 3._RPP/128._RPP; c(3,1)= -5._RPP/32._RPP ; c(2,1)= 45._RPP/64._RPP ; c(1,1)= 15._RPP/32._RPP ! stencil 1 + c(4,2)= -5._RPP/128._RPP; c(3,2)= 15._RPP/32._RPP ; c(2,2)= 45._RPP/64._RPP ; c(1,2)= -5._RPP/32._RPP ! stencil 2 + c(4,3)= 35._RPP/128._RPP; c(3,3)= 35._RPP/32._RPP ; c(2,3)= -35._RPP/64._RPP ; c(1,3)= 7._RPP/32._RPP ! stencil 3 + c(4,4)= 315._RPP/128._RPP; c(3,4)=-105._RPP/32._RPP ; c(2,4)= 189._RPP/64._RPP ; c(1,4)= -45._RPP/32._RPP ! stencil 4 + ! cell 0 + c(0,0)= 35._RPP/128._RPP ! stencil 0 + c(0,1)= -5._RPP/128._RPP ! stencil 1 + c(0,2)= 3._RPP/128._RPP ! stencil 2 + c(0,3)= -5._RPP/128._RPP ! stencil 3 + c(0,4)= 35._RPP/128._RPP ! stencil 4 + case(6) ! 11th order + ! cell 5 ; cell 4 ; cell 3 + c(5,0)= 7._RPP/256._RPP; c(4,0)= -45._RPP/256._RPP; c(3,0)= 63._RPP/128._RPP ! stencil 0 + c(5,1)= -3._RPP/256._RPP; c(4,1)= 21._RPP/256._RPP; c(3,1)= -35._RPP/128._RPP ! stencil 1 + c(5,2)= 3._RPP/256._RPP; c(4,2)= -25._RPP/256._RPP; c(3,2)= 75._RPP/128._RPP ! stencil 2 + c(5,3)= -7._RPP/256._RPP; c(4,3)= 105._RPP/256._RPP; c(3,3)= 105._RPP/128._RPP ! stencil 3 + c(5,4)= 63._RPP/256._RPP; c(4,4)= 315._RPP/256._RPP; c(3,4)= -105._RPP/128._RPP ! stencil 4 + c(5,5)= 693._RPP/256._RPP; c(4,5)=-1155._RPP/256._RPP; c(3,5)= 693._RPP/128._RPP ! stencil 5 + ! cell 2 ; cell 1 ; cell 0 + c(2,0)= -105._RPP/128._RPP; c(1,0)= 315._RPP/256._RPP; c(0,0)= 63._RPP/256._RPP ! stencil 0 + c(2,1)= 105._RPP/128._RPP; c(1,1)= 105._RPP/256._RPP; c(0,1)= -7._RPP/256._RPP ! stencil 1 + c(2,2)= 75._RPP/128._RPP; c(1,2)= -25._RPP/256._RPP; c(0,2)= 3._RPP/256._RPP ! stencil 2 + c(2,3)= -35._RPP/128._RPP; c(1,3)= 21._RPP/256._RPP; c(0,3)= -3._RPP/256._RPP ! stencil 3 + c(2,4)= 63._RPP/128._RPP; c(1,4)= -45._RPP/256._RPP; c(0,4)= 7._RPP/256._RPP ! stencil 4 + c(2,5)= -495._RPP/128._RPP; c(1,5)= 385._RPP/256._RPP; c(0,5)= -63._RPP/256._RPP ! stencil 5 + case(7) ! 13th order + ! cell 6 ; cell 5 ; cell 4 + c(6,0)= -21._RPP/1024._RPP; c(5,0)= 77._RPP/512._RPP ; c(4,0)= -495._RPP/1024._RPP ! stencil 0 + c(6,1)= 7._RPP/1024._RPP; c(5,1)= -27._RPP/512._RPP ; c(4,1)= 189._RPP/1024._RPP ! stencil 1 + c(6,2)= -5._RPP/1024._RPP; c(5,2)= 21._RPP/512._RPP ; c(4,2)= -175._RPP/1024._RPP ! stencil 2 + c(6,3)= 7._RPP/1024._RPP; c(5,3)= -35._RPP/512._RPP ; c(4,3)= 525._RPP/1024._RPP ! stencil 3 + c(6,4)= -21._RPP/1024._RPP; c(5,4)= 189._RPP/512._RPP ; c(4,4)= 945._RPP/1024._RPP ! stencil 4 + c(6,5)= 231._RPP/1024._RPP; c(5,5)= 693._RPP/512._RPP ; c(4,5)=-1155._RPP/1024._RPP ! stencil 5 + c(6,6)= 3003._RPP/1024._RPP; c(5,6)=-3003._RPP/512._RPP ; c(4,6)= 9009._RPP/1024._RPP ! stencil 6 + ! cell 3 ; cell 2 ; cell 1 + c(3,0)= 231._RPP/256._RPP ; c(2,0)=-1155._RPP/1024._RPP; c(1,0)= 693._RPP/512._RPP ! stencil 0 + c(3,1)= -105._RPP/256._RPP ; c(2,1)= 945._RPP/1024._RPP; c(1,1)= 189._RPP/512._RPP ! stencil 1 + c(3,2)= 175._RPP/256._RPP ; c(2,2)= 525._RPP/1024._RPP; c(1,2)= -35._RPP/512._RPP ! stencil 2 + c(3,3)= 175._RPP/256._RPP ; c(2,3)= -175._RPP/1024._RPP; c(1,3)= 21._RPP/512._RPP ! stencil 3 + c(3,4)= -105._RPP/256._RPP ; c(2,4)= 189._RPP/1024._RPP; c(1,4)= -27._RPP/512._RPP ! stencil 4 + c(3,5)= 231._RPP/256._RPP ; c(2,5)= -495._RPP/1024._RPP; c(1,5)= 77._RPP/512._RPP ! stencil 5 + c(3,6)=-2145._RPP/256._RPP ; c(2,6)= 5005._RPP/1024._RPP; c(1,6)= -819._RPP/512._RPP ! stencil 6 + ! cell 0 + c(0,0)= 231._RPP/1024._RPP ! stencil 0 + c(0,1)= -21._RPP/1024._RPP ! stencil 1 + c(0,2)= 7._RPP/1024._RPP ! stencil 2 + c(0,3)= -5._RPP/1024._RPP ! stencil 3 + c(0,4)= 7._RPP/1024._RPP ! stencil 4 + c(0,5)= -21._RPP/1024._RPP ! stencil 5 + c(0,6)= 231._RPP/1024._RPP ! stencil 6 + case(8) ! 15th order + ! cell 7 ; cell 6 ; cell 5 + c(7,0)= 33._RPP/2048._RPP; c(6,0)= -273._RPP/2048._RPP; c(5,0)= 1001._RPP/2048._RPP ! stencil 0 + c(7,1)= -9._RPP/2048._RPP; c(6,1)= 77._RPP/2048._RPP; c(5,1)= -297._RPP/2048._RPP ! stencil 1 + c(7,2)= 5._RPP/2048._RPP; c(6,2)= -45._RPP/2048._RPP; c(5,2)= 189._RPP/2048._RPP ! stencil 2 + c(7,3)= -5._RPP/2048._RPP; c(6,3)= 49._RPP/2048._RPP; c(5,3)= -245._RPP/2048._RPP ! stencil 3 + c(7,4)= 9._RPP/2048._RPP; c(6,4)= -105._RPP/2048._RPP; c(5,4)= 945._RPP/2048._RPP ! stencil 4 + c(7,5)= -33._RPP/2048._RPP; c(6,5)= 693._RPP/2048._RPP; c(5,5)= 2079._RPP/2048._RPP ! stencil 5 + c(7,6)= 429._RPP/2048._RPP; c(6,6)= 3003._RPP/2048._RPP; c(5,6)= -3003._RPP/2048._RPP ! stencil 6 + c(7,7)= 6435._RPP/2048._RPP; c(6,7)=-15015._RPP/2048._RPP; c(5,7)= 27027._RPP/2048._RPP ! stencil 7 + ! cell 4 ; cell 3 ; cell 2 + c(4,0)= -2145._RPP/2048._RPP; c(3,0)= 3003._RPP/2048._RPP; c(2,0)= -3003._RPP/2048._RPP ! stencil 0 + c(4,1)= 693._RPP/2048._RPP; c(3,1)= -1155._RPP/2048._RPP; c(2,1)= 2079._RPP/2048._RPP ! stencil 1 + c(4,2)= -525._RPP/2048._RPP; c(3,2)= 1575._RPP/2048._RPP; c(2,2)= 945._RPP/2048._RPP ! stencil 2 + c(4,3)= 1225._RPP/2048._RPP; c(3,3)= 1225._RPP/2048._RPP; c(2,3)= -245._RPP/2048._RPP ! stencil 3 + c(4,4)= 1575._RPP/2048._RPP; c(3,4)= -525._RPP/2048._RPP; c(2,4)= 189._RPP/2048._RPP ! stencil 4 + c(4,5)= -1155._RPP/2048._RPP; c(3,5)= 693._RPP/2048._RPP; c(2,5)= -297._RPP/2048._RPP ! stencil 5 + c(4,6)= 3003._RPP/2048._RPP; c(3,6)= -2145._RPP/2048._RPP; c(2,6)= 1001._RPP/2048._RPP ! stencil 6 + c(4,7)=-32175._RPP/2048._RPP; c(3,7)= 25025._RPP/2048._RPP; c(2,7)=-12285._RPP/2048._RPP ! stencil 7 + ! cell 1 ; cell 0 + c(1,0)= 3003._RPP/2048._RPP; c(0,0)= 429._RPP/2048._RPP ! stencil 0 + c(1,1)= 693._RPP/2048._RPP; c(0,1)= -33._RPP/2048._RPP ! stencil 1 + c(1,2)= -105._RPP/2048._RPP; c(0,2)= 9._RPP/2048._RPP ! stencil 2 + c(1,3)= 49._RPP/2048._RPP; c(0,3)= -5._RPP/2048._RPP ! stencil 3 + c(1,4)= -45._RPP/2048._RPP; c(0,4)= 5._RPP/2048._RPP ! stencil 4 + c(1,5)= 77._RPP/2048._RPP; c(0,5)= -9._RPP/2048._RPP ! stencil 5 + c(1,6)= -273._RPP/2048._RPP; c(0,6)= 33._RPP/2048._RPP ! stencil 6 + c(1,7)= 3465._RPP/2048._RPP; c(0,7)= -429._RPP/2048._RPP ! stencil 7 + case(9) ! 17th order + ! cell 8 ; cell 7 ; cell 6 + c(8,0)= -429._RPP/32768._RPP; c(7,0)= 495._RPP/4096._RPP ; c(6,0)= -4095._RPP/8192._RPP ! stencil 0 + c(8,1)= 99._RPP/32768._RPP; c(7,1)= -117._RPP/4096._RPP ; c(6,1)= 1001._RPP/8192._RPP ! stencil 1 + c(8,2)= -45._RPP/32768._RPP; c(7,2)= 55._RPP/4096._RPP ; c(6,2)= -495._RPP/8192._RPP ! stencil 2 + c(8,3)= 35._RPP/32768._RPP; c(7,3)= -45._RPP/4096._RPP ; c(6,3)= 441._RPP/8192._RPP ! stencil 3 + c(8,4)= -45._RPP/32768._RPP; c(7,4)= 63._RPP/4096._RPP ; c(6,4)= -735._RPP/8192._RPP ! stencil 4 + c(8,5)= 99._RPP/32768._RPP; c(7,5)= -165._RPP/4096._RPP ; c(6,5)= 3465._RPP/8192._RPP ! stencil 5 + c(8,6)= -429._RPP/32768._RPP; c(7,6)= 1287._RPP/4096._RPP ; c(6,6)= 9009._RPP/8192._RPP ! stencil 6 + c(8,7)= 6435._RPP/32768._RPP; c(7,7)= 6435._RPP/4096._RPP ; c(6,7)= -15015._RPP/8192._RPP ! stencil 7 + c(8,8)= 109395._RPP/32768._RPP; c(7,8)= -36465._RPP/4096._RPP ; c(6,8)= 153153._RPP/8192._RPP ! stencil 8 + ! cell 5 ; cell 4 ; cell 3 + c(5,0)= 5005._RPP/4096._RPP ; c(4,0)= -32175._RPP/16384._RPP; c(3,0)= 9009._RPP/4096._RPP ! stencil 0 + c(5,1)= -1287._RPP/4096._RPP ; c(4,1)= 9009._RPP/16384._RPP; c(3,1)= -3003._RPP/4096._RPP ! stencil 1 + c(5,2)= 693._RPP/4096._RPP ; c(4,2)= -5775._RPP/16384._RPP; c(3,2)= 3465._RPP/4096._RPP ! stencil 2 + c(5,3)= -735._RPP/4096._RPP ; c(4,3)= 11025._RPP/16384._RPP; c(3,3)= 2205._RPP/4096._RPP ! stencil 3 + c(5,4)= 2205._RPP/4096._RPP ; c(4,4)= 11025._RPP/16384._RPP; c(3,4)= -735._RPP/4096._RPP ! stencil 4 + c(5,5)= 3465._RPP/4096._RPP ; c(4,5)= -5775._RPP/16384._RPP; c(3,5)= 693._RPP/4096._RPP ! stencil 5 + c(5,6)= -3003._RPP/4096._RPP ; c(4,6)= 9009._RPP/16384._RPP; c(3,6)= -1287._RPP/4096._RPP ! stencil 6 + c(5,7)= 9009._RPP/4096._RPP ; c(4,7)= -32175._RPP/16384._RPP; c(3,7)= 5005._RPP/4096._RPP ! stencil 7 + c(5,8)=-109395._RPP/4096._RPP ; c(4,8)= 425425._RPP/16384._RPP; c(3,8)= -69615._RPP/4096._RPP ! stencil 8 + ! cell 2 ; cell 1 ; cell 0 + c(2,0)= -15015._RPP/8192._RPP ; c(1,0)= 6435._RPP/4096._RPP ; c(0,0)= 6435._RPP/32768._RPP ! stencil 0 + c(2,1)= 9009._RPP/8192._RPP ; c(1,1)= 1287._RPP/4096._RPP ; c(0,1)= -429._RPP/32768._RPP ! stencil 1 + c(2,2)= 3465._RPP/8192._RPP ; c(1,2)= -165._RPP/4096._RPP ; c(0,2)= 99._RPP/32768._RPP ! stencil 2 + c(2,3)= -735._RPP/8192._RPP ; c(1,3)= 63._RPP/4096._RPP ; c(0,3)= -45._RPP/32768._RPP ! stencil 3 + c(2,4)= 441._RPP/8192._RPP ; c(1,4)= -45._RPP/4096._RPP ; c(0,4)= 35._RPP/32768._RPP ! stencil 4 + c(2,5)= -495._RPP/8192._RPP ; c(1,5)= 55._RPP/4096._RPP ; c(0,5)= -45._RPP/32768._RPP ! stencil 5 + c(2,6)= 1001._RPP/8192._RPP ; c(1,6)= -117._RPP/4096._RPP ; c(0,6)= 99._RPP/32768._RPP ! stencil 6 + c(2,7)= -4095._RPP/8192._RPP ; c(1,7)= 495._RPP/4096._RPP ; c(0,7)= -429._RPP/32768._RPP ! stencil 7 + c(2,8)= 58905._RPP/8192._RPP ; c(1,8)= -7293._RPP/4096._RPP ; c(0,8)= 6435._RPP/32768._RPP ! stencil 8 + endselect + elseif(x_target==0.5_RPP) then + ! right interface (i+1/2) + select case(self%S) + case(2) ! 3rd order + ! cell 1 ; cell 0 + c(1,0)= -0.5_RPP; c(0,0)= 1.5_RPP ! stencil 0 + c(1,1)= 0.5_RPP; c(0,1)= 0.5_RPP ! stencil 1 + case(3) ! 5th order + ! cell 2 ; cell 1 ; cell 0 + c(2,0)= 3._RPP/8._RPP; c(1,0)= -5._RPP/4._RPP; c(0,0)= 15._RPP/8._RPP ! stencil 0 + c(2,1)= -1._RPP/8._RPP; c(1,1)= 3._RPP/4._RPP; c(0,1)= 3._RPP/8._RPP ! stencil 1 + c(2,2)= 3._RPP/8._RPP; c(1,2)= 3._RPP/4._RPP; c(0,2)= -1._RPP/8._RPP ! stencil 2 + case(4) ! 7th order + ! cell 3 ; cell 2 ; cell 1 ; cell 0 + c(3,0)= -5._RPP/16._RPP; c(2,0)= 21._RPP/16._RPP; c(1,0)=-35._RPP/16._RPP; c(0,0)= 35._RPP/16._RPP ! stencil 0 + c(3,1)= 1._RPP/16._RPP; c(2,1)= -5._RPP/16._RPP; c(1,1)= 15._RPP/16._RPP; c(0,1)= 5._RPP/16._RPP ! stencil 1 + c(3,2)= -1._RPP/16._RPP; c(2,2)= 9._RPP/16._RPP; c(1,2)= 9._RPP/16._RPP; c(0,2)= -1._RPP/16._RPP ! stencil 2 + c(3,3)= 5._RPP/16._RPP; c(2,3)= 15._RPP/16._RPP; c(1,3)= -5._RPP/16._RPP; c(0,3)= 1._RPP/16._RPP ! stencil 3 + case(5) ! 9th order + ! cell 4 ; cell 3 ; cell 2 ; cell 1 + c(4,0)= 35._RPP/128._RPP; c(3,0)= -45._RPP/32._RPP ; c(2,0)= 189._RPP/64._RPP ; c(1,0)=-105._RPP/32._RPP ! stencil 0 + c(4,1)= -5._RPP/128._RPP; c(3,1)= 7._RPP/32._RPP ; c(2,1)= -35._RPP/64._RPP ; c(1,1)= 35._RPP/32._RPP ! stencil 1 + c(4,2)= 3._RPP/128._RPP; c(3,2)= -5._RPP/32._RPP ; c(2,2)= 45._RPP/64._RPP ; c(1,2)= 15._RPP/32._RPP ! stencil 2 + c(4,3)= -5._RPP/128._RPP; c(3,3)= 15._RPP/32._RPP ; c(2,3)= 45._RPP/64._RPP ; c(1,3)= -5._RPP/32._RPP ! stencil 3 + c(4,4)= 35._RPP/128._RPP; c(3,4)= 35._RPP/32._RPP ; c(2,4)= -35._RPP/64._RPP ; c(1,4)= 7._RPP/32._RPP ! stencil 4 + ! cell 0 + c(0,0)= 315._RPP/128._RPP ! stencil 0 + c(0,1)= 35._RPP/128._RPP ! stencil 1 + c(0,2)= -5._RPP/128._RPP ! stencil 2 + c(0,3)= 3._RPP/128._RPP ! stencil 3 + c(0,4)= -5._RPP/128._RPP ! stencil 4 + case(6) ! 11th order + ! cell 5 ; cell 4 ; cell 3 + c(5,0)= -63._RPP/256._RPP; c(4,0)= 385._RPP/256._RPP; c(3,0)= -495._RPP/128._RPP ! stencil 0 + c(5,1)= 7._RPP/256._RPP; c(4,1)= -45._RPP/256._RPP; c(3,1)= 63._RPP/128._RPP ! stencil 1 + c(5,2)= -3._RPP/256._RPP; c(4,2)= 21._RPP/256._RPP; c(3,2)= -35._RPP/128._RPP ! stencil 2 + c(5,3)= 3._RPP/256._RPP; c(4,3)= -25._RPP/256._RPP; c(3,3)= 75._RPP/128._RPP ! stencil 3 + c(5,4)= -7._RPP/256._RPP; c(4,4)= 105._RPP/256._RPP; c(3,4)= 105._RPP/128._RPP ! stencil 4 + c(5,5)= 63._RPP/256._RPP; c(4,5)= 315._RPP/256._RPP; c(3,5)= -105._RPP/128._RPP ! stencil 5 + ! cell 2 ; cell 1 ; cell 0 + c(2,0)= 693._RPP/128._RPP; c(1,0)=-1155._RPP/256._RPP; c(0,0)= 693._RPP/256._RPP ! stencil 0 + c(2,1)= -105._RPP/128._RPP; c(1,1)= 315._RPP/256._RPP; c(0,1)= 63._RPP/256._RPP ! stencil 1 + c(2,2)= 105._RPP/128._RPP; c(1,2)= 105._RPP/256._RPP; c(0,2)= -7._RPP/256._RPP ! stencil 2 + c(2,3)= 75._RPP/128._RPP; c(1,3)= -25._RPP/256._RPP; c(0,3)= 3._RPP/256._RPP ! stencil 3 + c(2,4)= -35._RPP/128._RPP; c(1,4)= 21._RPP/256._RPP; c(0,4)= -3._RPP/256._RPP ! stencil 4 + c(2,5)= 63._RPP/128._RPP; c(1,5)= -45._RPP/256._RPP; c(0,5)= 7._RPP/256._RPP ! stencil 5 + case(7) ! 13th order + ! cell 6 ; cell 5 ; cell 4 + c(6,0)= 231._RPP/1024._RPP; c(5,0)= -819._RPP/512._RPP ; c(4,0)= 5005._RPP/1024._RPP ! stencil 0 + c(6,1)= -21._RPP/1024._RPP; c(5,1)= 77._RPP/512._RPP ; c(4,1)= -495._RPP/1024._RPP ! stencil 1 + c(6,2)= 7._RPP/1024._RPP; c(5,2)= -27._RPP/512._RPP ; c(4,2)= 189._RPP/1024._RPP ! stencil 2 + c(6,3)= -5._RPP/1024._RPP; c(5,3)= 21._RPP/512._RPP ; c(4,3)= -175._RPP/1024._RPP ! stencil 3 + c(6,4)= 7._RPP/1024._RPP; c(5,4)= -35._RPP/512._RPP ; c(4,4)= 525._RPP/1024._RPP ! stencil 4 + c(6,5)= -21._RPP/1024._RPP; c(5,5)= 189._RPP/512._RPP ; c(4,5)= 945._RPP/1024._RPP ! stencil 5 + c(6,6)= 231._RPP/1024._RPP; c(5,6)= 693._RPP/512._RPP ; c(4,6)=-1155._RPP/1024._RPP ! stencil 6 + ! cell 3 ; cell 2 ; cell 1 + c(3,0)=-2145._RPP/256._RPP ; c(2,0)= 9009._RPP/1024._RPP; c(1,0)=-3003._RPP/512._RPP ! stencil 0 + c(3,1)= 231._RPP/256._RPP ; c(2,1)=-1155._RPP/1024._RPP; c(1,1)= 693._RPP/512._RPP ! stencil 1 + c(3,2)= -105._RPP/256._RPP ; c(2,2)= 945._RPP/1024._RPP; c(1,2)= 189._RPP/512._RPP ! stencil 2 + c(3,3)= 175._RPP/256._RPP ; c(2,3)= 525._RPP/1024._RPP; c(1,3)= -35._RPP/512._RPP ! stencil 3 + c(3,4)= 175._RPP/256._RPP ; c(2,4)= -175._RPP/1024._RPP; c(1,4)= 21._RPP/512._RPP ! stencil 4 + c(3,5)= -105._RPP/256._RPP ; c(2,5)= 189._RPP/1024._RPP; c(1,5)= -27._RPP/512._RPP ! stencil 5 + c(3,6)= 231._RPP/256._RPP ; c(2,6)= -495._RPP/1024._RPP; c(1,6)= 77._RPP/512._RPP ! stencil 6 + ! cell 0 + c(0,0)= 3003._RPP/1024._RPP ! stencil 0 + c(0,1)= 231._RPP/1024._RPP ! stencil 1 + c(0,2)= -21._RPP/1024._RPP ! stencil 2 + c(0,3)= 7._RPP/1024._RPP ! stencil 3 + c(0,4)= -5._RPP/1024._RPP ! stencil 4 + c(0,5)= 7._RPP/1024._RPP ! stencil 5 + c(0,6)= -21._RPP/1024._RPP ! stencil 6 + case(8) ! 15th order + ! cell 7 ; cell 6 ; cell 5 + c(7,0)= -429._RPP/2048._RPP; c(6,0)= 3465._RPP/2048._RPP; c(5,0)=-12285._RPP/2048._RPP ! stencil 0 + c(7,1)= 33._RPP/2048._RPP; c(6,1)= -273._RPP/2048._RPP; c(5,1)= 1001._RPP/2048._RPP ! stencil 1 + c(7,2)= -9._RPP/2048._RPP; c(6,2)= 77._RPP/2048._RPP; c(5,2)= -297._RPP/2048._RPP ! stencil 2 + c(7,3)= 5._RPP/2048._RPP; c(6,3)= -45._RPP/2048._RPP; c(5,3)= 189._RPP/2048._RPP ! stencil 3 + c(7,4)= -5._RPP/2048._RPP; c(6,4)= 49._RPP/2048._RPP; c(5,4)= -245._RPP/2048._RPP ! stencil 4 + c(7,5)= 9._RPP/2048._RPP; c(6,5)= -105._RPP/2048._RPP; c(5,5)= 945._RPP/2048._RPP ! stencil 5 + c(7,6)= -33._RPP/2048._RPP; c(6,6)= 693._RPP/2048._RPP; c(5,6)= 2079._RPP/2048._RPP ! stencil 6 + c(7,7)= 429._RPP/2048._RPP; c(6,7)= 3003._RPP/2048._RPP; c(5,7)= -3003._RPP/2048._RPP ! stencil 7 + ! cell 4 ; cell 3 ; cell 2 + c(4,0)= 25025._RPP/2048._RPP; c(3,0)=-32175._RPP/2048._RPP; c(2,0)= 27027._RPP/2048._RPP ! stencil 0 + c(4,1)= -2145._RPP/2048._RPP; c(3,1)= 3003._RPP/2048._RPP; c(2,1)= -3003._RPP/2048._RPP ! stencil 1 + c(4,2)= 693._RPP/2048._RPP; c(3,2)= -1155._RPP/2048._RPP; c(2,2)= 2079._RPP/2048._RPP ! stencil 2 + c(4,3)= -525._RPP/2048._RPP; c(3,3)= 1575._RPP/2048._RPP; c(2,3)= 945._RPP/2048._RPP ! stencil 3 + c(4,4)= 1225._RPP/2048._RPP; c(3,4)= 1225._RPP/2048._RPP; c(2,4)= -245._RPP/2048._RPP ! stencil 4 + c(4,5)= 1575._RPP/2048._RPP; c(3,5)= -525._RPP/2048._RPP; c(2,5)= 189._RPP/2048._RPP ! stencil 5 + c(4,6)= -1155._RPP/2048._RPP; c(3,6)= 693._RPP/2048._RPP; c(2,6)= -297._RPP/2048._RPP ! stencil 6 + c(4,7)= 3003._RPP/2048._RPP; c(3,7)= -2145._RPP/2048._RPP; c(2,7)= 1001._RPP/2048._RPP ! stencil 7 + ! cell 1 ; cell 0 + c(1,0)=-15015._RPP/2048._RPP; c(0,0)= 6435._RPP/2048._RPP ! stencil 0 + c(1,1)= 3003._RPP/2048._RPP; c(0,1)= 429._RPP/2048._RPP ! stencil 1 + c(1,2)= 693._RPP/2048._RPP; c(0,2)= -33._RPP/2048._RPP ! stencil 2 + c(1,3)= -105._RPP/2048._RPP; c(0,3)= 9._RPP/2048._RPP ! stencil 3 + c(1,4)= 49._RPP/2048._RPP; c(0,4)= -5._RPP/2048._RPP ! stencil 4 + c(1,5)= -45._RPP/2048._RPP; c(0,5)= 5._RPP/2048._RPP ! stencil 5 + c(1,6)= 77._RPP/2048._RPP; c(0,6)= -9._RPP/2048._RPP ! stencil 6 + c(1,7)= -273._RPP/2048._RPP; c(0,7)= 33._RPP/2048._RPP ! stencil 7 + case(9) ! 17th order + ! cell 8 ; cell 7 ; cell 6 + c(8,0)= 6435._RPP/32768._RPP; c(7,0)= -7293._RPP/ 4096._RPP; c(6,0)= 58905._RPP/ 8192._RPP ! stencil 0 + c(8,1)= -429._RPP/32768._RPP; c(7,1)= 495._RPP/ 4096._RPP; c(6,1)= -4095._RPP/ 8192._RPP ! stencil 1 + c(8,2)= 99._RPP/32768._RPP; c(7,2)= -117._RPP/ 4096._RPP; c(6,2)= 1001._RPP/ 8192._RPP ! stencil 2 + c(8,3)= -45._RPP/32768._RPP; c(7,3)= 55._RPP/ 4096._RPP; c(6,3)= -495._RPP/ 8192._RPP ! stencil 3 + c(8,4)= 35._RPP/32768._RPP; c(7,4)= -45._RPP/ 4096._RPP; c(6,4)= 441._RPP/ 8192._RPP ! stencil 4 + c(8,5)= -45._RPP/32768._RPP; c(7,5)= 63._RPP/ 4096._RPP; c(6,5)= -735._RPP/ 8192._RPP ! stencil 5 + c(8,6)= 99._RPP/32768._RPP; c(7,6)= -165._RPP/ 4096._RPP; c(6,6)= 3465._RPP/ 8192._RPP ! stencil 6 + c(8,7)= -429._RPP/32768._RPP; c(7,7)= 1287._RPP/ 4096._RPP; c(6,7)= 9009._RPP/ 8192._RPP ! stencil 7 + c(8,8)= 6435._RPP/32768._RPP; c(7,8)= 6435._RPP/ 4096._RPP; c(6,8)= -15015._RPP/ 8192._RPP ! stencil 8 + ! cell 5 ; ! cell 4 ; cell 3 + c(5,0)= -69615._RPP/ 4096._RPP; c(4,0)= 425425._RPP/16384._RPP; c(3,0)=-109395._RPP/ 4096._RPP ! stencil 0 + c(5,1)= 5005._RPP/ 4096._RPP; c(4,1)= -32175._RPP/16384._RPP; c(3,1)= 9009._RPP/ 4096._RPP ! stencil 1 + c(5,2)= -1287._RPP/ 4096._RPP; c(4,2)= 9009._RPP/16384._RPP; c(3,2)= -3003._RPP/ 4096._RPP ! stencil 2 + c(5,3)= 693._RPP/ 4096._RPP; c(4,3)= -5775._RPP/16384._RPP; c(3,3)= 3465._RPP/ 4096._RPP ! stencil 3 + c(5,4)= -735._RPP/ 4096._RPP; c(4,4)= 11025._RPP/16384._RPP; c(3,4)= 2205._RPP/ 4096._RPP ! stencil 4 + c(5,5)= 2205._RPP/ 4096._RPP; c(4,5)= 11025._RPP/16384._RPP; c(3,5)= -735._RPP/ 4096._RPP ! stencil 5 + c(5,6)= 3465._RPP/ 4096._RPP; c(4,6)= -5775._RPP/16384._RPP; c(3,6)= 693._RPP/ 4096._RPP ! stencil 6 + c(5,7)= -3003._RPP/ 4096._RPP; c(4,7)= 9009._RPP/16384._RPP; c(3,7)= -1287._RPP/ 4096._RPP ! stencil 7 + c(5,8)= 9009._RPP/ 4096._RPP; c(4,8)= -32175._RPP/16384._RPP; c(3,8)= 5005._RPP/ 4096._RPP ! stencil 8 + ! cell 2 ; cell 1 ; cell 0 + c(2,0)= 153153._RPP/ 8192._RPP; c(1,0)= -36465._RPP/ 4096._RPP; c(0,0)= 109395._RPP/32768._RPP ! stencil 0 + c(2,1)= -15015._RPP/ 8192._RPP; c(1,1)= 6435._RPP/ 4096._RPP; c(0,1)= 6435._RPP/32768._RPP ! stencil 1 + c(2,2)= 9009._RPP/ 8192._RPP; c(1,2)= 1287._RPP/ 4096._RPP; c(0,2)= -429._RPP/32768._RPP ! stencil 2 + c(2,3)= 3465._RPP/ 8192._RPP; c(1,3)= -165._RPP/ 4096._RPP; c(0,3)= 99._RPP/32768._RPP ! stencil 3 + c(2,4)= -735._RPP/ 8192._RPP; c(1,4)= 63._RPP/ 4096._RPP; c(0,4)= -45._RPP/32768._RPP ! stencil 4 + c(2,5)= 441._RPP/ 8192._RPP; c(1,5)= -45._RPP/ 4096._RPP; c(0,5)= 35._RPP/32768._RPP ! stencil 5 + c(2,6)= -495._RPP/ 8192._RPP; c(1,6)= 55._RPP/ 4096._RPP; c(0,6)= -45._RPP/32768._RPP ! stencil 6 + c(2,7)= 1001._RPP/ 8192._RPP; c(1,7)= -117._RPP/ 4096._RPP; c(0,7)= 99._RPP/32768._RPP ! stencil 7 + c(2,8)= -4095._RPP/ 8192._RPP; c(1,8)= 495._RPP/ 4096._RPP; c(0,8)= -429._RPP/32768._RPP ! stencil 8 + endselect + else + ! internal point + allocate(f(0:S-1, 0:S-1)) + do k=0,S-1 !stencils loop + c_sum = 0._RPP + do j=0,S-2 !values loop + prod = 1._RPP + do i=0,S-1 + if (i==j) cycle + prod = prod * ((x_target - stencil(-S+k+i+1)) / (stencil(-S+k+j+1) - stencil(-S+k+i+1))) + enddo + f(j,k) = prod + c_sum = c_sum + prod + enddo + f(S-1,k) = 1._RPP - c_sum + enddo + do k=0,S-1 + do j=0,S-1 + c(j,k) = f(S-1-j,k) + enddo + enddo + endif + endassociate + endselect + endsubroutine create + + pure subroutine compute_with_stencil_of_rank_1(self, stencil) + !< Compute interpolations. + class(interpolations_int_js), intent(inout) :: self !< Interpolations. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + integer(I_P) :: s1 !< Counter. + integer(I_P) :: s2 !< Counter. + + associate(val => self%values_rank_1) + val = 0._RPP + do s1=0, self%S - 1 ! stencils loop + do s2=0, self%S - 1 ! values loop + val(s1) = val(s1) + self%coef(s2, s1) * stencil(-s2 + s1) + enddo + enddo + endassociate + endsubroutine compute_with_stencil_of_rank_1 + + pure subroutine compute_with_stencil_of_rank_2(self, stencil) + !< Compute interpolations. + class(interpolations_int_js), intent(inout) :: self !< Interpolations. + real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. + + ! Empty Subroutine. + endsubroutine compute_with_stencil_of_rank_2 + + pure function description(self) result(string) + !< Return interpolations string-description. + class(interpolations_int_js), intent(in) :: self !< Interpolations. + character(len=:), allocatable :: string !< String-description. + +#ifndef DEBUG + ! error stop in pure procedure is a F2015 feature not yet supported in debug mode + error stop 'interpolations_int_js%description to be implemented, do not use!' +#endif + endfunction description + + elemental subroutine destroy(self) + !< Destroy interpolations. + class(interpolations_int_js), intent(inout) :: self !< Interpolations. + + call self%destroy_ + if (allocated(self%values_rank_1)) deallocate(self%values_rank_1) + if (allocated(self%coef)) deallocate(self%coef) + endsubroutine destroy +endmodule wenoof_interpolations_int_js diff --git a/src/lib/concrete_objects/wenoof_interpolations_rec_js.F90 b/src/lib/concrete_objects/wenoof_interpolations_rec_js.F90 index 3d93214..105792d 100644 --- a/src/lib/concrete_objects/wenoof_interpolations_rec_js.F90 +++ b/src/lib/concrete_objects/wenoof_interpolations_rec_js.F90 @@ -35,10 +35,11 @@ module wenoof_interpolations_rec_js real(RPP), allocatable :: coef(:,:,:) !< Polynomial coefficients [1:2,0:S-1,0:S-1]. contains ! public deferred methods - procedure, pass(self) :: create !< Create interpolations. - procedure, pass(self) :: compute !< Compute interpolations. - procedure, pass(self) :: description !< Return interpolations string-description. - procedure, pass(self) :: destroy !< Destroy interpolations. + procedure, pass(self) :: create !< Create interpolations. + procedure, pass(self) :: compute_with_stencil_of_rank_1 !< Compute interpolations. + procedure, pass(self) :: compute_with_stencil_of_rank_2 !< Compute interpolations. + procedure, pass(self) :: description !< Return interpolations string-description. + procedure, pass(self) :: destroy !< Destroy interpolations. endtype interpolations_rec_js contains @@ -50,8 +51,8 @@ subroutine create(self, constructor) call self%destroy call self%create_(constructor=constructor) - allocate(self%values(1:2, 0:self%S - 1)) - self%values = 0._RPP + allocate(self%values_rank_2(1:2, 0:self%S - 1)) + self%values_rank_2 = 0._RPP allocate(self%coef(1:2, 0:self%S - 1, 0:self%S - 1)) associate(c => self%coef) select case(self%S) @@ -450,7 +451,15 @@ subroutine create(self, constructor) endassociate endsubroutine create - pure subroutine compute(self, stencil) + pure subroutine compute_with_stencil_of_rank_1(self, stencil) + !< Compute interpolations. + class(interpolations_rec_js), intent(inout) :: self !< Interpolations. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + + ! Empty Subroutine. + endsubroutine compute_with_stencil_of_rank_1 + + pure subroutine compute_with_stencil_of_rank_2(self, stencil) !< Compute interpolations. class(interpolations_rec_js), intent(inout) :: self !< Interpolations. real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. @@ -458,15 +467,17 @@ pure subroutine compute(self, stencil) integer(I_P) :: s2 !< Counter. integer(I_P) :: f !< Counter. - self%values = 0._RPP + associate(val => self%values_rank_2) + val = 0._RPP do s1=0, self%S - 1 ! stencils loop do s2=0, self%S - 1 ! values loop - do f=self%f1, self%f2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) - self%values(f, s1) = self%values(f, s1) + self%coef(f, s2, s1) * stencil(f + self%ff, -s2 + s1) + do f=1, 2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) + val(f, s1) = val(f, s1) + self%coef(f, s2, s1) * stencil(f, -s2 + s1) enddo enddo enddo - endsubroutine compute + endassociate + endsubroutine compute_with_stencil_of_rank_2 pure function description(self) result(string) !< Return interpolations string-description. @@ -484,7 +495,7 @@ elemental subroutine destroy(self) class(interpolations_rec_js), intent(inout) :: self !< Interpolations. call self%destroy_ - if (allocated(self%values)) deallocate(self%values) + if (allocated(self%values_rank_2)) deallocate(self%values_rank_2) if (allocated(self%coef)) deallocate(self%coef) endsubroutine destroy endmodule wenoof_interpolations_rec_js diff --git a/src/lib/concrete_objects/wenoof_interpolator_js.F90 b/src/lib/concrete_objects/wenoof_interpolator_js.F90 index 3e9109c..05d3b1e 100644 --- a/src/lib/concrete_objects/wenoof_interpolator_js.F90 +++ b/src/lib/concrete_objects/wenoof_interpolator_js.F90 @@ -4,11 +4,16 @@ module wenoof_interpolator_js use, intrinsic :: iso_fortran_env, only : stderr=>error_unit #ifdef r16p -use penf, only: RPP=>R16P +use penf, only: I_P, RPP=>R16P, str #else -use penf, only: RPP=>R8P +use penf, only: I_P, RPP=>R8P, str #endif +use wenoof_base_object +use wenoof_interpolations_factory +use wenoof_interpolations_object use wenoof_interpolator_object +use wenoof_weights_factory +use wenoof_weights_object implicit none private @@ -21,51 +26,106 @@ module wenoof_interpolator_js type, extends(interpolator_object) :: interpolator_js !< Jiang-Shu (upwind) interpolator object. + !< + !< @note Provide the *High Order Weighted Essentially Nonoscillatory Schemes for Convection Dominated Problems*, + !< Chi-Wang Shu, SIAM Review, 2009, vol. 51, pp. 82--126, doi:10.1137/070679065. + !< + !< @note The supported accuracy formal order are: 3rd, 5th, 7th, 9th, 11th, 13th, 15th, 17th corresponding to use 2, 3, 4, 5, 6, + !< 7, 8, 9 stencils composed of 2, 3, 4, 5, 6, 7, 8, 9 values, respectively. contains ! public deferred methods - procedure, pass(self) :: description !< Return interpolator string-description. - procedure, pass(self) :: interpolate_standard !< Interpolate values (without providing debug values). - procedure, pass(self) :: interpolate_debug !< Interpolate values (providing also debug values). + procedure, pass(self) :: create !< Create interpolator. + procedure, pass(self) :: description !< Return interpolator string-description. + procedure, pass(self) :: destroy !< Destroy interpolator. + procedure, pass(self) :: interpolate_with_stencil_of_rank_1_standard !< Interpolate values (without providing debug values). + procedure, pass(self) :: interpolate_with_stencil_of_rank_2_standard !< Interpolate values (without providing debug values). + procedure, pass(self) :: interpolate_with_stencil_of_rank_1_debug !< Interpolate values (providing also debug values). + procedure, pass(self) :: interpolate_with_stencil_of_rank_2_debug !< Interpolate values (providing also debug values). endtype interpolator_js contains ! public deferred methods + subroutine create(self, constructor) + !< Create interpolator. + class(interpolator_js), intent(inout) :: self !< Interpolator. + class(base_object_constructor), intent(in) :: constructor !< Constructor. + type(interpolations_factory) :: i_factory !< Inteprolations factory. + type(weights_factory) :: w_factory !< Weights factory. + + call self%destroy + call self%create_(constructor=constructor) + select type(constructor) + class is(interpolator_object_constructor) + call i_factory%create(constructor=constructor%interpolations_constructor, object=self%interpolations) + call w_factory%create(constructor=constructor%weights_constructor, object=self%weights) + endselect + endsubroutine create + pure function description(self) result(string) !< Return interpolator string-descripition. class(interpolator_js), intent(in) :: self !< Interpolator. character(len=:), allocatable :: string !< String-description. character(len=1), parameter :: nl=new_line('a') !< New line character. - character(len=:), allocatable :: dummy_string !< Dummy string. -#ifndef DEBUG - ! error stop in pure procedure is a F2015 feature not yet supported in debug mode - error stop 'interpolator_js to be implemented, do not use!' -#endif + string = 'Jiang-Shu reconstructor:'//nl + string = string//' - S = '//trim(str(self%S))//nl + string = string//self%weights%description() endfunction description - pure subroutine interpolate_standard(self, stencil, interpolation) - !< Interpolate values (without providing debug values). - class(interpolator_js), intent(inout) :: self !< Interpolator. - real(RPP), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S]. - real(RPP), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2]. + elemental subroutine destroy(self) + !< Destroy interpolator. + class(interpolator_js), intent(inout) :: self !< Interpolator. -#ifndef DEBUG - ! error stop in pure procedure is a F2015 feature not yet supported in debug mode - error stop 'interpolator_js to be implemented, do not use!' -#endif - endsubroutine interpolate_standard + call self%destroy_ + if (allocated(self%interpolations)) deallocate(self%interpolations) + if (allocated(self%weights)) deallocate(self%weights) + endsubroutine destroy - pure subroutine interpolate_debug(self, stencil, interpolation, si, weights) + pure subroutine interpolate_with_stencil_of_rank_1_debug(self, stencil, interpolation, si, weights) !< Interpolate values (providing also debug values). - class(interpolator_js), intent(inout) :: self !< Interpolator. + class(interpolator_js), intent(inout) :: self !< Interpolator. + real(RPP), intent(in) :: stencil(1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S]. + real(RPP), intent(out) :: interpolation !< Result of the interpolation. + real(RPP), intent(out) :: si(0:) !< Computed values of smoothness indicators [1:2, 0:S-1]. + real(RPP), intent(out) :: weights(0:) !< Weights of the stencils, [1:2, 0:S-1]. + + call self%interpolate(stencil=stencil, interpolation=interpolation) + call self%weights%smoothness_indicators_of_rank_1(si=si) + weights = self%weights%values_rank_1 + endsubroutine interpolate_with_stencil_of_rank_1_debug + + pure subroutine interpolate_with_stencil_of_rank_2_debug(self, stencil, interpolation, si, weights) + !< Interpolate values (providing also debug values). + class(interpolator_js), intent(inout) :: self !< Reconstructor. + real(RPP), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S]. + real(RPP), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2]. + real(RPP), intent(out) :: si(1:, 0:) !< Computed values of smoothness indicators [1:2, 0:S-1]. + real(RPP), intent(out) :: weights(1:, 0:) !< Weights of the stencils, [1:2, 0:S-1]. + + ! Empty subroutine. + endsubroutine interpolate_with_stencil_of_rank_2_debug + + pure subroutine interpolate_with_stencil_of_rank_1_standard(self, stencil, interpolation) + !< Interpolate values (without providing debug values). + class(interpolator_js), intent(inout) :: self !< Interpolator. + real(RPP), intent(in) :: stencil(1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S]. + real(RPP), intent(out) :: interpolation !< Result of the interpolation. + integer(I_P) :: s !< Counters. + + call self%interpolations%compute(stencil=stencil) + call self%weights%compute(stencil=stencil) + interpolation = 0._RPP + do s=0, self%S - 1 ! stencils loop + interpolation = interpolation + self%weights%values_rank_1(s) * self%interpolations%values_rank_1(s) + enddo + endsubroutine interpolate_with_stencil_of_rank_1_standard + + pure subroutine interpolate_with_stencil_of_rank_2_standard(self, stencil, interpolation) + !< Interpolate values (without providing debug values). + class(interpolator_js), intent(inout) :: self !< Reconstructor. real(RPP), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S]. real(RPP), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2]. - real(RPP), intent(out) :: si(1:, 0:) !< Computed values of smoothness indicators [1:2, 0:S-1]. - real(RPP), intent(out) :: weights(1:, 0:) !< Weights of the stencils, [1:2, 0:S-1]. -#ifndef DEBUG - ! error stop in pure procedure is a F2015 feature not yet supported in debug mode - error stop 'interpolator_js to be implemented, do not use!' -#endif - endsubroutine interpolate_debug + ! Empty subroutine. + endsubroutine interpolate_with_stencil_of_rank_2_standard endmodule wenoof_interpolator_js diff --git a/src/lib/concrete_objects/wenoof_kappa_int_js.F90 b/src/lib/concrete_objects/wenoof_kappa_int_js.F90 new file mode 100644 index 0000000..8226436 --- /dev/null +++ b/src/lib/concrete_objects/wenoof_kappa_int_js.F90 @@ -0,0 +1,258 @@ +!< Jiang-Shu and Gerolymos-Senechal-Vallet kappa coefficients for interpolation. +module wenoof_kappa_int_js +!< Jiang-Shu and Gerolymos-Senechal-Vallet kappa coefficients for interpolation. +!< +!< @note The provided WENO kappa implements the linear weights defined in *High Order Weighted Essentially +!< Nonoscillatory Schemes for Convection Dominated Problems*, Chi-Wang Shu, SIAM Review, 2009, vol. 51, pp. 82--126, +!< doi:10.1137/070679065. + +#ifdef r16p +use penf, only: I_P, RPP=>R16P +#else +use penf, only: I_P, RPP=>R8P +#endif +use wenoof_base_object +use wenoof_interpolations_factory +use wenoof_interpolations_object +use wenoof_interpolations_int_js +use wenoof_kappa_object + +implicit none +private +public :: kappa_int_js +public :: kappa_int_js_constructor + +type, extends(kappa_object_constructor) :: kappa_int_js_constructor + !< Jiang-Shu and Gerolymos-Senechal-Vallet optimal kappa object constructor. + class(interpolations_object_constructor), allocatable :: interpolations_constructor !< interpolations coefficients constructor. +endtype kappa_int_js_constructor + +type, extends(kappa_object):: kappa_int_js + !< Jiang-Shu and Gerolymos-Senechal-Vallet kappa object. + !< + !< @note The provided WENO kappa implements the linear weights defined in *High Order Weighted Essentially + !< Nonoscillatory Schemes for Convection Dominated Problems*, Chi-Wang Shu, SIAM Review, 2009, vol. 51, pp. 82--126, + !< doi:10.1137/070679065. + class(interpolations_object), allocatable :: interpolations !< interpolations coefficients. + contains + ! public deferred methods + procedure, pass(self) :: create !< Create kappa. + procedure, pass(self) :: compute_kappa_rec !< Compute kappa. + procedure, pass(self) :: compute_kappa_int !< Compute kappa. + procedure, pass(self) :: description !< Return kappa string-description. + procedure, pass(self) :: destroy !< Destroy kappa. +endtype kappa_int_js + +contains + ! deferred public methods + subroutine create(self, constructor) + !< Create kappa. + !< + !< @note The kappa coefficients are also computed, they being constants. + class(kappa_int_js), intent(inout) :: self !< Kappa. + class(base_object_constructor), intent(in) :: constructor !< Kappa constructor. + type(interpolations_factory) :: i_factory !< Interpolations factory. + + call self%destroy + call self%create_(constructor=constructor) + allocate(self%values_rank_1(0:self%S - 1)) + self%values_rank_1 = 0._RPP + select type(constructor) + type is(kappa_int_js_constructor) + associate(interpolations_constructor=>constructor%interpolations_constructor) + call i_factory%create(constructor=interpolations_constructor, object=self%interpolations) + call self%compute(stencil=constructor%stencil, x_target=constructor%x_target) + endassociate + endselect + endsubroutine create + + pure subroutine compute_kappa_rec(self) + !< Compute kappa. + class(kappa_int_js), intent(inout) :: self !< Kappa. + + ! Empty subroutine + endsubroutine compute_kappa_rec + + pure subroutine compute_kappa_int(self, stencil, x_target) + !< Compute kappa. + class(kappa_int_js), intent(inout) :: self !< Kappa. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for interpolation, [1-S:S-1]. + real(RPP), intent(in) :: x_target !< Coordinate of the interpolation point. + real(RPP) :: coeff(0:2*self%S-2) !< Interpolation coefficients on the whole stencil. + real(RPP) :: coef(0:self%S-1,0:self%S-1) !< Temporary variable. + real(RPP) :: prod !< Temporary variable. + real(RPP) :: coeff_t !< Temporary variable. + real(RPP) :: val_sum !< Temporary variable. + integer(I_P) :: i, j, k !< Counters. + + associate(S => self%S, val => self%values_rank_1, interp => self%interpolations) + if(x_target==-0.5_RPP) then + ! left interface (i-1/2) + select case(S) + case(2) ! 3rd order + val(0) = 3._RPP/4._RPP ! stencil 0 + val(1) = 1._RPP/4._RPP ! stencil 1 + case(3) ! 5th order + val(0) = 5._RPP/16._RPP ! stencil 0 + val(1) = 5._RPP/8._RPP ! stencil 1 + val(2) = 1._RPP/16._RPP ! stencil 2 + case(4) ! 7th order + val(0) = 7._RPP/64._RPP ! stencil 0 + val(1) = 35._RPP/64._RPP ! stencil 1 + val(2) = 21._RPP/64._RPP ! stencil 2 + val(3) = 1._RPP/64._RPP ! stencil 3 + case(5) ! 9th order + val(0) = 9._RPP/256._RPP ! stencil 0 + val(1) = 21._RPP/64._RPP ! stencil 1 + val(2) = 63._RPP/128._RPP ! stencil 2 + val(3) = 9._RPP/64._RPP ! stencil 3 + val(4) = 1._RPP/256._RPP ! stencil 4 + case(6) ! 11th order + val(0) = 11._RPP/1024._RPP ! stencil 0 + val(1) = 165._RPP/1024._RPP ! stencil 1 + val(2) = 231._RPP/512._RPP ! stencil 2 + val(3) = 165._RPP/512._RPP ! stencil 3 + val(4) = 55._RPP/1024._RPP ! stencil 4 + val(5) = 1._RPP/1024._RPP ! stencil 5 + case(7) ! 13th order + val(0) = 13._RPP/4096._RPP ! stencil 0 + val(1) = 143._RPP/2048._RPP ! stencil 1 + val(2) = 1287._RPP/4096._RPP ! stencil 2 + val(3) = 429._RPP/1024._RPP ! stencil 3 + val(4) = 179._RPP/1024._RPP ! stencil 4 + val(5) = 39._RPP/2048._RPP ! stencil 5 + val(6) = 1._RPP/4096._RPP ! stencil 6 + case(8) ! 15th order + val(0) = 15._RPP/16384._RPP ! stencil 0 + val(1) = 455._RPP/16384._RPP ! stencil 1 + val(2) = 3003._RPP/16384._RPP ! stencil 2 + val(3) = 6435._RPP/16384._RPP ! stencil 3 + val(4) = 5005._RPP/16384._RPP ! stencil 4 + val(5) = 1365._RPP/16384._RPP ! stencil 5 + val(6) = 105._RPP/16384._RPP ! stencil 6 + val(7) = 1._RPP/16384._RPP ! stencil 7 + case(9) ! 17th order + val(0) = 17._RPP/65536._RPP ! stencil 0 + val(1) = 85._RPP/8192._RPP ! stencil 1 + val(2) = 1547._RPP/16384._RPP ! stencil 2 + val(3) = 2431._RPP/8192._RPP ! stencil 3 + val(4) = 12155._RPP/32768._RPP ! stencil 4 + val(5) = 1547._RPP/8192._RPP ! stencil 5 + val(6) = 595._RPP/16384._RPP ! stencil 6 + val(7) = 17._RPP/8192._RPP ! stencil 7 + val(8) = 1._RPP/65536._RPP ! stencil 8 + endselect + elseif(x_target==0.5_RPP) then + ! right interface (i+1/2) + select case(S) + case(2) ! 3rd order + val(0) = 1._RPP/4._RPP ! stencil 0 + val(1) = 3._RPP/4._RPP ! stencil 1 + case(3) ! 5th order + val(0) = 1._RPP/16._RPP ! stencil 0 + val(1) = 5._RPP/8._RPP ! stencil 1 + val(2) = 5._RPP/16._RPP ! stencil 2 + case(4) ! 7th order + val(0) = 1._RPP/64._RPP ! stencil 0 + val(1) = 21._RPP/64._RPP ! stencil 1 + val(2) = 35._RPP/64._RPP ! stencil 2 + val(3) = 7._RPP/64._RPP ! stencil 3 + case(5) ! 9th order + val(0) = 1._RPP/256._RPP ! stencil 0 + val(1) = 9._RPP/64._RPP ! stencil 1 + val(2) = 63._RPP/128._RPP ! stencil 2 + val(3) = 21._RPP/64._RPP ! stencil 3 + val(4) = 9._RPP/256._RPP ! stencil 4 + case(6) ! 11th order + val(0) = 1._RPP/1024._RPP ! stencil 0 + val(1) = 55._RPP/1024._RPP ! stencil 1 + val(2) = 165._RPP/512._RPP ! stencil 2 + val(3) = 231._RPP/512._RPP ! stencil 3 + val(4) = 165._RPP/1024._RPP ! stencil 4 + val(5) = 11._RPP/1024._RPP ! stencil 5 + case(7) ! 13th order + val(0) = 1._RPP/4096._RPP ! stencil 0 + val(1) = 39._RPP/2048._RPP ! stencil 1 + val(2) = 179._RPP/1024._RPP ! stencil 2 + val(3) = 429._RPP/1024._RPP ! stencil 3 + val(4) = 1287._RPP/4096._RPP ! stencil 4 + val(5) = 143._RPP/2048._RPP ! stencil 5 + val(6) = 13._RPP/4096._RPP ! stencil 6 + case(8) ! 15th order + val(0) = 1._RPP/16384._RPP ! stencil 0 + val(1) = 105._RPP/16384._RPP ! stencil 1 + val(2) = 1365._RPP/16384._RPP ! stencil 2 + val(3) = 5005._RPP/16384._RPP ! stencil 3 + val(4) = 6435._RPP/16384._RPP ! stencil 4 + val(5) = 3003._RPP/16384._RPP ! stencil 5 + val(6) = 455._RPP/16384._RPP ! stencil 6 + val(7) = 15._RPP/16384._RPP ! stencil 7 + case(9) ! 17th order + val(0) = 1._RPP/65536._RPP ! stencil 0 + val(1) = 17._RPP/8192._RPP ! stencil 1 + val(2) = 595._RPP/16384._RPP ! stencil 2 + val(3) = 1547._RPP/8192._RPP ! stencil 3 + val(4) = 12155._RPP/32768._RPP ! stencil 4 + val(5) = 2431._RPP/8192._RPP ! stencil 5 + val(6) = 1547._RPP/16384._RPP ! stencil 6 + val(7) = 85._RPP/8192._RPP ! stencil 7 + val(8) = 17._RPP/65536._RPP ! stencil 8 + endselect + elseif(x_target==0._RPP) then + val = 1._RPP / S + else + ! internal point + val_sum = 0._RPP + do j=0,2*S-3 !values loop + prod = 1._RPP + do i=0,2*S-2 + if (i==j) cycle + prod = prod * ((x_target - stencil(-S+i+1)) / (stencil(-S+j+1) - stencil(-S+i+1))) + enddo + coeff(j) = prod + val_sum = val_sum + coeff(j) + enddo + coeff(2*S-2) = 1._RPP - val_sum + select type(interp) + type is(interpolations_int_js) + val_sum = 0._RPP + do k=0,S-1 + do j=0,S-1 + coef(j,k) = interp%coef(S-1-j,S-1-k) + enddo + enddo + do j = 0,S-2 + coeff_t = 0._RPP + k = j + do i = 0,j-1 + coeff_t = coeff_t + val(i) * coef(k,i) + k = k - 1 + enddo + val(j) = (coeff(j) - coeff_t) / coef(0,j) + val_sum = val_sum + val(j) + enddo + val(S-1) = 1._RPP - val_sum + endselect + endif + endassociate + endsubroutine compute_kappa_int + + pure function description(self) result(string) + !< Return string-description of kappa. + class(kappa_int_js), intent(in) :: self !< Kappa. + character(len=:), allocatable :: string !< String-description. + +#ifndef DEBUG + ! error stop in pure procedure is a F2015 feature not yet supported in debug mode + error stop 'kappa_int_js%description to be implemented, do not use!' +#endif + endfunction description + + elemental subroutine destroy(self) + !< Destroy kappa. + class(kappa_int_js), intent(inout) :: self !< Kappa. + + call self%destroy_ + if (allocated(self%values_rank_1)) deallocate(self%values_rank_1) + endsubroutine destroy +endmodule wenoof_kappa_int_js diff --git a/src/lib/concrete_objects/wenoof_kappa_rec_js.F90 b/src/lib/concrete_objects/wenoof_kappa_rec_js.F90 index 20b896c..fe7a975 100644 --- a/src/lib/concrete_objects/wenoof_kappa_rec_js.F90 +++ b/src/lib/concrete_objects/wenoof_kappa_rec_js.F90 @@ -31,12 +31,14 @@ module wenoof_kappa_rec_js !< Schemes*, Guang-Shan Jiang, Chi-Wang Shu, JCP, 1996, vol. 126, pp. 202--228, doi:10.1006/jcph.1996.0130 and !< *Very-high-order weno schemes*, G. A. Gerolymos, D. Senechal, I. Vallet, JCP, 2009, vol. 228, pp. 8481-8524, !< doi:10.1016/j.jcp.2009.07.039 + real(RPP), allocatable :: values(:,:) !< Kappa coefficients values [1:2,0:S-1]. contains ! public deferred methods - procedure, pass(self) :: create !< Create kappa. - procedure, pass(self) :: compute !< Compute kappa. - procedure, pass(self) :: description !< Return kappa string-description. - procedure, pass(self) :: destroy !< Destroy kappa. + procedure, pass(self) :: create !< Create kappa. + procedure, pass(self) :: compute_kappa_rec !< Compute kappa. + procedure, pass(self) :: compute_kappa_int !< Compute kappa. + procedure, pass(self) :: description !< Return kappa string-description. + procedure, pass(self) :: destroy !< Destroy kappa. endtype kappa_rec_js contains @@ -50,16 +52,16 @@ subroutine create(self, constructor) call self%destroy call self%create_(constructor=constructor) - allocate(self%values(1:2, 0:self%S - 1)) - self%values = 0._RPP + allocate(self%values_rank_2(1:2, 0:self%S - 1)) + self%values_rank_2 = 0._RPP call self%compute endsubroutine create - pure subroutine compute(self) + pure subroutine compute_kappa_rec(self) !< Compute kappa. class(kappa_rec_js), intent(inout) :: self !< Kappa. - associate(val => self%values) + associate(val => self%values_rank_2) select case(self%S) case(2) ! 3rd order ! 1 => left interface (i-1/2) @@ -175,7 +177,16 @@ pure subroutine compute(self) val(2, 8) = 9._RPP/24310._RPP ! stencil 8 endselect endassociate - endsubroutine compute + endsubroutine compute_kappa_rec + + pure subroutine compute_kappa_int(self, stencil, x_target) + !< Compute kappa. + class(kappa_rec_js), intent(inout) :: self !< Kappa. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for interpolation, [1-S:S-1]. + real(RPP), intent(in) :: x_target !< Coordinate of the interpolation point. + + ! Empty Subroutine + endsubroutine compute_kappa_int pure function description(self) result(string) !< Return string-description of kappa. @@ -193,6 +204,6 @@ elemental subroutine destroy(self) class(kappa_rec_js), intent(inout) :: self !< Kappa. call self%destroy_ - if (allocated(self%values)) deallocate(self%values) + if (allocated(self%values_rank_2)) deallocate(self%values_rank_2) endsubroutine destroy endmodule wenoof_kappa_rec_js diff --git a/src/lib/concrete_objects/wenoof_reconstructor_js.F90 b/src/lib/concrete_objects/wenoof_reconstructor_js.F90 index 8ec06bb..171cfdd 100644 --- a/src/lib/concrete_objects/wenoof_reconstructor_js.F90 +++ b/src/lib/concrete_objects/wenoof_reconstructor_js.F90 @@ -34,18 +34,20 @@ module wenoof_reconstructor_js !< 7, 8, 9 stencils composed of 2, 3, 4, 5, 6, 7, 8, 9 values, respectively. contains ! public deferred methods - procedure, pass(self) :: create !< Create reconstructor. - procedure, pass(self) :: description !< Return reconstructor string-description. - procedure, pass(self) :: destroy !< Destroy reconstructor. - procedure, pass(self) :: interpolate_debug !< Interpolate values (providing also debug values). - procedure, pass(self) :: interpolate_standard !< Interpolate values (without providing debug values). + procedure, pass(self) :: create !< Create reconstructor. + procedure, pass(self) :: description !< Return reconstructor string-description. + procedure, pass(self) :: destroy !< Destroy reconstructor. + procedure, pass(self) :: interpolate_with_stencil_of_rank_1_standard !< Interpolate values (without providing debug values). + procedure, pass(self) :: interpolate_with_stencil_of_rank_2_standard !< Interpolate values (without providing debug values). + procedure, pass(self) :: interpolate_with_stencil_of_rank_1_debug !< Interpolate values (providing also debug values). + procedure, pass(self) :: interpolate_with_stencil_of_rank_2_debug !< Interpolate values (providing also debug values). endtype reconstructor_js contains ! public deferred methods subroutine create(self, constructor) - !< Create interpolator. - class(reconstructor_js), intent(inout) :: self !< Interpolator. + !< Create reconstructor. + class(reconstructor_js), intent(inout) :: self !< Reconstructor. class(base_object_constructor), intent(in) :: constructor !< Constructor. type(interpolations_factory) :: i_factory !< Inteprolations factory. type(weights_factory) :: w_factory !< Weights factory. @@ -67,9 +69,6 @@ pure function description(self) result(string) string = 'Jiang-Shu reconstructor:'//nl string = string//' - S = '//trim(str(self%S))//nl - string = string//' - f1 = '//trim(str(self%f1))//nl - string = string//' - f2 = '//trim(str(self%f2))//nl - string = string//' - ff = '//trim(str(self%ff))//nl string = string//self%weights%description() endfunction description @@ -82,7 +81,18 @@ elemental subroutine destroy(self) if (allocated(self%weights)) deallocate(self%weights) endsubroutine destroy - pure subroutine interpolate_debug(self, stencil, interpolation, si, weights) + pure subroutine interpolate_with_stencil_of_rank_1_debug(self, stencil, interpolation, si, weights) + !< Interpolate values (providing also debug values). + class(reconstructor_js), intent(inout) :: self !< Reconstructor. + real(RPP), intent(in) :: stencil(1 - self%S:) !< Stencil of the interpolation [1-S:-1+S]. + real(RPP), intent(out) :: interpolation !< Result of the interpolation. + real(RPP), intent(out) :: si(0:) !< Computed values of smoothness indicators [0:S-1]. + real(RPP), intent(out) :: weights(0:) !< Weights of the stencils, [0:S-1]. + + ! Empty subroutine. + endsubroutine interpolate_with_stencil_of_rank_1_debug + + pure subroutine interpolate_with_stencil_of_rank_2_debug(self, stencil, interpolation, si, weights) !< Interpolate values (providing also debug values). class(reconstructor_js), intent(inout) :: self !< Reconstructor. real(RPP), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S]. @@ -90,12 +100,22 @@ pure subroutine interpolate_debug(self, stencil, interpolation, si, weights) real(RPP), intent(out) :: si(1:, 0:) !< Computed values of smoothness indicators [1:2, 0:S-1]. real(RPP), intent(out) :: weights(1:, 0:) !< Weights of the stencils, [1:2, 0:S-1]. - call self%interpolate_standard(stencil=stencil, interpolation=interpolation) - si = self%weights%smoothness_indicators() - weights = self%weights%values - endsubroutine interpolate_debug + call self%interpolate(stencil=stencil, interpolation=interpolation) + call self%weights%smoothness_indicators_of_rank_2(si=si) + !si = self%weights%smoothness_indicators() + weights = self%weights%values_rank_2 + endsubroutine interpolate_with_stencil_of_rank_2_debug + + pure subroutine interpolate_with_stencil_of_rank_1_standard(self, stencil, interpolation) + !< Interpolate values (without providing debug values). + class(reconstructor_js), intent(inout) :: self !< Reconstructor. + real(RPP), intent(in) :: stencil(1 - self%S:) !< Stencil of the interpolation [1-S:-1+S]. + real(RPP), intent(out) :: interpolation !< Result of the interpolation. + + ! Empty subroutine. + endsubroutine interpolate_with_stencil_of_rank_1_standard - pure subroutine interpolate_standard(self, stencil, interpolation) + pure subroutine interpolate_with_stencil_of_rank_2_standard(self, stencil, interpolation) !< Interpolate values (without providing debug values). class(reconstructor_js), intent(inout) :: self !< Reconstructor. real(RPP), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S]. @@ -106,10 +126,9 @@ pure subroutine interpolate_standard(self, stencil, interpolation) call self%weights%compute(stencil=stencil) interpolation = 0._RPP do s=0, self%S - 1 ! stencils loop - do f=self%f1, self%f2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) - interpolation(f + self%ff) = interpolation(f + self%ff) + & - self%weights%values(f + self%ff, s) * self%interpolations%values(f, s) + do f=1, 2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) + interpolation(f) = interpolation(f) + self%weights%values_rank_2(f, s) * self%interpolations%values_rank_2(f, s) enddo enddo - endsubroutine interpolate_standard + endsubroutine interpolate_with_stencil_of_rank_2_standard endmodule wenoof_reconstructor_js diff --git a/src/lib/concrete_objects/wenoof_weights_js.F90 b/src/lib/concrete_objects/wenoof_weights_int_js.F90 similarity index 60% rename from src/lib/concrete_objects/wenoof_weights_js.F90 rename to src/lib/concrete_objects/wenoof_weights_int_js.F90 index cd66b64..cc4a7d2 100644 --- a/src/lib/concrete_objects/wenoof_weights_js.F90 +++ b/src/lib/concrete_objects/wenoof_weights_int_js.F90 @@ -1,5 +1,5 @@ !< Jiang-Shu and Gerolymos-Senechal-Vallet weights. -module wenoof_weights_js +module wenoof_weights_int_js !< Jiang-Shu and Gerolymos-Senechal-Vallet weights. !< !< @note The provided WENO weights implements the weights defined in *Efficient Implementation of Weighted ENO @@ -14,54 +14,56 @@ module wenoof_weights_js #endif use wenoof_alpha_factory use wenoof_alpha_object -use wenoof_alpha_rec_js -use wenoof_alpha_rec_m -use wenoof_alpha_rec_z +use wenoof_alpha_int_js +use wenoof_alpha_int_m +use wenoof_alpha_int_z use wenoof_base_object use wenoof_beta_factory use wenoof_beta_object -use wenoof_beta_rec_js +use wenoof_beta_int_js use wenoof_kappa_factory use wenoof_kappa_object -use wenoof_kappa_rec_js +use wenoof_kappa_int_js use wenoof_weights_object implicit none private -public :: weights_js -public :: weights_js_constructor +public :: weights_int_js +public :: weights_int_js_constructor -type, extends(weights_object_constructor) :: weights_js_constructor +type, extends(weights_object_constructor) :: weights_int_js_constructor !< Jiang-Shu and Gerolymos-Senechal-Vallet optimal weights object constructor. class(alpha_object_constructor), allocatable :: alpha_constructor !< Alpha coefficients (non linear weights) constructor. class(beta_object_constructor), allocatable :: beta_constructor !< Beta coefficients (smoothness indicators) constructor. class(kappa_object_constructor), allocatable :: kappa_constructor !< kappa coefficients (optimal, linear weights) constructor. -endtype weights_js_constructor +endtype weights_int_js_constructor -type, extends(weights_object):: weights_js +type, extends(weights_object):: weights_int_js !< Jiang-Shu and Gerolymos-Senechal-Vallet weights object. !< !< @note The provided WENO weights implements the weights defined in *Efficient Implementation of Weighted ENO !< Schemes*, Guang-Shan Jiang, Chi-Wang Shu, JCP, 1996, vol. 126, pp. 202--228, doi:10.1006/jcph.1996.0130 and !< *Very-high-order weno schemes*, G. A. Gerolymos, D. Senechal, I. Vallet, JCP, 2009, vol. 228, pp. 8481-8524, !< doi:10.1016/j.jcp.2009.07.039 - class(alpha_object), allocatable :: alpha !< Alpha coefficients (non linear weights). - class(beta_object), allocatable :: beta !< Beta coefficients (smoothness indicators). - class(kappa_object), allocatable :: kappa !< kappa coefficients (optimal, linear weights). + class(alpha_object), allocatable :: alpha !< Alpha coefficients (non linear weights). + class(beta_object), allocatable :: beta !< Beta coefficients (smoothness indicators). + class(kappa_object), allocatable :: kappa !< kappa coefficients (optimal, linear weights). contains ! deferred public methods - procedure, pass(self) :: create !< Create weights. - procedure, pass(self) :: compute !< Compute weights. - procedure, pass(self) :: description !< Return weights string-description. - procedure, pass(self) :: destroy !< Destroy weights. - procedure, pass(self) :: smoothness_indicators !< Return smoothness indicators. -endtype weights_js + procedure, pass(self) :: create !< Create weights. + procedure, pass(self) :: compute_with_stencil_of_rank_1 !< Compute weights. + procedure, pass(self) :: compute_with_stencil_of_rank_2 !< Compute weights. + procedure, pass(self) :: description !< Return weights string-description. + procedure, pass(self) :: destroy !< Destroy weights. + procedure, pass(self) :: smoothness_indicators_of_rank_1 !< Return smoothness indicators. + procedure, pass(self) :: smoothness_indicators_of_rank_2 !< Return smoothness indicators. +endtype weights_int_js contains ! deferred public methods subroutine create(self, constructor) !< Create reconstructor. - class(weights_js), intent(inout) :: self !< Weights. + class(weights_int_js), intent(inout) :: self !< Weights. class(base_object_constructor), intent(in) :: constructor !< Constructor. type(alpha_factory) :: a_factory !< Alpha factory. type(beta_factory) :: b_factory !< Beta factory. @@ -69,10 +71,10 @@ subroutine create(self, constructor) call self%destroy call self%create_(constructor=constructor) - allocate(self%values(1:2, 0:self%S - 1)) - self%values = 0._RPP + allocate(self%values_rank_1(0:self%S - 1)) + self%values_rank_1 = 0._RPP select type(constructor) - type is(weights_js_constructor) + type is(weights_int_js_constructor) associate(alpha_constructor=>constructor%alpha_constructor, & beta_constructor=>constructor%beta_constructor, & kappa_constructor=>constructor%kappa_constructor) @@ -104,55 +106,66 @@ subroutine create(self, constructor) endselect endsubroutine create - pure subroutine compute(self, stencil) + pure subroutine compute_with_stencil_of_rank_1(self, stencil) !< Compute weights. - class(weights_js), intent(inout) :: self !< Weights. - real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. - integer(I_P) :: f, s !< Counters. + class(weights_int_js), intent(inout) :: self !< Weights. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + integer(I_P) :: s !< Counters. call self%beta%compute(stencil=stencil) call self%alpha%compute(beta=self%beta, kappa=self%kappa) do s=0, self%S - 1 ! stencils loop - do f=self%f1, self%f2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) - self%values(f + self%ff, s) = self%alpha%values(f, s) / self%alpha%values_sum(f) - enddo + self%values_rank_1(s) = self%alpha%values_rank_1(s) / self%alpha%values_sum_rank_1 enddo - endsubroutine compute + endsubroutine compute_with_stencil_of_rank_1 + + pure subroutine compute_with_stencil_of_rank_2(self, stencil) + !< Compute weights. + class(weights_int_js), intent(inout) :: self !< Weights. + real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. + + ! Empty routine. + endsubroutine compute_with_stencil_of_rank_2 pure function description(self) result(string) !< Return string-description of weights. - class(weights_js), intent(in) :: self !< Weights. + class(weights_int_js), intent(in) :: self !< Weights. character(len=:), allocatable :: string !< String-description. character(len=1), parameter :: nl=new_line('a') !< New line char. string = ' Jiang-Shu weights:'//nl string = string//' - S = '//trim(str(self%S))//nl - string = string//' - f1 = '//trim(str(self%f1))//nl - string = string//' - f2 = '//trim(str(self%f2))//nl - string = string//' - ff = '//trim(str(self%ff))//nl string = string//self%alpha%description() endfunction description elemental subroutine destroy(self) !< Destroy weights. - class(weights_js), intent(inout) :: self !< Weights. + class(weights_int_js), intent(inout) :: self !< Weights. call self%destroy_ - if (allocated(self%values)) deallocate(self%values) + if (allocated(self%values_rank_1)) deallocate(self%values_rank_1) if (allocated(self%alpha)) deallocate(self%alpha) if (allocated(self%beta)) deallocate(self%beta) if (allocated(self%kappa)) deallocate(self%kappa) endsubroutine destroy - pure function smoothness_indicators(self) result(si) + pure subroutine smoothness_indicators_of_rank_1(self, si) !< Return smoothness indicators.. - class(weights_js), intent(in) :: self !< Weights. - real(RPP), allocatable :: si(:,:) !< Smoothness indicators. + class(weights_int_js), intent(in) :: self !< Weights. + real(RPP), intent(out) :: si(:) !< Smoothness indicators. if (allocated(self%beta)) then - if (allocated(self%beta%values)) then - si = self%beta%values + if (allocated(self%beta%values_rank_1)) then + si = self%beta%values_rank_1 endif endif - endfunction smoothness_indicators -endmodule wenoof_weights_js + endsubroutine smoothness_indicators_of_rank_1 + + pure subroutine smoothness_indicators_of_rank_2(self, si) + !< Return smoothness indicators.. + class(weights_int_js), intent(in) :: self !< Weights. + real(RPP), intent(out) :: si(:,:) !< Smoothness indicators. + + ! Empty routine + endsubroutine smoothness_indicators_of_rank_2 +endmodule wenoof_weights_int_js diff --git a/src/lib/concrete_objects/wenoof_weights_rec_js.F90 b/src/lib/concrete_objects/wenoof_weights_rec_js.F90 new file mode 100644 index 0000000..5f5056e --- /dev/null +++ b/src/lib/concrete_objects/wenoof_weights_rec_js.F90 @@ -0,0 +1,173 @@ +!< Jiang-Shu and Gerolymos-Senechal-Vallet weights. +module wenoof_weights_rec_js +!< Jiang-Shu and Gerolymos-Senechal-Vallet weights. +!< +!< @note The provided WENO weights implements the weights defined in *Efficient Implementation of Weighted ENO +!< Schemes*, Guang-Shan Jiang, Chi-Wang Shu, JCP, 1996, vol. 126, pp. 202--228, doi:10.1006/jcph.1996.0130 and +!< *Very-high-order weno schemes*, G. A. Gerolymos, D. Senechal, I. Vallet, JCP, 2009, vol. 228, pp. 8481-8524, +!< doi:10.1016/j.jcp.2009.07.039 + +#ifdef r16p +use penf, only: I_P, RPP=>R16P, str +#else +use penf, only: I_P, RPP=>R8P, str +#endif +use wenoof_alpha_factory +use wenoof_alpha_object +use wenoof_alpha_rec_js +use wenoof_alpha_rec_m +use wenoof_alpha_rec_z +use wenoof_base_object +use wenoof_beta_factory +use wenoof_beta_object +use wenoof_beta_rec_js +use wenoof_kappa_factory +use wenoof_kappa_object +use wenoof_kappa_rec_js +use wenoof_weights_object + +implicit none +private +public :: weights_rec_js +public :: weights_rec_js_constructor + +type, extends(weights_object_constructor) :: weights_rec_js_constructor + !< Jiang-Shu and Gerolymos-Senechal-Vallet optimal weights object constructor. + class(alpha_object_constructor), allocatable :: alpha_constructor !< Alpha coefficients (non linear weights) constructor. + class(beta_object_constructor), allocatable :: beta_constructor !< Beta coefficients (smoothness indicators) constructor. + class(kappa_object_constructor), allocatable :: kappa_constructor !< kappa coefficients (optimal, linear weights) constructor. +endtype weights_rec_js_constructor + +type, extends(weights_object):: weights_rec_js + !< Jiang-Shu and Gerolymos-Senechal-Vallet weights object. + !< + !< @note The provided WENO weights implements the weights defined in *Efficient Implementation of Weighted ENO + !< Schemes*, Guang-Shan Jiang, Chi-Wang Shu, JCP, 1996, vol. 126, pp. 202--228, doi:10.1006/jcph.1996.0130 and + !< *Very-high-order weno schemes*, G. A. Gerolymos, D. Senechal, I. Vallet, JCP, 2009, vol. 228, pp. 8481-8524, + !< doi:10.1016/j.jcp.2009.07.039 + class(alpha_object), allocatable :: alpha !< Alpha coefficients (non linear weights). + class(beta_object), allocatable :: beta !< Beta coefficients (smoothness indicators). + class(kappa_object), allocatable :: kappa !< kappa coefficients (optimal, linear weights). + contains + ! deferred public methods + procedure, pass(self) :: create !< Create weights. + procedure, pass(self) :: compute_with_stencil_of_rank_1 !< Compute weights. + procedure, pass(self) :: compute_with_stencil_of_rank_2 !< Compute weights. + procedure, pass(self) :: description !< Return weights string-description. + procedure, pass(self) :: destroy !< Destroy weights. + procedure, pass(self) :: smoothness_indicators_of_rank_1 !< Return smoothness indicators. + procedure, pass(self) :: smoothness_indicators_of_rank_2 !< Return smoothness indicators. +endtype weights_rec_js + +contains + ! deferred public methods + subroutine create(self, constructor) + !< Create reconstructor. + class(weights_rec_js), intent(inout) :: self !< Weights. + class(base_object_constructor), intent(in) :: constructor !< Constructor. + type(alpha_factory) :: a_factory !< Alpha factory. + type(beta_factory) :: b_factory !< Beta factory. + type(kappa_factory) :: k_factory !< Kappa factory. + + call self%destroy + call self%create_(constructor=constructor) + allocate(self%values_rank_2(1:2, 0:self%S - 1)) + self%values_rank_2 = 0._RPP + select type(constructor) + type is(weights_rec_js_constructor) + associate(alpha_constructor=>constructor%alpha_constructor, & + beta_constructor=>constructor%beta_constructor, & + kappa_constructor=>constructor%kappa_constructor) + + call a_factory%create(constructor=alpha_constructor, object=self%alpha) + ! select type(alpha_constructor) + ! type is(alpha_rec_js_constructor) + ! call factory%create(constructor=alpha_constructor, object=self%alpha) + ! type is(alpha_rec_m_constructor) + ! call factory%create(constructor=alpha_constructor, object=self%alpha) + ! type is(alpha_rec_z_constructor) + ! call factory%create(constructor=alpha_constructor, object=self%alpha) + ! endselect + + call b_factory%create(constructor=beta_constructor, object=self%beta) + ! select type(beta_constructor) + ! type is(beta_rec_js_constructor) + ! allocate(beta_rec_js :: self%beta) + ! call self%beta%create(constructor=beta_constructor) + ! endselect + + call k_factory%create(constructor=kappa_constructor, object=self%kappa) + ! select type(kappa_constructor) + ! type is(kappa_rec_js_constructor) + ! allocate(kappa_rec_js :: self%kappa) + ! call self%kappa%create(constructor=kappa_constructor) + ! endselect + endassociate + endselect + endsubroutine create + + pure subroutine compute_with_stencil_of_rank_1(self, stencil) + !< Compute weights. + class(weights_rec_js), intent(inout) :: self !< Weights. + real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S]. + + ! Empty routine. + endsubroutine compute_with_stencil_of_rank_1 + + pure subroutine compute_with_stencil_of_rank_2(self, stencil) + !< Compute weights. + class(weights_rec_js), intent(inout) :: self !< Weights. + real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S]. + integer(I_P) :: f, s !< Counters. + + call self%beta%compute(stencil=stencil) + call self%alpha%compute(beta=self%beta, kappa=self%kappa) + do s=0, self%S - 1 ! stencils loop + do f=1, 2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2) + self%values_rank_2(f, s) = self%alpha%values_rank_2(f, s) / self%alpha%values_sum_rank_2(f) + enddo + enddo + endsubroutine compute_with_stencil_of_rank_2 + + pure function description(self) result(string) + !< Return string-description of weights. + class(weights_rec_js), intent(in) :: self !< Weights. + character(len=:), allocatable :: string !< String-description. + character(len=1), parameter :: nl=new_line('a') !< New line char. + + string = ' Jiang-Shu weights:'//nl + string = string//' - S = '//trim(str(self%S))//nl + string = string//self%alpha%description() + endfunction description + + elemental subroutine destroy(self) + !< Destroy weights. + class(weights_rec_js), intent(inout) :: self !< Weights. + + call self%destroy_ + if (allocated(self%values_rank_2)) deallocate(self%values_rank_2) + if (allocated(self%alpha)) deallocate(self%alpha) + if (allocated(self%beta)) deallocate(self%beta) + if (allocated(self%kappa)) deallocate(self%kappa) + endsubroutine destroy + + pure subroutine smoothness_indicators_of_rank_1(self, si) + !< Return smoothness indicators.. + class(weights_rec_js), intent(in) :: self !< Weights. + real(RPP), intent(out) :: si(:) !< Smoothness indicators. + + ! Empty routine + endsubroutine smoothness_indicators_of_rank_1 + + pure subroutine smoothness_indicators_of_rank_2(self, si) + !< Return smoothness indicators.. + class(weights_rec_js), intent(in) :: self !< Weights. + real(RPP), intent(out) :: si(:,:) !< Smoothness indicators. + + if (allocated(self%beta)) then + if (allocated(self%beta%values_rank_2)) then + si = self%beta%values_rank_2 + endif + endif + endsubroutine smoothness_indicators_of_rank_2 +endmodule wenoof_weights_rec_js diff --git a/src/lib/factories/wenoof_alpha_factory.f90 b/src/lib/factories/wenoof_alpha_factory.f90 index 014b2e1..6835ef9 100644 --- a/src/lib/factories/wenoof_alpha_factory.f90 +++ b/src/lib/factories/wenoof_alpha_factory.f90 @@ -2,6 +2,7 @@ module wenoof_alpha_factory !< Wenoof alpha factory. +use, intrinsic :: iso_fortran_env, only : stderr=>error_unit #ifdef r16p use penf, only: I_P, RPP=>R16P #else @@ -11,6 +12,9 @@ module wenoof_alpha_factory use wenoof_alpha_rec_js use wenoof_alpha_rec_m use wenoof_alpha_rec_z +use wenoof_alpha_int_js +use wenoof_alpha_int_m +use wenoof_alpha_int_z implicit none private @@ -31,6 +35,12 @@ subroutine create(constructor, object) class(alpha_object), allocatable, intent(out) :: object !< Object. select type(constructor) + type is(alpha_int_js_constructor) + allocate(alpha_int_js :: object) + type is(alpha_int_m_constructor) + allocate(alpha_int_m :: object) + type is(alpha_int_z_constructor) + allocate(alpha_int_z :: object) type is(alpha_rec_js_constructor) allocate(alpha_rec_js :: object) type is(alpha_rec_m_constructor) @@ -43,19 +53,30 @@ subroutine create(constructor, object) call object%create(constructor=constructor) endsubroutine create - subroutine create_constructor(interpolator_type, S, constructor, face_left, face_right, eps) + subroutine create_constructor(interpolator_type, S, constructor, eps) !< Create an instance of concrete extension of [[alpha_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(alpha_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left-face interpolations. - logical, intent(in), optional :: face_right !< Activate right-face interpolations. real(RPP), intent(in), optional :: eps !< Small epsilon to avoid zero/division. select case(trim(adjustl(interpolator_type))) case('interpolator-JS') - ! @TODO implement this - error stop 'interpolator-JS to be implemented' + allocate(alpha_int_js_constructor :: constructor) + case('interpolator-M-JS') + allocate(alpha_int_m_constructor :: constructor) + select type(constructor) + type is(alpha_int_m_constructor) + constructor%base_type = 'JS' + endselect + case('interpolator-M-Z') + allocate(alpha_int_m_constructor :: constructor) + select type(constructor) + type is(alpha_int_m_constructor) + constructor%base_type = 'Z' + endselect + case('interpolator-Z') + allocate(alpha_int_z_constructor :: constructor) case('reconstructor-JS') allocate(alpha_rec_js_constructor :: constructor) case('reconstructor-M-JS') @@ -72,7 +93,10 @@ subroutine create_constructor(interpolator_type, S, constructor, face_left, face endselect case('reconstructor-Z') allocate(alpha_rec_z_constructor :: constructor) + case default + write(stderr, '(A)') 'error: interpolator type "'//trim(adjustl(interpolator_type))//'" is unknown!' + stop endselect - call constructor%create(S=S, face_left=face_left, face_right=face_right, eps=eps) + call constructor%create(S=S, eps=eps) endsubroutine create_constructor endmodule wenoof_alpha_factory diff --git a/src/lib/factories/wenoof_beta_factory.f90 b/src/lib/factories/wenoof_beta_factory.f90 index 65eb7a4..bbd399d 100644 --- a/src/lib/factories/wenoof_beta_factory.f90 +++ b/src/lib/factories/wenoof_beta_factory.f90 @@ -5,6 +5,7 @@ module wenoof_beta_factory use penf, only: I_P use wenoof_beta_object use wenoof_beta_rec_js +use wenoof_beta_int_js implicit none private @@ -27,24 +28,29 @@ subroutine create(constructor, object) select type(constructor) type is(beta_rec_js_constructor) allocate(beta_rec_js :: object) + type is(beta_int_js_constructor) + allocate(beta_int_js :: object) class default error stop 'error: WenOOF object factory do NOT know the constructor given' endselect call object%create(constructor=constructor) endsubroutine create - subroutine create_constructor(interpolator_type, S, constructor, face_left, face_right) + subroutine create_constructor(interpolator_type, S, constructor) !< Create an instance of concrete extension of [[beta_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(beta_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left-face interpolations. - logical, intent(in), optional :: face_right !< Activate right-face interpolations. select case(trim(adjustl(interpolator_type))) case('interpolator-JS') - ! @TODO implement this - error stop 'interpolator-JS to be implemented' + allocate(beta_int_js_constructor :: constructor) + case('interpolator-M-JS') + allocate(beta_int_js_constructor :: constructor) + case('interpolator-M-Z') + allocate(beta_int_js_constructor :: constructor) + case('interpolator-Z') + allocate(beta_int_js_constructor :: constructor) case('reconstructor-JS') allocate(beta_rec_js_constructor :: constructor) case('reconstructor-M-JS') @@ -54,6 +60,6 @@ subroutine create_constructor(interpolator_type, S, constructor, face_left, face case('reconstructor-Z') allocate(beta_rec_js_constructor :: constructor) endselect - call constructor%create(S=S, face_left=face_left, face_right=face_right) + call constructor%create(S=S) endsubroutine create_constructor endmodule wenoof_beta_factory diff --git a/src/lib/factories/wenoof_interpolations_factory.f90 b/src/lib/factories/wenoof_interpolations_factory.f90 index 689ad0c..1f36047 100644 --- a/src/lib/factories/wenoof_interpolations_factory.f90 +++ b/src/lib/factories/wenoof_interpolations_factory.f90 @@ -2,9 +2,14 @@ module wenoof_interpolations_factory !< Wenoof interpolations factory. -use penf, only: I_P +#ifdef r16p +use penf, only: I_P, RPP=>R16P +#else +use penf, only: I_P, RPP=>R8P +#endif use wenoof_interpolations_object use wenoof_interpolations_rec_js +use wenoof_interpolations_int_js implicit none private @@ -14,8 +19,11 @@ module wenoof_interpolations_factory !< Factory, create an instance of concrete extension of [[interpolations_object]] given its constructor. contains ! public methods - procedure, nopass :: create !< Create a concrete instance of [[interpolations_object]]. - procedure, nopass :: create_constructor !< Create a concrete instance of [[interpolations_object_constructor]]. + procedure, nopass :: create !< Create a concrete instance of [[interpolations_object]]. + procedure, nopass :: create_constructor_rec + procedure, nopass :: create_constructor_int + generic :: create_constructor => create_constructor_rec, & !< Create a concrete instance + create_constructor_int !< of [[interpolations_object_constructor]]. endtype interpolations_factory contains @@ -25,6 +33,8 @@ subroutine create(constructor, object) class(interpolations_object), allocatable, intent(out) :: object !< Object. select type(constructor) + type is(interpolations_int_js_constructor) + allocate(interpolations_int_js :: object) type is(interpolations_rec_js_constructor) allocate(interpolations_rec_js :: object) class default @@ -33,27 +43,28 @@ subroutine create(constructor, object) call object%create(constructor=constructor) endsubroutine create - subroutine create_constructor(interpolator_type, S, constructor, face_left, face_right) + subroutine create_constructor_rec(interpolator_type, S, constructor) !< Create an instance of concrete extension of [[beta_object_constructor]]. - character(*), intent(in) :: interpolator_type !< Type of the interpolator. - integer(I_P), intent(in) :: S !< Stencils dimension. - class(interpolations_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left-face interp. - logical, intent(in), optional :: face_right !< Activate right-face interp. - - select case(trim(adjustl(interpolator_type))) - case('interpolator-JS') - ! @TODO implement this - error stop 'interpolator-JS to be implemented' - case('reconstructor-JS') - allocate(interpolations_rec_js_constructor :: constructor) - case('reconstructor-M-JS') - allocate(interpolations_rec_js_constructor :: constructor) - case('reconstructor-M-Z') - allocate(interpolations_rec_js_constructor :: constructor) - case('reconstructor-Z') - allocate(interpolations_rec_js_constructor :: constructor) - endselect - call constructor%create(S=S, face_left=face_left, face_right=face_right) - endsubroutine create_constructor + character(*), intent(in) :: interpolator_type !< Type of the interpolator. + integer(I_P), intent(in) :: S !< Stencils dimension. + class(interpolations_object_constructor), allocatable, intent(out) :: constructor !< Constructor. + + allocate(interpolations_rec_js_constructor :: constructor) + call constructor%create(S=S) + endsubroutine create_constructor_rec + + subroutine create_constructor_int(interpolator_type, S, stencil, x_target, constructor) + !< Create an instance of concrete extension of [[beta_object_constructor]]. + character(*), intent(in) :: interpolator_type !< Type of the interpolator. + integer(I_P), intent(in) :: S !< Stencils dimension. + real(RPP), intent(in) :: stencil(1-S:) !< Stencil used for inter, [1-S:-1+S]. + real(RPP), intent(in) :: x_target !< Coordinate of the interp point. + class(interpolations_object_constructor), allocatable, intent(out) :: constructor !< Constructor. + + allocate(interpolations_int_js_constructor :: constructor) + allocate(constructor%stencil(1-S:S-1)) + constructor%stencil = stencil + constructor%x_target = x_target + call constructor%create(S=S) + endsubroutine create_constructor_int endmodule wenoof_interpolations_factory diff --git a/src/lib/factories/wenoof_interpolator_factory.f90 b/src/lib/factories/wenoof_interpolator_factory.f90 index ba7cfb6..7e66558 100644 --- a/src/lib/factories/wenoof_interpolator_factory.f90 +++ b/src/lib/factories/wenoof_interpolator_factory.f90 @@ -5,7 +5,7 @@ module wenoof_interpolator_factory use penf, only: I_P use wenoof_interpolations_object use wenoof_interpolator_object -! use wenoof_interpolator_js +use wenoof_interpolator_js use wenoof_reconstructor_js use wenoof_weights_object @@ -28,8 +28,8 @@ subroutine create(constructor, object) class(interpolator_object), allocatable, intent(out) :: object !< Object. select type(constructor) - ! type is(interpolator_js_constructor) - ! allocate(interpolator_js :: object) + type is(interpolator_js_constructor) + allocate(interpolator_js :: object) type is(reconstructor_js_constructor) allocate(reconstructor_js :: object) class default @@ -39,20 +39,23 @@ subroutine create(constructor, object) endsubroutine create subroutine create_constructor(interpolator_type, S, interpolations_constructor, weights_constructor, & - constructor, face_left, face_right) + constructor) !< Create an instance of concrete extension of [[weights_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(interpolations_object_constructor), intent(in) :: interpolations_constructor !< Interpolations const. class(weights_object_constructor), intent(in) :: weights_constructor !< Weights constructor. class(interpolator_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left interp. - logical, intent(in), optional :: face_right !< Activate right interp. select case(trim(adjustl(interpolator_type))) case('interpolator-JS') - ! @TODO implement this - error stop 'interpolator-JS to be implemented' + allocate(interpolator_js_constructor :: constructor) + case('interpolator-M-JS') + allocate(interpolator_js_constructor :: constructor) + case('interpolator-M-Z') + allocate(interpolator_js_constructor :: constructor) + case('interpolator-Z') + allocate(interpolator_js_constructor :: constructor) case('reconstructor-JS') allocate(reconstructor_js_constructor :: constructor) case('reconstructor-M-JS') @@ -62,8 +65,11 @@ subroutine create_constructor(interpolator_type, S, interpolations_constructor, case('reconstructor-Z') allocate(reconstructor_js_constructor :: constructor) endselect - call constructor%create(S=S, face_left=face_left, face_right=face_right) + call constructor%create(S=S) select type(constructor) + type is(interpolator_js_constructor) + allocate(constructor%interpolations_constructor, source=interpolations_constructor) + allocate(constructor%weights_constructor, source=weights_constructor) type is(reconstructor_js_constructor) allocate(constructor%interpolations_constructor, source=interpolations_constructor) allocate(constructor%weights_constructor, source=weights_constructor) diff --git a/src/lib/factories/wenoof_kappa_factory.f90 b/src/lib/factories/wenoof_kappa_factory.f90 index d7c634d..27e803b 100644 --- a/src/lib/factories/wenoof_kappa_factory.f90 +++ b/src/lib/factories/wenoof_kappa_factory.f90 @@ -2,9 +2,15 @@ module wenoof_kappa_factory !< Wenoof kappa factory. -use penf, only: I_P +#ifdef r16p +use penf, only: I_P, RPP=>R16P +#else +use penf, only: I_P, RPP=>R8P +#endif +use wenoof_interpolations_object use wenoof_kappa_object use wenoof_kappa_rec_js +use wenoof_kappa_int_js implicit none private @@ -14,8 +20,11 @@ module wenoof_kappa_factory !< Factory, create an instance of concrete extension of [[kappa_object]] given its constructor. contains ! public methods - procedure, nopass :: create !< Create a concrete instance of [[kappa_object]]. - procedure, nopass :: create_constructor !< Create a concrete instance of [[kappa_object_constructor]]. + procedure, nopass :: create !< Create a concrete instance of [[kappa_object]]. + procedure, nopass :: create_constructor_rec + procedure, nopass :: create_constructor_int + generic :: create_constructor => create_constructor_rec, & !< Create a concrete instance + create_constructor_int !< of [[kappa_object_constructor]]. endtype kappa_factory contains @@ -27,31 +36,41 @@ subroutine create(constructor, object) select type(constructor) type is(kappa_rec_js_constructor) allocate(kappa_rec_js :: object) + type is(kappa_int_js_constructor) + allocate(kappa_int_js :: object) class default error stop 'error: WenOOF object factory do NOT know the constructor given' endselect call object%create(constructor=constructor) endsubroutine create - subroutine create_constructor(interpolator_type, S, constructor) + subroutine create_constructor_rec(interpolator_type, S, constructor) !< Create an instance of concrete extension of [[kappa_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(kappa_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - select case(trim(adjustl(interpolator_type))) - case('interpolator-JS') - ! @TODO implement this - error stop 'interpolator-JS to be implemented' - case('reconstructor-JS') - allocate(kappa_rec_js_constructor :: constructor) - case('reconstructor-M-JS') - allocate(kappa_rec_js_constructor :: constructor) - case('reconstructor-M-Z') - allocate(kappa_rec_js_constructor :: constructor) - case('reconstructor-Z') - allocate(kappa_rec_js_constructor :: constructor) - endselect + allocate(kappa_rec_js_constructor :: constructor) call constructor%create(S=S) - endsubroutine create_constructor + endsubroutine create_constructor_rec + + subroutine create_constructor_int(interpolator_type, S, stencil, x_target, interpolations_constructor, constructor) + !< Create an instance of concrete extension of [[kappa_object_constructor]]. + character(*), intent(in) :: interpolator_type !< Type of the interpolator. + integer(I_P), intent(in) :: S !< Stencils dimension. + real(RPP), intent(in) :: stencil(1-S:) !< Stencil used for inter, [1-S:-1+S]. + real(RPP), intent(in) :: x_target !< Coordinate of the interp point. + class(interpolations_object_constructor), intent(in) :: interpolations_constructor !< interpolations constructor. + class(kappa_object_constructor), allocatable, intent(out) :: constructor !< Constructor. + + allocate(kappa_int_js_constructor :: constructor) + allocate(constructor%stencil(1-S:S-1)) + constructor%stencil = stencil + constructor%x_target = x_target + call constructor%create(S=S) + select type(constructor) + type is(kappa_int_js_constructor) + allocate(constructor%interpolations_constructor, source=interpolations_constructor) + endselect + endsubroutine create_constructor_int endmodule wenoof_kappa_factory diff --git a/src/lib/factories/wenoof_objects_factory.f90 b/src/lib/factories/wenoof_objects_factory.f90 index b0ac17e..58007c7 100644 --- a/src/lib/factories/wenoof_objects_factory.f90 +++ b/src/lib/factories/wenoof_objects_factory.f90 @@ -32,16 +32,19 @@ module wenoof_objects_factory create_beta_object, & create_kappa_object, & create_interpolations_object, & + create_reconstructor, & create_interpolator, & create_interpolator_object, & create_weights_object !< Create a concrete instance of [[alpha_object]], [[beta_object]], !< [[kappa_object]], [[interpolations_object]], [[interpolator_object]] or !< [[weights_object]]. - generic :: create_constructor => create_alpha_object_constructor, & - create_beta_object_constructor, & - create_kappa_object_constructor, & - create_interpolations_object_constructor, & - create_interpolator_object_constructor, & + generic :: create_constructor => create_alpha_object_constructor, & + create_beta_object_constructor, & + create_kappa_rec_object_constructor, & + create_kappa_int_object_constructor, & + create_interpolations_rec_object_constructor, & + create_interpolations_int_object_constructor, & + create_interpolator_object_constructor, & create_weights_object_constructor !< Create a concrete instance of !< [[alpha_object_constructor]], [[beta_object_constructor]], !< [[kappa_object_constructor]], @@ -49,19 +52,22 @@ module wenoof_objects_factory !< [[interpolator_object_constructor]] or !< [[weights_object_constructor]]. ! private methods - procedure, nopass, private :: create_alpha_object !< Create [[alpha_object]] instance - procedure, nopass, private :: create_beta_object !< Create [[beta_object]] instance. - procedure, nopass, private :: create_kappa_object !< Create [[kappa_object]] instance. - procedure, nopass, private :: create_interpolations_object !< Create [[interpolations_object]] instance. - procedure, pass(self), private :: create_interpolator !< Create [[interpolator_object]] instance. - procedure, nopass, private :: create_interpolator_object !< Create [[interpolator_object]] instance. - procedure, nopass, private :: create_weights_object !< Create [[weights_object]] instance. - procedure, nopass, private :: create_alpha_object_constructor !< Create [[alpha_object_constructor]] instance. - procedure, nopass, private :: create_beta_object_constructor !< Create [[beta_object_constructor]] instance. - procedure, nopass, private :: create_kappa_object_constructor !< Create [[kappa_object_constructor]] instance. - procedure, nopass, private :: create_interpolations_object_constructor !< Create [[interpolations_object_constructor]] inst. - procedure, nopass, private :: create_interpolator_object_constructor !< Create [[interpolator_object_constructor]] inst. - procedure, nopass, private :: create_weights_object_constructor !< Create [[weights_object_constructor]] instance. + procedure, nopass, private :: create_alpha_object !< Create [[alpha_object]] instance + procedure, nopass, private :: create_beta_object !< Create [[beta_object]] instance. + procedure, nopass, private :: create_kappa_object !< Create [[kappa_object]] instance. + procedure, nopass, private :: create_interpolations_object !< Create [[interpolations_object]] instance. + procedure, pass(self), private :: create_interpolator !< Create [[interpolator]] instance. + procedure, pass(self), private :: create_reconstructor !< Create [[reconstructor]] instance. + procedure, nopass, private :: create_interpolator_object !< Create [[interpolator_object]] instance. + procedure, nopass, private :: create_weights_object !< Create [[weights_object]] instance. + procedure, nopass, private :: create_alpha_object_constructor !< Create [[alpha_object_constructor]] instance. + procedure, nopass, private :: create_beta_object_constructor !< Create [[beta_object_constructor]] instance. + procedure, nopass, private :: create_kappa_int_object_constructor !< Create [[kappa_object_constructor]] instance. + procedure, nopass, private :: create_kappa_rec_object_constructor !< Create [[kappa_object_constructor]] instance. + procedure, nopass, private :: create_interpolations_int_object_constructor !< Create [[interpolations_object_constructor]] + procedure, nopass, private :: create_interpolations_rec_object_constructor !< instance. + procedure, nopass, private :: create_interpolator_object_constructor !< Create [[interpolator_object_constructor]] i. + procedure, nopass, private :: create_weights_object_constructor !< Create [[weights_object_constructor]] inst. endtype objects_factory contains @@ -101,14 +107,12 @@ subroutine create_interpolations_object(constructor, object) call factory%create(constructor=constructor, object=object) endsubroutine create_interpolations_object - subroutine create_interpolator(self, interpolator_type, S, interpolator, face_left, face_right, eps) + subroutine create_reconstructor(self, interpolator_type, S, interpolator, eps) !< Create an instance of concrete extension of [[interpolator_object]] given user options. class(objects_factory), intent(in) :: self !< The factory. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(interpolator_object), allocatable, intent(out) :: interpolator !< Interpolator. - logical, intent(in), optional :: face_left !< Activate left-face interpolations. - logical, intent(in), optional :: face_right !< Activate right-face interpolations. real(RPP), intent(in), optional :: eps !< Small epsilon to avoid zero/div. class(alpha_object_constructor), allocatable :: alpha_constructor !< Alpha constructor. class(beta_object_constructor), allocatable :: beta_constructor !< Beta constructor. @@ -120,15 +124,11 @@ subroutine create_interpolator(self, interpolator_type, S, interpolator, face_le call self%create_constructor(interpolator_type=interpolator_type, & S=S, & constructor=alpha_constructor, & - face_left=face_left, & - face_right=face_right, & eps=eps) call self%create_constructor(interpolator_type=interpolator_type, & S=S, & - constructor=beta_constructor, & - face_left=face_left, & - face_right=face_right) + constructor=beta_constructor) call self%create_constructor(interpolator_type=interpolator_type, S=S, constructor=kappa_constructor) @@ -137,23 +137,71 @@ subroutine create_interpolator(self, interpolator_type, S, interpolator, face_le alpha_constructor=alpha_constructor, & beta_constructor=beta_constructor, & kappa_constructor=kappa_constructor, & - constructor=weights_constructor, & - face_left=face_left, & - face_right=face_right) + constructor=weights_constructor) call self%create_constructor(interpolator_type=interpolator_type, & S=S, & - constructor=interpolations_constructor, & - face_left=face_left, & - face_right=face_right) + constructor=interpolations_constructor) call self%create_constructor(interpolator_type=interpolator_type, & S=S, & interpolations_constructor=interpolations_constructor, & weights_constructor=weights_constructor, & - constructor=interpolator_constructor, & - face_left=face_left, & - face_right=face_right) + constructor=interpolator_constructor) + + call self%create_interpolator_object(constructor=interpolator_constructor, object=interpolator) + endsubroutine create_reconstructor + + subroutine create_interpolator(self, interpolator_type, S, interpolator, stencil, x_target, eps) + !< Create an instance of concrete extension of [[interpolator_object]] given user options. + class(objects_factory), intent(in) :: self !< The factory. + character(*), intent(in) :: interpolator_type !< Type of the interpolator. + integer(I_P), intent(in) :: S !< Stencils dimension. + class(interpolator_object), allocatable, intent(out) :: interpolator !< Interpolator. + real(RPP), intent(in) :: stencil(1-S:) !< Stencil used for inter, [1-S:-1+S]. + real(RPP), intent(in) :: x_target !< Coordinate of the interp point. + real(RPP), intent(in), optional :: eps !< Small epsilon to avoid zero/div. + class(alpha_object_constructor), allocatable :: alpha_constructor !< Alpha constructor. + class(beta_object_constructor), allocatable :: beta_constructor !< Beta constructor. + class(interpolations_object_constructor), allocatable :: interpolations_constructor !< Interpolations constructor. + class(kappa_object_constructor), allocatable :: kappa_constructor !< Kappa constructor. + class(weights_object_constructor), allocatable :: weights_constructor !< Weights constructor. + class(interpolator_object_constructor), allocatable :: interpolator_constructor !< Interpolator constructor. + + call self%create_constructor(interpolator_type=interpolator_type, & + S=S, & + constructor=alpha_constructor, & + eps=eps) + + call self%create_constructor(interpolator_type=interpolator_type, & + S=S, & + constructor=beta_constructor) + + call self%create_constructor(interpolator_type=interpolator_type, & + S=S, & + stencil=stencil, & + x_target=x_target, & + constructor=interpolations_constructor) + + call self%create_constructor(interpolator_type=interpolator_type, & + S=S, & + stencil=stencil, & + x_target=x_target, & + interpolations_constructor=interpolations_constructor, & + constructor=kappa_constructor) + + call self%create_constructor(interpolator_type=interpolator_type, & + S=S, & + alpha_constructor=alpha_constructor, & + beta_constructor=beta_constructor, & + kappa_constructor=kappa_constructor, & + constructor=weights_constructor) + + call self%create_constructor(interpolator_type=interpolator_type, & + S=S, & + interpolations_constructor=interpolations_constructor, & + weights_constructor=weights_constructor, & + constructor=interpolator_constructor) call self%create_interpolator_object(constructor=interpolator_constructor, object=interpolator) endsubroutine create_interpolator @@ -176,89 +224,109 @@ subroutine create_weights_object(constructor, object) call factory%create(constructor=constructor, object=object) endsubroutine create_weights_object - subroutine create_alpha_object_constructor(interpolator_type, S, constructor, face_left, face_right, eps) + subroutine create_alpha_object_constructor(interpolator_type, S, constructor, eps) !< Create an instance of concrete extension of [[alpha_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(alpha_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left-face interpolations. - logical, intent(in), optional :: face_right !< Activate right-face interpolations. real(RPP), intent(in), optional :: eps !< Small epsilon to avoid zero/division. type(alpha_factory) :: factory !< The factory. call factory%create_constructor(interpolator_type=interpolator_type, & S=S, & constructor=constructor, & - face_left=face_left, & - face_right=face_right, & eps=eps) endsubroutine create_alpha_object_constructor - subroutine create_beta_object_constructor(interpolator_type, S, constructor, face_left, face_right) + subroutine create_beta_object_constructor(interpolator_type, S, constructor) !< Create an instance of concrete extension of [[beta_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(beta_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left-face interpolations. - logical, intent(in), optional :: face_right !< Activate right-face interpolations. type(beta_factory) :: factory !< The factory. call factory%create_constructor(interpolator_type=interpolator_type, & S=S, & - constructor=constructor, & - face_left=face_left, & - face_right=face_right) + constructor=constructor) endsubroutine create_beta_object_constructor - subroutine create_kappa_object_constructor(interpolator_type, S, constructor) + subroutine create_kappa_int_object_constructor(interpolator_type, S, stencil, x_target, interpolations_constructor, constructor) + !< Create an instance of concrete extension of [[kappa_object_constructor]]. + character(*), intent(in) :: interpolator_type !< Type of the interpolator. + integer(I_P), intent(in) :: S !< Stencils dimension. + real(RPP), intent(in) :: stencil(1-S:) !< Stencil used for inter, [1-S:-1+S]. + real(RPP), intent(in) :: x_target !< Coordinate of the interp point. + class(interpolations_object_constructor), intent(in) :: interpolations_constructor !< interpolations constructor. + class(kappa_object_constructor), allocatable, intent(out) :: constructor !< Constructor. + type(kappa_factory) :: factory !< The factory. + + call factory%create_constructor(interpolator_type=interpolator_type, & + S=S, & + stencil=stencil, & + x_target=x_target, & + interpolations_constructor=interpolations_constructor, & + constructor=constructor) + endsubroutine create_kappa_int_object_constructor + + subroutine create_kappa_rec_object_constructor(interpolator_type, S, constructor) !< Create an instance of concrete extension of [[kappa_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(kappa_object_constructor), allocatable, intent(out) :: constructor !< Constructor. type(kappa_factory) :: factory !< The factory. - call factory%create_constructor(interpolator_type=interpolator_type, S=S, constructor=constructor) - endsubroutine create_kappa_object_constructor + call factory%create_constructor(interpolator_type=interpolator_type, & + S=S, & + constructor=constructor) + endsubroutine create_kappa_rec_object_constructor - subroutine create_interpolations_object_constructor(interpolator_type, S, constructor, face_left, face_right) + subroutine create_interpolations_rec_object_constructor(interpolator_type, S, constructor) !< Create an instance of concrete extension of [[interpolations_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(interpolations_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left-face interp. - logical, intent(in), optional :: face_right !< Activate right-face interp. type(interpolations_factory) :: factory !< The factory. call factory%create_constructor(interpolator_type=interpolator_type, & S=S, & - constructor=constructor, & - face_left=face_left, & - face_right=face_right) - endsubroutine create_interpolations_object_constructor + constructor=constructor) + endsubroutine create_interpolations_rec_object_constructor + + subroutine create_interpolations_int_object_constructor(interpolator_type, S, stencil, x_target, constructor) + !< Create an instance of concrete extension of [[interpolations_object_constructor]]. + character(*), intent(in) :: interpolator_type !< Type of the interpolator. + integer(I_P), intent(in) :: S !< Stencils dimension. + real(RPP), intent(in) :: stencil(1-S:) !< Stencil used for inter, [1-S:-1+S]. + real(RPP), intent(in) :: x_target !< Coordinate of the interp point. + class(interpolations_object_constructor), allocatable, intent(out) :: constructor !< Constructor. + type(interpolations_factory) :: factory !< The factory. + + call factory%create_constructor(interpolator_type=interpolator_type, & + S=S, & + stencil=stencil, & + x_target=x_target, & + constructor=constructor) + endsubroutine create_interpolations_int_object_constructor subroutine create_interpolator_object_constructor(interpolator_type, S, interpolations_constructor, weights_constructor, & - constructor, face_left, face_right) + constructor) !< Create an instance of concrete extension of [[interpolator_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. class(interpolations_object_constructor), intent(in) :: interpolations_constructor !< Interpolations const. class(weights_object_constructor), intent(in) :: weights_constructor !< Weights constructor. class(interpolator_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left interp. - logical, intent(in), optional :: face_right !< Activate right interp. type(interpolator_factory) :: factory !< The factory. call factory%create_constructor(interpolator_type=interpolator_type, & S=S, & interpolations_constructor=interpolations_constructor, & weights_constructor=weights_constructor, & - constructor=constructor, & - face_left=face_left, & - face_right=face_right) + constructor=constructor) endsubroutine create_interpolator_object_constructor subroutine create_weights_object_constructor(interpolator_type, S, alpha_constructor, beta_constructor, kappa_constructor, & - constructor, face_left, face_right) + constructor) !< Create an instance of concrete extension of [[weights_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. @@ -266,8 +334,6 @@ subroutine create_weights_object_constructor(interpolator_type, S, alpha_constru class(beta_object_constructor), intent(in) :: beta_constructor !< Beta constructor. class(kappa_object_constructor), intent(in) :: kappa_constructor !< kappa constructor. class(weights_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left-face interp. - logical, intent(in), optional :: face_right !< Activate right-face interp. type(weights_factory) :: factory !< The factory. call factory%create_constructor(interpolator_type=interpolator_type, & @@ -275,8 +341,6 @@ subroutine create_weights_object_constructor(interpolator_type, S, alpha_constru alpha_constructor=alpha_constructor, & beta_constructor=beta_constructor, & kappa_constructor=kappa_constructor, & - constructor=constructor, & - face_left=face_left, & - face_right=face_right) + constructor=constructor) endsubroutine create_weights_object_constructor endmodule wenoof_objects_factory diff --git a/src/lib/factories/wenoof_weights_factory.f90 b/src/lib/factories/wenoof_weights_factory.f90 index 873dda9..c339060 100644 --- a/src/lib/factories/wenoof_weights_factory.f90 +++ b/src/lib/factories/wenoof_weights_factory.f90 @@ -7,7 +7,8 @@ module wenoof_weights_factory use wenoof_beta_object use wenoof_kappa_object use wenoof_weights_object -use wenoof_weights_js +use wenoof_weights_int_js +use wenoof_weights_rec_js implicit none private @@ -28,8 +29,10 @@ subroutine create(constructor, object) class(weights_object), allocatable, intent(out) :: object !< Object. select type(constructor) - type is(weights_js_constructor) - allocate(weights_js :: object) + type is(weights_int_js_constructor) + allocate(weights_int_js :: object) + type is(weights_rec_js_constructor) + allocate(weights_rec_js :: object) class default error stop 'error: WenOOF object factory do NOT know the constructor given' endselect @@ -37,7 +40,7 @@ subroutine create(constructor, object) endsubroutine create subroutine create_constructor(interpolator_type, S, alpha_constructor, beta_constructor, kappa_constructor, & - constructor, face_left, face_right) + constructor) !< Create an instance of concrete extension of [[weights_object_constructor]]. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencils dimension. @@ -45,25 +48,32 @@ subroutine create_constructor(interpolator_type, S, alpha_constructor, beta_cons class(beta_object_constructor), intent(in) :: beta_constructor !< Beta constructor. class(kappa_object_constructor), intent(in) :: kappa_constructor !< kappa constructor. class(weights_object_constructor), allocatable, intent(out) :: constructor !< Constructor. - logical, intent(in), optional :: face_left !< Activate left-face interpolations. - logical, intent(in), optional :: face_right !< Activate right-face interpolations. select case(trim(adjustl(interpolator_type))) case('interpolator-JS') - ! @TODO implement this - error stop 'interpolator-JS to be implemented' + allocate(weights_int_js_constructor :: constructor) + case('interpolator-M-JS') + allocate(weights_int_js_constructor :: constructor) + case('interpolator-M-Z') + allocate(weights_int_js_constructor :: constructor) + case('interpolator-Z') + allocate(weights_int_js_constructor :: constructor) case('reconstructor-JS') - allocate(weights_js_constructor :: constructor) + allocate(weights_rec_js_constructor :: constructor) case('reconstructor-M-JS') - allocate(weights_js_constructor :: constructor) + allocate(weights_rec_js_constructor :: constructor) case('reconstructor-M-Z') - allocate(weights_js_constructor :: constructor) + allocate(weights_rec_js_constructor :: constructor) case('reconstructor-Z') - allocate(weights_js_constructor :: constructor) + allocate(weights_rec_js_constructor :: constructor) endselect - call constructor%create(S=S, face_left=face_left, face_right=face_right) + call constructor%create(S=S) select type(constructor) - type is(weights_js_constructor) + type is(weights_int_js_constructor) + allocate(constructor%alpha_constructor, source=alpha_constructor) + allocate(constructor%beta_constructor, source=beta_constructor) + allocate(constructor%kappa_constructor, source=kappa_constructor) + type is(weights_rec_js_constructor) allocate(constructor%alpha_constructor, source=alpha_constructor) allocate(constructor%beta_constructor, source=beta_constructor) allocate(constructor%kappa_constructor, source=kappa_constructor) diff --git a/src/lib/wenoof.F90 b/src/lib/wenoof.F90 index 9a75e80..6484a4c 100644 --- a/src/lib/wenoof.F90 +++ b/src/lib/wenoof.F90 @@ -15,22 +15,49 @@ module wenoof public :: interpolator_object public :: wenoof_create +interface wenoof_create + module procedure wenoof_create_reconstructor + module procedure wenoof_create_interpolator +end interface wenoof_create + contains - subroutine wenoof_create(interpolator_type, S, interpolator, face_left, face_right, eps) + subroutine wenoof_create_reconstructor(interpolator_type, S, interpolator, eps) !< WenOOF creator, create a concrete WENO interpolator object. character(*), intent(in) :: interpolator_type !< Type of the interpolator. integer(I_P), intent(in) :: S !< Stencil dimension. class(interpolator_object), allocatable, intent(out) :: interpolator !< The concrete WENO interpolator. - logical, intent(in), optional :: face_left !< Activate left-face interpolations. - logical, intent(in), optional :: face_right !< Activate right-face interpolations. real(RPP), intent(in), optional :: eps !< Small epsilon to avoid zero-div. type(objects_factory) :: factory !< The factory. call factory%create(interpolator_type=interpolator_type, & S=S, & interpolator=interpolator, & - face_left=face_left, & - face_right=face_right, & eps=eps) - endsubroutine wenoof_create + endsubroutine wenoof_create_reconstructor + + subroutine wenoof_create_interpolator(interpolator_type, S, x_target, interpolator, eps) + !< WenOOF creator, create a concrete WENO interpolator object. + character(*), intent(in) :: interpolator_type !< Type of the interpolator. + integer(I_P), intent(in) :: S !< Stencil dimension. + real(RPP), intent(in) :: x_target !< Coordinate of the interpolation point. + class(interpolator_object), allocatable, intent(out) :: interpolator !< The concrete WENO interpolator. + real(RPP), intent(in), optional :: eps !< Small epsilon to avoid zero-div. + real(RPP), allocatable :: stencil(:) !< Stencil used for interpolation, [1-S:-1+S]. + integer(I_P) :: i !< Counter. + type(objects_factory) :: factory !< The factory. + + if ((x_target < -0.5_RPP).or.(x_target > 0.5_RPP)) then + error stop 'error: x_target must be between -0.5 and 0.5, that represent left and right cell interfaces' + endif + allocate(stencil(1-S:S-1)) + do i=0,2*S-2 + stencil(-S+1+i) = 1.0_RPP - S + i + enddo + call factory%create(interpolator_type=interpolator_type, & + S=S, & + interpolator=interpolator, & + stencil=stencil, & + x_target=x_target, & + eps=eps) + endsubroutine wenoof_create_interpolator endmodule wenoof diff --git a/src/tests/polynoms_reconstruction.f90 b/src/tests/polynoms_reconstruction.f90 deleted file mode 100644 index a85ae52..0000000 --- a/src/tests/polynoms_reconstruction.f90 +++ /dev/null @@ -1,358 +0,0 @@ -!< WenOOF test: reconstruction of polynomial functions. -module polynoms_test_module -!< Auxiliary module defining the test class. - -use flap, only : command_line_interface -#ifdef r16p -use penf, only: I_P, RPP=>R16P, FRPP=>FR16P, str, strz -#else -use penf, only: I_P, RPP=>R8P, FRPP=>FR8P, str, strz -#endif -use pyplot_module, only : pyplot -use wenoof, only : interpolator_object, wenoof_create -use wenoof_test_ui, only : test_ui - -implicit none -private -public :: test - -type :: solution_data - !< Class to handle solution data. - real(RPP), allocatable :: x_cell(:) !< Cell domain [1-S:points_number+S]. - real(RPP), allocatable :: fx_cell(:) !< Cell refecence values [1-S:points_number+S]. - real(RPP), allocatable :: x_face(:,:) !< Face domain [1:2,1:points_number]. - real(RPP), allocatable :: fx_face(:,:) !< Face reference values [1:2,1:points_number]. - real(RPP), allocatable :: dfx_cell(:) !< Cell refecence values of df/dx [1:points_number]. - real(RPP), allocatable :: interpolations(:,:) !< Interpolated values [1:2,1:points_number]. - real(RPP), allocatable :: reconstruction(:) !< Reconstruction values [1:points_number]. - real(RPP), allocatable :: si(:,:,:) !< Computed smoothness indicators [1:2,1:points_number,0:S-1]. - real(RPP), allocatable :: weights(:,:,:) !< Computed weights [1:2,1:points_number,0:S-1]. - real(RPP) :: Dx=0._RPP !< Space step (spatial resolution). - real(RPP) :: error_L2=0._RPP !< L2 norm of the numerical error. -endtype solution_data - -type :: test - !< Class to handle test(s). - !< - !< Test is driven by the Command Line Interface (CLI) options. - !< - !< Test has only 1 public method `execute`: it executes test(s) accordingly to cli options. - private - type(test_ui) :: ui !< Command line interface handler. - type(solution_data), allocatable :: solution(:,:) !< Solution [1:pn_number, 1:S_number]. - real(RPP), allocatable :: accuracy(:,:) !< Accuracy (measured) [1:pn_number-1, 1:S_number]. - contains - ! public methods - procedure, pass(self) :: execute !< Execute selected test(s). - ! private methods - procedure, pass(self), private :: allocate_solution_data !< Allocate solution data. - procedure, pass(self), private :: analize_errors !< Analize errors. - procedure, pass(self), private :: compute_reference_solution !< Compute reference solution. - procedure, pass(self), private :: deallocate_solution_data !< Deallocate solution data. - procedure, pass(self), private :: perform !< Perform test(s). - procedure, pass(self), private :: save_results_and_plots !< Save results and plots. -endtype test - -contains - ! public methods - subroutine execute(self) - !< Execute test(s). - class(test), intent(inout) :: self !< Test. - integer(I_P) :: s !< Counter. - - call self%ui%get - if (trim(adjustl(self%ui%interpolator_type))/='all') then - call self%perform - else - do while(self%ui%loop_interpolator(interpolator=self%ui%interpolator_type)) - call self%perform - enddo - endif - endsubroutine execute - - ! private methods - subroutine allocate_solution_data(self) - !< Allocate solution data. - class(test), intent(inout) :: self !< Test. - integer(I_P) :: s !< Counter. - integer(I_P) :: pn !< Counter. - - call self%deallocate_solution_data - allocate(self%solution(1:self%ui%pn_number, 1:self%ui%S_number)) - if (self%ui%pn_number>1) then - allocate(self%accuracy(1:self%ui%pn_number, 1:self%ui%S_number)) - self%accuracy = 0._RPP - endif - do s=1, self%ui%S_number - do pn=1, self%ui%pn_number - allocate(self%solution(pn, s)%x_cell( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) - allocate(self%solution(pn, s)%fx_cell(1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) - allocate(self%solution(pn, s)%x_face( 1:2, 1:self%ui%points_number(pn) )) - allocate(self%solution(pn, s)%fx_face( 1:2, 1:self%ui%points_number(pn) )) - allocate(self%solution(pn, s)%dfx_cell( 1:self%ui%points_number(pn) )) - allocate(self%solution(pn, s)%interpolations(1:2, 1:self%ui%points_number(pn) )) - allocate(self%solution(pn, s)%reconstruction( 1:self%ui%points_number(pn) )) - allocate(self%solution(pn, s)%si( 1:2, 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) - allocate(self%solution(pn, s)%weights( 1:2, 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) - self%solution(pn, s)%x_cell = 0._RPP - self%solution(pn, s)%fx_cell = 0._RPP - self%solution(pn, s)%x_face = 0._RPP - self%solution(pn, s)%fx_face = 0._RPP - self%solution(pn, s)%dfx_cell = 0._RPP - self%solution(pn, s)%interpolations = 0._RPP - self%solution(pn, s)%reconstruction = 0._RPP - self%solution(pn, s)%si = 0._RPP - self%solution(pn, s)%weights = 0._RPP - enddo - enddo - endsubroutine allocate_solution_data - - subroutine compute_reference_solution(self) - !< Allocate solution data. - class(test), intent(inout) :: self !< Test. - integer(I_P) :: s !< Counter. - integer(I_P) :: pn !< Counter. - integer(I_P) :: i !< Counter. - - call self%allocate_solution_data - do s=1, self%ui%S_number - do pn=1, self%ui%pn_number - self%solution(pn, s)%Dx = 1._RPP / self%ui%points_number(pn) - ! compute the values used for the interpolation/reconstruction of polynomials function: cell values - do i=1 - self%ui%S(s), self%ui%points_number(pn) + self%ui%S(s) - self%solution(pn, s)%x_cell(i) = i * self%solution(pn, s)%Dx - self%solution(pn, s)%Dx / 2._RPP - self%solution(pn, s)%fx_cell(i) = fx(x=self%solution(pn, s)%x_cell(i), o=2*self%ui%S(s)+2) - enddo - ! values to which the interpolation/reconstruction should tend - do i = 1, self%ui%points_number(pn) - self%solution(pn, s)%x_face(1,i) = self%solution(pn, s)%x_cell(i) - self%solution(pn, s)%Dx / 2._RPP - self%solution(pn, s)%x_face(2,i) = self%solution(pn, s)%x_cell(i) + self%solution(pn, s)%Dx / 2._RPP - self%solution(pn, s)%fx_face(1,i) = fx(self%solution(pn, s)%x_face(1,i), o=2*self%ui%S(s)+2) - self%solution(pn, s)%fx_face(2,i) = fx(self%solution(pn, s)%x_face(2,i), o=2*self%ui%S(s)+2) - self%solution(pn, s)%dfx_cell(i) = dfx_dx(self%solution(pn, s)%x_cell(i), o=2*self%ui%S(s)+2) - enddo - enddo - enddo - endsubroutine compute_reference_solution - - subroutine deallocate_solution_data(self) - !< Deallocate solution data. - class(test), intent(inout) :: self !< Test. - - if (allocated(self%solution)) deallocate(self%solution) - if (allocated(self%accuracy)) deallocate(self%accuracy) - endsubroutine deallocate_solution_data - - subroutine perform(self) - !< Perform the test. - class(test), intent(inout) :: self !< Test. - real(RPP), allocatable :: error(:,:) !< Error (norm L2) with respect the exact solution. - real(RPP), allocatable :: order(:,:) !< Observed order based on subsequent refined solutions. - class(interpolator_object), allocatable :: interpolator !< WENO interpolator. - real(RPP), allocatable :: stencil(:,:) !< Stencils used. - integer(I_P) :: s !< Counter. - integer(I_P) :: pn !< Counter. - integer(I_P) :: i !< Counter. - - call self%compute_reference_solution - do s=1, self%ui%S_number - call wenoof_create(interpolator_type=trim(adjustl(self%ui%interpolator_type)), & - S=self%ui%S(s), & - interpolator=interpolator, & - eps=self%ui%eps) - if (self%ui%verbose) print '(A)', interpolator%description() - allocate(stencil(1:2, 1-self%ui%S(s):-1+self%ui%S(s))) - do pn=1, self%ui%pn_number - do i=1, self%ui%points_number(pn) - stencil(1,:) = self%solution(pn, s)%fx_cell(i+1-self%ui%S(s):i-1+self%ui%S(s)) - stencil(2,:) = self%solution(pn, s)%fx_cell(i+1-self%ui%S(s):i-1+self%ui%S(s)) - call interpolator%interpolate(stencil=stencil, & - interpolation=self%solution(pn, s)%interpolations(:,i), & - si=self%solution(pn, s)%si(:, i, 0:self%ui%S(s)-1), & - weights=self%solution(pn, s)%weights(:, i, 0:self%ui%S(s)-1)) - self%solution(pn, s)%reconstruction(i) = & - (self%solution(pn, s)%interpolations(2,i) - self%solution(pn, s)%interpolations(1,i))/self%solution(pn, s)%Dx - enddo - enddo - deallocate(stencil) - enddo - call self%analize_errors - call self%save_results_and_plots - endsubroutine perform - - subroutine save_results_and_plots(self) - !< Save results and plots. - class(test), intent(inout) :: self !< Test. - type(pyplot) :: plt !< Plot handler. - character(len=:), allocatable :: buffer !< Buffer string. - character(len=:), allocatable :: output_dir !< Output directory. - character(len=:), allocatable :: file_bname !< File base name. - integer(I_P) :: file_unit !< File unit. - integer(I_P) :: s !< Counter. - integer(I_P) :: pn !< Counter. - integer(I_P) :: i !< Counter. - integer(I_P) :: ss !< Counter. - integer(I_P) :: f !< Counter. - - output_dir = trim(adjustl(self%ui%output_dir))//'/' - if (self%ui%results.or.self%ui%plots) call execute_command_line('mkdir -p '//output_dir) - file_bname = output_dir//trim(adjustl(self%ui%output_bname))//'-'//trim(adjustl(self%ui%interpolator_type)) - - if (self%ui%results) then - do s=1, self%ui%S_number - do pn=1, self%ui%pn_number - open(newunit=file_unit, file=file_bname//'-S_'//trim(str(self%ui%S(s), .true.))//& - '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.dat') - buffer = 'VARIABLES = "x" "f(x)" "df_dx(x)" "x_left" "x_right" "f(x)_left" "f(x)_right"' - buffer = buffer//' "reconstruction_left" "reconstruction_right" "df_dx_reconstruction"' - do ss=0, self%ui%S(s)-1 - buffer = buffer//' "si-'//trim(str(ss, .true.))//'_left"'//' "si-'//trim(str(ss, .true.))//'_right"' - enddo - do ss=0, self%ui%S(s)-1 - buffer = buffer//' "W-'//trim(str(ss, .true.))//'_left"'//' "W-'//trim(str(ss, .true.))//'_right"' - enddo - write(file_unit, "(A)") buffer - write(file_unit, "(A)") 'ZONE T = "'//'S_'//trim(str(self%ui%S(s), .true.))//& - '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'"' - associate(x_cell => self%solution(pn, s)%x_cell, & - fx_cell => self%solution(pn, s)%fx_cell, & - dfx_cell => self%solution(pn, s)%dfx_cell, & - x_face => self%solution(pn, s)%x_face, & - fx_face => self%solution(pn, s)%fx_face, & - interpolations => self%solution(pn, s)%interpolations, & - reconstruction => self%solution(pn, s)%reconstruction, & - si => self%solution(pn, s)%si, & - weights => self%solution(pn, s)%weights, & - Dx => self%solution(pn, s)%Dx) - do i = 1, self%ui%points_number(pn) - write(file_unit, "("//trim(str(10+4*self%ui%S(s), .true.))//"("//FRPP//",1X))") & - x_cell(i), & - fx_cell(i), & - dfx_cell(i), & - (x_face(f,i), f=1, 2), & - (fx_face(f,i), f=1, 2), & - (interpolations(f,i), f=1, 2), & - reconstruction(i), & - ((si(f, i, ss), f=1, 2), ss=0, self%ui%S(s)-1), & - ((weights(f, i, ss), f=1, 2), ss=0, self%ui%S(s)-1) - enddo - endassociate - close(file_unit) - enddo - enddo - - if (self%ui%errors_analysis.and.self%ui%pn_number>1) then - open(newunit=file_unit, file=file_bname//'-accuracy.dat') - write(file_unit, "(A)") 'VARIABLES = "S" "Np" "error (L2)" "observed order" "formal order"' - do s=1, self%ui%S_number - do pn=1, self%ui%pn_number - write(file_unit, "(2(I5,1X),"//FRPP//",1X,F5.2,1X,I3)") self%ui%S(s), & - self%ui%points_number(pn), & - self%solution(pn, s)%error_L2, & - self%accuracy(pn, s), & - 2*self%ui%S(s)-1 - enddo - enddo - close(file_unit) - endif - endif - -#ifndef r16p - ! pyplot fortran does not support 128 bit reals - if (self%ui%plots) then - do s=1, self%ui%S_number - do pn=1, self%ui%pn_number - buffer = 'WENO reconstruction of $d f(x)/Dx= i * i * x^{i-1}$; '// & - 'S='//trim(str(self%ui%S(s), .true.))//'Np='//trim(str(self%ui%points_number(pn), .true.)) - call plt%initialize(grid=.true., xlabel='x', title=buffer, legend=.true.) - call plt%add_plot(x=self%solution(pn, s)%x_cell(1:self%ui%points_number(pn)), & - y=self%solution(pn, s)%dfx_cell(:), & - label='$i * i * x^{i-1}$', & - linestyle='k-', & - linewidth=2, & - ylim=[0._RPP, dfx_dx(self%solution(pn, s)%x_cell(self%ui%points_number(pn)), o=2*self%ui%S(s)+2)]) - call plt%add_plot(x=self%solution(pn, s)%x_cell(1:self%ui%points_number(pn)), & - y=self%solution(pn, s)%reconstruction(:), & - label='WENO reconstruction', & - linestyle='ro', & - markersize=6, & - ylim=[0._RPP, dfx_dx(self%solution(pn, s)%x_cell(self%ui%points_number(pn)), o=2*self%ui%S(s)+2)]) - call plt%savefig(file_bname//& - '-S_'//trim(str(self%ui%S(s), .true.))//'-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.png') - enddo - enddo - endif -#endif - endsubroutine save_results_and_plots - - subroutine analize_errors(self) - !< Analize errors. - class(test), intent(inout) :: self !< Test. - integer(I_P) :: s !< Counter. - integer(I_P) :: pn !< Counter. - integer(I_P) :: i !< Counter. - - if (self%ui%errors_analysis) then - do s=1, self%ui%S_number - do pn=1, self%ui%pn_number - associate(error_L2=>self%solution(pn, s)%error_L2, & - Dx=>self%solution(pn, s)%Dx, & - dfx_cell=>self%solution(pn, s)%dfx_cell, & - reconstruction=>self%solution(pn, s)%reconstruction) - error_L2 = 0._RPP - do i=1, self%ui%points_number(pn) - error_L2 = error_L2 + (reconstruction(i) - dfx_cell(i))**2 - enddo - error_L2 = sqrt(error_L2) - endassociate - enddo - enddo - if (self%ui%pn_number>1) then - do s=1, self%ui%S_number - do pn=2, self%ui%pn_number - self%accuracy(pn, s) = log(self%solution(pn - 1, s)%error_L2 / self%solution(pn, s)%error_L2) / & - log(self%solution(pn - 1, s)%Dx / self%solution(pn, s)%Dx) - enddo - enddo - endif - endif - endsubroutine analize_errors - - ! non TBP - pure function fx(x, o) result(y) - !< Interface function. - real(RPP), intent(in) :: x !< X value. - integer(I_P), intent(in) :: o !< Polynomial order. - real(RPP) :: y !< Y value. - integer(I_P) :: i !< Counter. - - y = 0._RPP - do i=1, o - y = y + i * (x ** i) - enddo - endfunction fx - - pure function dfx_dx(x, o) result(y) - !< Derivative of interface function. - real(RPP), intent(in) :: x !< X value. - integer(I_P), intent(in) :: o !< Polynomial order. - real(RPP) :: y !< Y value. - integer(I_P) :: i !< Counter. - - y = 0._RPP - do i=1, o - y = y + i * i * (x ** (i - 1)) - enddo - endfunction dfx_dx -endmodule polynoms_test_module - -program polynoms_reconstruction -!< WenOOF test: reconstruction of polynomial functions. - -use polynoms_test_module - -implicit none -type(test) :: sin_test - -call sin_test%execute -endprogram polynoms_reconstruction diff --git a/src/tests/polynoms_test.f90 b/src/tests/polynoms_test.f90 new file mode 100644 index 0000000..7335f44 --- /dev/null +++ b/src/tests/polynoms_test.f90 @@ -0,0 +1,546 @@ +!< WenOOF test: interpolation or reconstruction of polynomial functions. +module polynoms_test_module +!< Auxiliary module defining the test class. + +use flap, only : command_line_interface +#ifdef r16p +use penf, only: I_P, RPP=>R16P, FRPP=>FR16P, str, strz +#else +use penf, only: I_P, RPP=>R8P, FRPP=>FR8P, str, strz +#endif +use pyplot_module, only : pyplot +use wenoof, only : interpolator_object, wenoof_create +use wenoof_test_ui, only : test_ui + +implicit none +private +public :: test + +real(RPP), parameter :: pi = 4._RPP * atan(1._RPP) !< Pi greek. + +type :: solution_data + !< Class to handle solution data. + real(RPP), allocatable :: x_cell(:) !< Cell domain [1-S:points_number+S]. + real(RPP), allocatable :: fx_cell(:) !< Cell refecence values [1-S:points_number+S]. + real(RPP), allocatable :: x_face(:,:) !< Face domain [1:2,1:points_number]. + real(RPP), allocatable :: fx_face(:,:) !< Face reference values [1:2,1:points_number]. + real(RPP), allocatable :: x_int(:) !< Interpolation domain [1-S:points_number+S]. + real(RPP), allocatable :: fx_int(:) !< Interpolation refecence values [1-S:points_number+S]. + real(RPP), allocatable :: dfx_cell(:) !< Cell refecence values of df/dx [1:points_number]. + real(RPP), allocatable :: interpolations(:,:) !< Interpolated values [1:2,1:points_number]. + real(RPP), allocatable :: reconstruction(:) !< Reconstruction values [1:2,1:points_number]. + real(RPP), allocatable :: si_r(:,:,:) !< Computed smoothness indicators [1:2,1:points_number,0:S-1]. + real(RPP), allocatable :: weights_r(:,:,:) !< Computed weights [1:2,1:points_number,0:S-1]. + real(RPP), allocatable :: interpolation(:) !< Interpolated values [1:points_number]. + real(RPP), allocatable :: si_i(:,:) !< Computed smoothness indicators [1:points_number,0:S-1]. + real(RPP), allocatable :: weights_i(:,:) !< Computed weights [1:points_number,0:S-1]. + real(RPP) :: error_L2 !< L2 norm of the numerical error. + real(RPP) :: x_target !< Abscissa of the interpolation [-0.5:0.5]. + real(RPP) :: Dx=0._RPP !< Space step (spatial resolution). +endtype solution_data + +type :: test + !< Class to handle test(s). + !< + !< Test is driven by the Command Line Interface (CLI) options. + !< + !< Test has only 1 public method `execute`: it executes test(s) accordingly to cli options. + private + type(test_ui) :: ui !< Command line interface handler. + type(solution_data), allocatable :: solution(:,:) !< Solution [1:pn_number, 1:S_number]. + real(RPP), allocatable :: accuracy(:,:) !< Accuracy (measured) [1:pn_number-1, 1:S_number]. + contains + ! public methods + procedure, pass(self) :: execute !< Execute selected test(s). + ! private methods + procedure, pass(self), private :: allocate_solution_data !< Allocate solution data. + procedure, pass(self), private :: analize_errors !< Analize errors. + procedure, pass(self), private :: compute_reference_solution !< Compute reference solution. + procedure, pass(self), private :: deallocate_solution_data !< Deallocate solution data. + procedure, pass(self), private :: perform !< Perform test(s). + procedure, pass(self), private :: save_results_and_plots !< Save results and plots. +endtype test + +contains + ! public methods + subroutine execute(self) + !< Execute test(s). + class(test), intent(inout) :: self !< Test. + + call self%ui%get + if (self%ui%interpolate.and.self%ui%reconstruct) then + call subexecute + self%ui%interpolate = .false. + call subexecute + else + call subexecute + endif + contains + subroutine subexecute + !< Subexecute test(s). + + if (trim(adjustl(self%ui%interpolator_type))/='all') then + call self%perform + else + do while(self%ui%loop_interpolator(interpolator=self%ui%interpolator_type)) + call self%perform + enddo + endif + endsubroutine subexecute + endsubroutine execute + + ! private methods + subroutine allocate_solution_data(self) + !< Allocate solution data. + class(test), intent(inout) :: self !< Test. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + + call self%deallocate_solution_data + allocate(self%solution(1:self%ui%pn_number, 1:self%ui%S_number)) + if (self%ui%pn_number>1) then + allocate(self%accuracy(1:self%ui%pn_number, 1:self%ui%S_number)) + self%accuracy = 0._RPP + endif + if (self%ui%interpolate) then + self%solution%x_target = self%ui%x_target + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + allocate(self%solution(pn, s)%x_cell( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%fx_cell(1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%x_int( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%fx_int( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%interpolation( 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%si_i( 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) + allocate(self%solution(pn, s)%weights_i( 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) + self%solution(pn, s)%x_cell = 0._RPP + self%solution(pn, s)%fx_cell = 0._RPP + self%solution(pn, s)%x_int = 0._RPP + self%solution(pn, s)%fx_int = 0._RPP + self%solution(pn, s)%interpolation = 0._RPP + self%solution(pn, s)%si_i = 0._RPP + self%solution(pn, s)%weights_i = 0._RPP + self%solution(pn, s)%error_L2 = 0._RPP + enddo + enddo + else + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + allocate(self%solution(pn, s)%x_cell( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%fx_cell(1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%x_face( 1:2, 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%fx_face( 1:2, 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%dfx_cell( 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%interpolations(1:2, 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%reconstruction( 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%si_r( 1:2, 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) + allocate(self%solution(pn, s)%weights_r( 1:2, 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) + self%solution(pn, s)%x_cell = 0._RPP + self%solution(pn, s)%fx_cell = 0._RPP + self%solution(pn, s)%x_face = 0._RPP + self%solution(pn, s)%fx_face = 0._RPP + self%solution(pn, s)%dfx_cell = 0._RPP + self%solution(pn, s)%interpolations = 0._RPP + self%solution(pn, s)%reconstruction = 0._RPP + self%solution(pn, s)%si_r = 0._RPP + self%solution(pn, s)%weights_r = 0._RPP + self%solution(pn, s)%error_L2 = 0._RPP + enddo + enddo + endif + endsubroutine allocate_solution_data + + subroutine compute_reference_solution(self) + !< Allocate solution data. + class(test), intent(inout) :: self !< Test. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + integer(I_P) :: i !< Counter. + + call self%allocate_solution_data + if (self%ui%interpolate) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + self%solution(pn, s)%Dx = 1._RPP / self%ui%points_number(pn) + ! compute the values used for the interpolation of polynomials function: cell values + do i=1 - self%ui%S(s), self%ui%points_number(pn) + self%ui%S(s) + self%solution(pn, s)%x_cell(i) = i * self%solution(pn, s)%Dx - self%solution(pn, s)%Dx / 2._RPP + self%solution(pn, s)%fx_cell(i) = interface_function(x=self%solution(pn, s)%x_cell(i), o=2*self%ui%S(s)+2) + enddo + ! values to which the interpolation should tend + do i = 1, self%ui%points_number(pn) + self%solution(pn, s)%x_int(i) = self%solution(pn, s)%x_cell(i) + self%solution(pn, s)%x_target * self%solution(pn, s)%Dx + self%solution(pn, s)%fx_int(i) = interface_function(self%solution(pn, s)%x_int(i), o=2*self%ui%S(s)+2) + enddo + enddo + enddo + else + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + self%solution(pn, s)%Dx = 1._RPP / self%ui%points_number(pn) + ! compute the values used for the interpolation/reconstruction of polynomials function: cell values + do i=1 - self%ui%S(s), self%ui%points_number(pn) + self%ui%S(s) + self%solution(pn, s)%x_cell(i) = i * self%solution(pn, s)%Dx - self%solution(pn, s)%Dx / 2._RPP + self%solution(pn, s)%fx_cell(i) = interface_function(x=self%solution(pn, s)%x_cell(i), o=2*self%ui%S(s)+2) + enddo + ! values to which the interpolation/reconstruction should tend + do i = 1, self%ui%points_number(pn) + self%solution(pn, s)%x_face(1,i) = self%solution(pn, s)%x_cell(i) - self%solution(pn, s)%Dx / 2._RPP + self%solution(pn, s)%x_face(2,i) = self%solution(pn, s)%x_cell(i) + self%solution(pn, s)%Dx / 2._RPP + self%solution(pn, s)%fx_face(1,i) = interface_function(self%solution(pn, s)%x_face(1,i), o=2*self%ui%S(s)+2) + self%solution(pn, s)%fx_face(2,i) = interface_function(self%solution(pn, s)%x_face(2,i), o=2*self%ui%S(s)+2) + self%solution(pn, s)%dfx_cell(i) = dinterface_function_dx(self%solution(pn, s)%x_cell(i), o=2*self%ui%S(s)+2) + enddo + enddo + enddo + endif + endsubroutine compute_reference_solution + + subroutine deallocate_solution_data(self) + !< Deallocate solution data. + class(test), intent(inout) :: self !< Test. + + if (allocated(self%solution)) deallocate(self%solution) + if (allocated(self%accuracy)) deallocate(self%accuracy) + endsubroutine deallocate_solution_data + + subroutine perform(self) + !< Perform the test. + class(test), intent(inout) :: self !< Test. + class(interpolator_object), allocatable :: interpolator !< WENO interpolator. + real(RPP), allocatable :: stencil_i(:) !< Stencils used for interpolation. + real(RPP), allocatable :: stencil_r(:,:) !< Stencils used for reconstruction. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + integer(I_P) :: i !< Counter. + + call self%compute_reference_solution + if (self%ui%interpolate) then + do s=1, self%ui%S_number + call wenoof_create(interpolator_type='interpolator-'//trim(adjustl(self%ui%interpolator_type)), & + S=self%ui%S(s), & + x_target=0.3_RPP, & + interpolator=interpolator, & + eps=self%ui%eps) + if (self%ui%verbose) print '(A)', interpolator%description() + allocate(stencil_i(1-self%ui%S(s):-1+self%ui%S(s))) + do pn=1, self%ui%pn_number + do i=1, self%ui%points_number(pn) + stencil_i(:) = self%solution(pn, s)%fx_cell(i+1-self%ui%S(s):i-1+self%ui%S(s)) + call interpolator%interpolate(stencil=stencil_i, & + interpolation=self%solution(pn, s)%interpolation(i), & + si=self%solution(pn, s)%si_i(i, 0:self%ui%S(s)-1), & + weights=self%solution(pn, s)%weights_i(i, 0:self%ui%S(s)-1)) + enddo + enddo + deallocate(stencil_i) + enddo + else + do s=1, self%ui%S_number + call wenoof_create(interpolator_type='reconstructor-'//trim(adjustl(self%ui%interpolator_type)), & + S=self%ui%S(s), & + interpolator=interpolator, & + eps=self%ui%eps) + if (self%ui%verbose) print '(A)', interpolator%description() + allocate(stencil_r(1:2, 1-self%ui%S(s):-1+self%ui%S(s))) + do pn=1, self%ui%pn_number + do i=1, self%ui%points_number(pn) + stencil_r(1,:) = self%solution(pn, s)%fx_cell(i+1-self%ui%S(s):i-1+self%ui%S(s)) + stencil_r(2,:) = self%solution(pn, s)%fx_cell(i+1-self%ui%S(s):i-1+self%ui%S(s)) + call interpolator%interpolate(stencil=stencil_r, & + interpolation=self%solution(pn, s)%interpolations(:,i), & + si=self%solution(pn, s)%si_r(:, i, 0:self%ui%S(s)-1), & + weights=self%solution(pn, s)%weights_r(:, i, 0:self%ui%S(s)-1)) + self%solution(pn, s)%reconstruction(i) = & + (self%solution(pn, s)%interpolations(2,i) - self%solution(pn, s)%interpolations(1,i))/self%solution(pn, s)%Dx + enddo + enddo + deallocate(stencil_r) + enddo + endif + call self%analize_errors + call self%save_results_and_plots + endsubroutine perform + + subroutine save_results_and_plots(self) + !< Save results and plots. + class(test), intent(inout) :: self !< Test. + type(pyplot) :: plt !< Plot handler. + character(len=:), allocatable :: buffer !< Buffer string. + character(len=:), allocatable :: output_dir !< Output directory. + character(len=:), allocatable :: file_bname !< File base name. + integer(I_P) :: file_unit !< File unit. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + integer(I_P) :: i !< Counter. + integer(I_P) :: ss !< Counter. + integer(I_P) :: f !< Counter. + + output_dir = trim(adjustl(self%ui%output_dir))//'/' + if (self%ui%results.or.self%ui%plots) call execute_command_line('mkdir -p '//output_dir) + + if (self%ui%interpolate) then + file_bname = output_dir//trim(adjustl(self%ui%output_bname))//'-interpolator-'//trim(adjustl(self%ui%interpolator_type)) + if (self%ui%results) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + open(newunit=file_unit, file=file_bname//'-S_'//trim(str(self%ui%S(s), .true.))//& + '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.dat') + buffer = 'VARIABLES = "x" "f(x)" "x_int" "f(x)_int" "interpolation"' + do ss=0, self%ui%S(s)-1 + buffer = buffer//' "si-'//trim(str(ss, .true.)) + enddo + do ss=0, self%ui%S(s)-1 + buffer = buffer//' "W-'//trim(str(ss, .true.)) + enddo + write(file_unit, "(A)") buffer + write(file_unit, "(A)") 'ZONE T = "'//'S_'//trim(str(self%ui%S(s), .true.))//& + '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'"' + associate(x_cell => self%solution(pn, s)%x_cell, & + fx_cell => self%solution(pn, s)%fx_cell, & + x_int => self%solution(pn, s)%x_int, & + fx_int => self%solution(pn, s)%fx_int, & + interpolation => self%solution(pn, s)%interpolation, & + si => self%solution(pn, s)%si_i, & + weights => self%solution(pn, s)%weights_i, & + Dx => self%solution(pn, s)%Dx) + do i = 1, self%ui%points_number(pn) + write(file_unit, "("//trim(str(5+2*self%ui%S(s), .true.))//"("//FRPP//",1X))") & + x_cell(i), & + fx_cell(i), & + x_int(i), & + fx_int(i), & + interpolation(i), & + (si(i, ss), ss=0, self%ui%S(s)-1), & + (weights(i, ss), ss=0, self%ui%S(s)-1) + enddo + endassociate + close(file_unit) + enddo + enddo + + if (self%ui%errors_analysis.and.self%ui%pn_number>1) then + open(newunit=file_unit, file=file_bname//'-accuracy.dat') + write(file_unit, "(A)") 'VARIABLES = "S" "Np" "error (L2)" "observed order" "formal order"' + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + write(file_unit, "(2(I5,1X),"//FRPP//",1X,F5.2,1X,I3)") self%ui%S(s), & + self%ui%points_number(pn), & + self%solution(pn, s)%error_L2, & + self%accuracy(pn, s), & + 2*self%ui%S(s)-1 + enddo + enddo + close(file_unit) + endif + endif + else + file_bname = output_dir//trim(adjustl(self%ui%output_bname))//'-reconstructor-'//trim(adjustl(self%ui%interpolator_type)) + if (self%ui%results) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + open(newunit=file_unit, file=file_bname//'-S_'//trim(str(self%ui%S(s), .true.))//& + '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.dat') + buffer = 'VARIABLES = "x" "f(x)" "df_dx(x)" "x_left" "x_right" "f(x)_left" "f(x)_right"' + buffer = buffer//' "reconstruction_left" "reconstruction_right" "df_dx_reconstruction"' + do ss=0, self%ui%S(s)-1 + buffer = buffer//' "si-'//trim(str(ss, .true.))//'_left"'//' "si-'//trim(str(ss, .true.))//'_right"' + enddo + do ss=0, self%ui%S(s)-1 + buffer = buffer//' "W-'//trim(str(ss, .true.))//'_left"'//' "W-'//trim(str(ss, .true.))//'_right"' + enddo + write(file_unit, "(A)") buffer + write(file_unit, "(A)") 'ZONE T = "'//'S_'//trim(str(self%ui%S(s), .true.))//& + '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'"' + associate(x_cell => self%solution(pn, s)%x_cell, & + fx_cell => self%solution(pn, s)%fx_cell, & + dfx_cell => self%solution(pn, s)%dfx_cell, & + x_face => self%solution(pn, s)%x_face, & + fx_face => self%solution(pn, s)%fx_face, & + interpolations => self%solution(pn, s)%interpolations, & + reconstruction => self%solution(pn, s)%reconstruction, & + si => self%solution(pn, s)%si_r, & + weights => self%solution(pn, s)%weights_r, & + Dx => self%solution(pn, s)%Dx) + do i = 1, self%ui%points_number(pn) + write(file_unit, "("//trim(str(10+4*self%ui%S(s), .true.))//"("//FRPP//",1X))") & + x_cell(i), & + fx_cell(i), & + dfx_cell(i), & + (x_face(f,i), f=1, 2), & + (fx_face(f,i), f=1, 2), & + (interpolations(f,i), f=1, 2), & + reconstruction(i), & + ((si(f, i, ss), f=1, 2), ss=0, self%ui%S(s)-1), & + ((weights(f, i, ss), f=1, 2), ss=0, self%ui%S(s)-1) + enddo + endassociate + close(file_unit) + enddo + enddo + + if (self%ui%errors_analysis.and.self%ui%pn_number>1) then + open(newunit=file_unit, file=file_bname//'-accuracy.dat') + write(file_unit, "(A)") 'VARIABLES = "S" "Np" "error (L2)" "observed order" "formal order"' + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + write(file_unit, "(2(I5,1X),"//FRPP//",1X,F5.2,1X,I3)") self%ui%S(s), & + self%ui%points_number(pn), & + self%solution(pn, s)%error_L2, & + self%accuracy(pn, s), & + 2*self%ui%S(s)-1 + enddo + enddo + close(file_unit) + endif + endif + endif + +#ifndef r16p + ! pyplot fortran does not support 128 bit reals + if (self%ui%plots) then + if (self%ui%interpolate) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + buffer = 'WENO interpolation of polynomial function; '//& + 'S='//trim(str(self%ui%S(s), .true.))//'Np='//trim(str(self%ui%points_number(pn), .true.)) + call plt%initialize(grid=.true., xlabel='x (m)', title=buffer, legend=.true.) + call plt%add_plot(x=self%solution(pn, s)%x_cell(1:self%ui%points_number(pn)), & + y=self%solution(pn, s)%fx_cell(:), & + label='polynom', & + linestyle='k-', & + linewidth=2, & + ylim=[-1.1_RPP, 1.1_RPP]) + call plt%add_plot(x=self%solution(pn, s)%x_int(1:self%ui%points_number(pn)), & + y=self%solution(pn, s)%interpolation(:), & + label='WENO interpolation', & + linestyle='ro', & + markersize=6, & + ylim=[-1.1_RPP, 1.1_RPP]) + call plt%savefig(file_bname//& + '-S_'//trim(str(self%ui%S(s), .true.))//'-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.png') + enddo + enddo + else + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + buffer = 'WENO reconstruction of $d \p(x)/Dx; '//& + 'S='//trim(str(self%ui%S(s), .true.))//'Np='//trim(str(self%ui%points_number(pn), .true.)) + call plt%initialize(grid=.true., xlabel='x (m)', title=buffer, legend=.true.) + call plt%add_plot(x=self%solution(pn, s)%x_cell(1:self%ui%points_number(pn)), & + y=self%solution(pn, s)%dfx_cell(:), & + label='dp', & + linestyle='k-', & + linewidth=2, & + ylim=[-1.1_RPP, 1.1_RPP]) + call plt%add_plot(x=self%solution(pn, s)%x_cell(1:self%ui%points_number(pn)), & + y=self%solution(pn, s)%reconstruction(:), & + label='WENO reconstruction', & + linestyle='ro', & + markersize=6, & + ylim=[-1.1_RPP, 1.1_RPP]) + call plt%savefig(file_bname//& + '-S_'//trim(str(self%ui%S(s), .true.))//'-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.png') + enddo + enddo + endif + endif +#endif + endsubroutine save_results_and_plots + + subroutine analize_errors(self) + !< Analize errors. + class(test), intent(inout) :: self !< Test. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + integer(I_P) :: i !< Counter. + + if (self%ui%errors_analysis) then + if (self%ui%interpolate) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + associate(error_L2=>self%solution(pn, s)%error_L2, & + Dx=>self%solution(pn, s)%Dx, & + fx_int=>self%solution(pn, s)%fx_int, & + interpolation=>self%solution(pn, s)%interpolation) + error_L2 = 0._RPP + do i=1, self%ui%points_number(pn) + error_L2 = error_L2 + (interpolation(i) - fx_int(i))**2 + enddo + error_L2 = sqrt(error_L2) + endassociate + enddo + enddo + if (self%ui%pn_number>1) then + do s=1, self%ui%S_number + do pn=2, self%ui%pn_number + self%accuracy(pn, s) = log(self%solution(pn - 1, s)%error_L2 / self%solution(pn, s)%error_L2) / & + log(self%solution(pn - 1, s)%Dx / self%solution(pn, s)%Dx) + enddo + enddo + endif + else + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + associate(error_L2=>self%solution(pn, s)%error_L2, & + Dx=>self%solution(pn, s)%Dx, & + dfx_cell=>self%solution(pn, s)%dfx_cell, & + reconstruction=>self%solution(pn, s)%reconstruction) + error_L2 = 0._RPP + do i=1, self%ui%points_number(pn) + error_L2 = error_L2 + (reconstruction(i) - dfx_cell(i))**2 + enddo + error_L2 = sqrt(error_L2) + endassociate + enddo + enddo + if (self%ui%pn_number>1) then + do s=1, self%ui%S_number + do pn=2, self%ui%pn_number + self%accuracy(pn, s) = log(self%solution(pn - 1, s)%error_L2 / self%solution(pn, s)%error_L2) / & + log(self%solution(pn - 1, s)%Dx / self%solution(pn, s)%Dx) + enddo + enddo + endif + endif + endif + endsubroutine analize_errors + + ! non TBP + pure function interface_function(x, o) result(y) + !< Interface function. + real(RPP), intent(in) :: x !< X value. + integer(I_P), intent(in) :: o !< Polynomial order. + real(RPP) :: y !< Y value. + integer(I_P) :: i !< Counter. + + y = 0._RPP + do i=1, o + y = y + i * (x ** i) + enddo + endfunction interface_function + + pure function dinterface_function_dx(x, o) result(y) + !< Derivative of interface function. + real(RPP), intent(in) :: x !< X value. + integer(I_P), intent(in) :: o !< Polynomial order. + real(RPP) :: y !< Y value. + integer(I_P) :: i !< Counter. + + y = 0._RPP + do i=1, o + y = y + i * i * (x ** (i - 1)) + enddo + endfunction dinterface_function_dx +endmodule polynoms_test_module + +program polynoms_test_program +!< WenOOF test: interpolation of polynomial functions. + +use polynoms_test_module + +implicit none +type(test) :: polynoms_test + +call polynoms_test%execute +endprogram polynoms_test_program diff --git a/src/tests/sin_test.f90 b/src/tests/sin_test.f90 new file mode 100644 index 0000000..e7f3949 --- /dev/null +++ b/src/tests/sin_test.f90 @@ -0,0 +1,518 @@ +!< WenOOF test: interpolation or reconstruction of sine function. +module sin_test_module +!< Auxiliary module defining the test class. + +use flap, only : command_line_interface +#ifdef r16p +use penf, only: I_P, RPP=>R16P, FRPP=>FR16P, str, strz +#else +use penf, only: I_P, RPP=>R8P, FRPP=>FR8P, str, strz +#endif +use pyplot_module, only : pyplot +use wenoof, only : interpolator_object, wenoof_create +use wenoof_test_ui, only : test_ui + +implicit none +private +public :: test + +real(RPP), parameter :: pi = 4._RPP * atan(1._RPP) !< Pi greek. + +type :: solution_data + !< Class to handle solution data. + real(RPP), allocatable :: x_cell(:) !< Cell domain [1-S:points_number+S]. + real(RPP), allocatable :: fx_cell(:) !< Cell refecence values [1-S:points_number+S]. + real(RPP), allocatable :: x_face(:,:) !< Face domain [1:2,1:points_number]. + real(RPP), allocatable :: fx_face(:,:) !< Face reference values [1:2,1:points_number]. + real(RPP), allocatable :: x_int(:) !< Interpolation domain [1-S:points_number+S]. + real(RPP), allocatable :: fx_int(:) !< Interpolation refecence values [1-S:points_number+S]. + real(RPP), allocatable :: dfx_cell(:) !< Cell refecence values of df/dx [1:points_number]. + real(RPP), allocatable :: interpolations(:,:) !< Interpolated values [1:2,1:points_number]. + real(RPP), allocatable :: reconstruction(:) !< Reconstruction values [1:2,1:points_number]. + real(RPP), allocatable :: si_r(:,:,:) !< Computed smoothness indicators [1:2,1:points_number,0:S-1]. + real(RPP), allocatable :: weights_r(:,:,:) !< Computed weights [1:2,1:points_number,0:S-1]. + real(RPP), allocatable :: interpolation(:) !< Interpolated values [1:points_number]. + real(RPP), allocatable :: si_i(:,:) !< Computed smoothness indicators [1:points_number,0:S-1]. + real(RPP), allocatable :: weights_i(:,:) !< Computed weights [1:points_number,0:S-1]. + real(RPP) :: error_L2 !< L2 norm of the numerical error. + real(RPP) :: x_target !< Abscissa of the interpolation [-0.5:0.5]. + real(RPP) :: Dx=0._RPP !< Space step (spatial resolution). +endtype solution_data + +type :: test + !< Class to handle test(s). + !< + !< Test is driven by the Command Line Interface (CLI) options. + !< + !< Test has only 1 public method `execute`: it executes test(s) accordingly to cli options. + private + type(test_ui) :: ui !< Command line interface handler. + type(solution_data), allocatable :: solution(:,:) !< Solution [1:pn_number, 1:S_number]. + real(RPP), allocatable :: accuracy(:,:) !< Accuracy (measured) [1:pn_number-1, 1:S_number]. + contains + ! public methods + procedure, pass(self) :: execute !< Execute selected test(s). + ! private methods + procedure, pass(self), private :: allocate_solution_data !< Allocate solution data. + procedure, pass(self), private :: analize_errors !< Analize errors. + procedure, pass(self), private :: compute_reference_solution !< Compute reference solution. + procedure, pass(self), private :: deallocate_solution_data !< Deallocate solution data. + procedure, pass(self), private :: perform !< Perform test(s). + procedure, pass(self), private :: save_results_and_plots !< Save results and plots. +endtype test + +contains + ! public methods + subroutine execute(self) + !< Execute test(s). + class(test), intent(inout) :: self !< Test. + + call self%ui%get + if (self%ui%interpolate.and.self%ui%reconstruct) then + call subexecute + self%ui%interpolate = .false. + call subexecute + else + call subexecute + endif + contains + subroutine subexecute + !< Subexecute test(s). + + if (trim(adjustl(self%ui%interpolator_type))/='all') then + call self%perform + else + do while(self%ui%loop_interpolator(interpolator=self%ui%interpolator_type)) + call self%perform + enddo + endif + endsubroutine subexecute + endsubroutine execute + + ! private methods + subroutine allocate_solution_data(self) + !< Allocate solution data. + class(test), intent(inout) :: self !< Test. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + + call self%deallocate_solution_data + allocate(self%solution(1:self%ui%pn_number, 1:self%ui%S_number)) + if (self%ui%pn_number>1) then + allocate(self%accuracy(1:self%ui%pn_number, 1:self%ui%S_number)) + self%accuracy = 0._RPP + endif + if (self%ui%interpolate) then + self%solution%x_target = self%ui%x_target + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + allocate(self%solution(pn, s)%x_cell( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%fx_cell(1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%x_int( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%fx_int( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%interpolation( 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%si_i( 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) + allocate(self%solution(pn, s)%weights_i( 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) + self%solution(pn, s)%x_cell = 0._RPP + self%solution(pn, s)%fx_cell = 0._RPP + self%solution(pn, s)%x_int = 0._RPP + self%solution(pn, s)%fx_int = 0._RPP + self%solution(pn, s)%interpolation = 0._RPP + self%solution(pn, s)%si_i = 0._RPP + self%solution(pn, s)%weights_i = 0._RPP + self%solution(pn, s)%error_L2 = 0._RPP + enddo + enddo + else + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + allocate(self%solution(pn, s)%x_cell( 1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%fx_cell(1-self%ui%S(s):self%ui%points_number(pn)+self%ui%S(s) )) + allocate(self%solution(pn, s)%x_face( 1:2, 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%fx_face( 1:2, 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%dfx_cell( 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%interpolations(1:2, 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%reconstruction( 1:self%ui%points_number(pn) )) + allocate(self%solution(pn, s)%si_r( 1:2, 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) + allocate(self%solution(pn, s)%weights_r( 1:2, 1:self%ui%points_number(pn), 0:self%ui%S(s)-1)) + self%solution(pn, s)%x_cell = 0._RPP + self%solution(pn, s)%fx_cell = 0._RPP + self%solution(pn, s)%x_face = 0._RPP + self%solution(pn, s)%fx_face = 0._RPP + self%solution(pn, s)%dfx_cell = 0._RPP + self%solution(pn, s)%interpolations = 0._RPP + self%solution(pn, s)%reconstruction = 0._RPP + self%solution(pn, s)%si_r = 0._RPP + self%solution(pn, s)%weights_r = 0._RPP + self%solution(pn, s)%error_L2 = 0._RPP + enddo + enddo + endif + endsubroutine allocate_solution_data + + subroutine compute_reference_solution(self) + !< Allocate solution data. + class(test), intent(inout) :: self !< Test. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + integer(I_P) :: i !< Counter. + + call self%allocate_solution_data + if (self%ui%interpolate) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + self%solution(pn, s)%Dx = 2 * pi / self%ui%points_number(pn) + ! compute the values used for the interpolation of sin function: cell values + do i=1 - self%ui%S(s), self%ui%points_number(pn) + self%ui%S(s) + self%solution(pn, s)%x_cell(i) = i * self%solution(pn, s)%Dx - self%solution(pn, s)%Dx / 2._RPP + self%solution(pn, s)%fx_cell(i) = sin(self%solution(pn, s)%x_cell(i)) + enddo + ! values to which the interpolation should tend + do i = 1, self%ui%points_number(pn) + self%solution(pn, s)%x_int(i) = self%solution(pn, s)%x_cell(i) + self%solution(pn, s)%x_target * self%solution(pn, s)%Dx + self%solution(pn, s)%fx_int(i) = sin(self%solution(pn, s)%x_int(i)) + enddo + enddo + enddo + else + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + self%solution(pn, s)%Dx = 2 * pi / self%ui%points_number(pn) + ! compute the values used for the interpolation/reconstruction of cos function: cell values + do i=1 - self%ui%S(s), self%ui%points_number(pn) + self%ui%S(s) + self%solution(pn, s)%x_cell(i) = i * self%solution(pn, s)%Dx - self%solution(pn, s)%Dx / 2._RPP + self%solution(pn, s)%fx_cell(i) = sin(self%solution(pn, s)%x_cell(i)) + enddo + ! values to which the interpolation/reconstruction should tend + do i = 1, self%ui%points_number(pn) + self%solution(pn, s)%x_face(1,i) = self%solution(pn, s)%x_cell(i) - self%solution(pn, s)%Dx / 2._RPP + self%solution(pn, s)%x_face(2,i) = self%solution(pn, s)%x_cell(i) + self%solution(pn, s)%Dx / 2._RPP + self%solution(pn, s)%fx_face(1,i) = sin(self%solution(pn, s)%x_face(1,i)) + self%solution(pn, s)%fx_face(2,i) = sin(self%solution(pn, s)%x_face(2,i)) + self%solution(pn, s)%dfx_cell(i) = cos(self%solution(pn, s)%x_cell(i)) + enddo + enddo + enddo + endif + endsubroutine compute_reference_solution + + subroutine deallocate_solution_data(self) + !< Deallocate solution data. + class(test), intent(inout) :: self !< Test. + + if (allocated(self%solution)) deallocate(self%solution) + if (allocated(self%accuracy)) deallocate(self%accuracy) + endsubroutine deallocate_solution_data + + subroutine perform(self) + !< Perform the test. + class(test), intent(inout) :: self !< Test. + class(interpolator_object), allocatable :: interpolator !< WENO interpolator. + real(RPP), allocatable :: stencil_i(:) !< Stencils used for interpolation. + real(RPP), allocatable :: stencil_r(:,:) !< Stencils used for reconstruction. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + integer(I_P) :: i !< Counter. + + call self%compute_reference_solution + if (self%ui%interpolate) then + do s=1, self%ui%S_number + call wenoof_create(interpolator_type='interpolator-'//trim(adjustl(self%ui%interpolator_type)), & + S=self%ui%S(s), & + x_target=self%ui%x_target, & + interpolator=interpolator, & + eps=self%ui%eps) + if (self%ui%verbose) print '(A)', interpolator%description() + allocate(stencil_i(1-self%ui%S(s):-1+self%ui%S(s))) + do pn=1, self%ui%pn_number + do i=1, self%ui%points_number(pn) + stencil_i(:) = self%solution(pn, s)%fx_cell(i+1-self%ui%S(s):i-1+self%ui%S(s)) + call interpolator%interpolate(stencil=stencil_i, & + interpolation=self%solution(pn, s)%interpolation(i), & + si=self%solution(pn, s)%si_i(i, 0:self%ui%S(s)-1), & + weights=self%solution(pn, s)%weights_i(i, 0:self%ui%S(s)-1)) + enddo + enddo + deallocate(stencil_i) + enddo + else + do s=1, self%ui%S_number + call wenoof_create(interpolator_type='reconstructor-'//trim(adjustl(self%ui%interpolator_type)), & + S=self%ui%S(s), & + interpolator=interpolator, & + eps=self%ui%eps) + if (self%ui%verbose) print '(A)', interpolator%description() + allocate(stencil_r(1:2, 1-self%ui%S(s):-1+self%ui%S(s))) + do pn=1, self%ui%pn_number + do i=1, self%ui%points_number(pn) + stencil_r(1,:) = self%solution(pn, s)%fx_cell(i+1-self%ui%S(s):i-1+self%ui%S(s)) + stencil_r(2,:) = self%solution(pn, s)%fx_cell(i+1-self%ui%S(s):i-1+self%ui%S(s)) + call interpolator%interpolate(stencil=stencil_r, & + interpolation=self%solution(pn, s)%interpolations(:,i), & + si=self%solution(pn, s)%si_r(:, i, 0:self%ui%S(s)-1), & + weights=self%solution(pn, s)%weights_r(:, i, 0:self%ui%S(s)-1)) + self%solution(pn, s)%reconstruction(i) = & + (self%solution(pn, s)%interpolations(2,i) - self%solution(pn, s)%interpolations(1,i))/self%solution(pn, s)%Dx + enddo + enddo + deallocate(stencil_r) + enddo + endif + call self%analize_errors + call self%save_results_and_plots + endsubroutine perform + + subroutine save_results_and_plots(self) + !< Save results and plots. + class(test), intent(inout) :: self !< Test. + type(pyplot) :: plt !< Plot handler. + character(len=:), allocatable :: buffer !< Buffer string. + character(len=:), allocatable :: output_dir !< Output directory. + character(len=:), allocatable :: file_bname !< File base name. + integer(I_P) :: file_unit !< File unit. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + integer(I_P) :: i !< Counter. + integer(I_P) :: ss !< Counter. + integer(I_P) :: f !< Counter. + + output_dir = trim(adjustl(self%ui%output_dir))//'/' + if (self%ui%results.or.self%ui%plots) call execute_command_line('mkdir -p '//output_dir) + if (self%ui%interpolate) then + file_bname = output_dir//trim(adjustl(self%ui%output_bname))//'-interpolator-'//trim(adjustl(self%ui%interpolator_type)) + if (self%ui%results) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + open(newunit=file_unit, file=file_bname//'-S_'//trim(str(self%ui%S(s), .true.))//& + '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.dat') + buffer = 'VARIABLES = "x" "sin(x)" "x_int" "sin(x)_int" "interpolation"' + do ss=0, self%ui%S(s)-1 + buffer = buffer//' "si-'//trim(str(ss, .true.)) + enddo + do ss=0, self%ui%S(s)-1 + buffer = buffer//' "W-'//trim(str(ss, .true.)) + enddo + write(file_unit, "(A)") buffer + write(file_unit, "(A)") 'ZONE T = "'//'S_'//trim(str(self%ui%S(s), .true.))//& + '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'"' + associate(x_cell => self%solution(pn, s)%x_cell, & + fx_cell => self%solution(pn, s)%fx_cell, & + x_int => self%solution(pn, s)%x_int, & + fx_int => self%solution(pn, s)%fx_int, & + interpolation => self%solution(pn, s)%interpolation, & + si => self%solution(pn, s)%si_i, & + weights => self%solution(pn, s)%weights_i, & + Dx => self%solution(pn, s)%Dx) + do i = 1, self%ui%points_number(pn) + write(file_unit, "("//trim(str(5+2*self%ui%S(s), .true.))//"("//FRPP//",1X))") & + x_cell(i), & + fx_cell(i), & + x_int(i), & + fx_int(i), & + interpolation(i), & + (si(i, ss), ss=0, self%ui%S(s)-1), & + (weights(i, ss), ss=0, self%ui%S(s)-1) + enddo + endassociate + close(file_unit) + enddo + enddo + + if (self%ui%errors_analysis.and.self%ui%pn_number>1) then + open(newunit=file_unit, file=file_bname//'-accuracy.dat') + write(file_unit, "(A)") 'VARIABLES = "S" "Np" "error (L2)" "observed order" "formal order"' + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + write(file_unit, "(2(I5,1X),"//FRPP//",1X,F5.2,1X,I3)") self%ui%S(s), & + self%ui%points_number(pn), & + self%solution(pn, s)%error_L2, & + self%accuracy(pn, s), & + 2*self%ui%S(s)-1 + enddo + enddo + close(file_unit) + endif + endif + else + file_bname = output_dir//trim(adjustl(self%ui%output_bname))//'-reconstructor-'//trim(adjustl(self%ui%interpolator_type)) + if (self%ui%results) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + open(newunit=file_unit, file=file_bname//'-S_'//trim(str(self%ui%S(s), .true.))//& + '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.dat') + buffer = 'VARIABLES = "x" "sin(x)" "cos(x)" "x_left" "x_right" "sin(x)_left" "sin(x)_right"' + buffer = buffer//' "reconstruction_left" "reconstruction_right" "cos_reconstruction"' + do ss=0, self%ui%S(s)-1 + buffer = buffer//' "si-'//trim(str(ss, .true.))//'_left"'//' "si-'//trim(str(ss, .true.))//'_right"' + enddo + do ss=0, self%ui%S(s)-1 + buffer = buffer//' "W-'//trim(str(ss, .true.))//'_left"'//' "W-'//trim(str(ss, .true.))//'_right"' + enddo + write(file_unit, "(A)") buffer + write(file_unit, "(A)") 'ZONE T = "'//'S_'//trim(str(self%ui%S(s), .true.))//& + '-Np_'//trim(str(self%ui%points_number(pn), .true.))//'"' + associate(x_cell => self%solution(pn, s)%x_cell, & + fx_cell => self%solution(pn, s)%fx_cell, & + dfx_cell => self%solution(pn, s)%dfx_cell, & + x_face => self%solution(pn, s)%x_face, & + fx_face => self%solution(pn, s)%fx_face, & + interpolations => self%solution(pn, s)%interpolations, & + reconstruction => self%solution(pn, s)%reconstruction, & + si => self%solution(pn, s)%si_r, & + weights => self%solution(pn, s)%weights_r, & + Dx => self%solution(pn, s)%Dx) + do i = 1, self%ui%points_number(pn) + write(file_unit, "("//trim(str(10+4*self%ui%S(s), .true.))//"("//FRPP//",1X))") & + x_cell(i), & + fx_cell(i), & + dfx_cell(i), & + (x_face(f,i), f=1, 2), & + (fx_face(f,i), f=1, 2), & + (interpolations(f,i), f=1, 2), & + reconstruction(i), & + ((si(f, i, ss), f=1, 2), ss=0, self%ui%S(s)-1), & + ((weights(f, i, ss), f=1, 2), ss=0, self%ui%S(s)-1) + enddo + endassociate + close(file_unit) + enddo + enddo + + if (self%ui%errors_analysis.and.self%ui%pn_number>1) then + open(newunit=file_unit, file=file_bname//'-accuracy.dat') + write(file_unit, "(A)") 'VARIABLES = "S" "Np" "error (L2)" "observed order" "formal order"' + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + write(file_unit, "(2(I5,1X),"//FRPP//",1X,F5.2,1X,I3)") self%ui%S(s), & + self%ui%points_number(pn), & + self%solution(pn, s)%error_L2, & + self%accuracy(pn, s), & + 2*self%ui%S(s)-1 + enddo + enddo + close(file_unit) + endif + endif + endif + +#ifndef r16p + ! pyplot fortran does not support 128 bit reals + if (self%ui%plots) then + if (self%ui%interpolate) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + buffer = 'WENO interpolation of $\sin(x)$; '//& + 'S='//trim(str(self%ui%S(s), .true.))//'Np='//trim(str(self%ui%points_number(pn), .true.)) + call plt%initialize(grid=.true., xlabel='angle (rad)', title=buffer, legend=.true.) + call plt%add_plot(x=self%solution(pn, s)%x_cell(1:self%ui%points_number(pn)), & + y=self%solution(pn, s)%fx_cell(:), & + label='$\sin(x)$', & + linestyle='k-', & + linewidth=2, & + ylim=[-1.1_RPP, 1.1_RPP]) + call plt%add_plot(x=self%solution(pn, s)%x_int(1:self%ui%points_number(pn)), & + y=self%solution(pn, s)%interpolation(:), & + label='WENO interpolation', & + linestyle='ro', & + markersize=6, & + ylim=[-1.1_RPP, 1.1_RPP]) + call plt%savefig(file_bname//& + '-S_'//trim(str(self%ui%S(s), .true.))//'-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.png') + enddo + enddo + else + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + buffer = 'WENO reconstruction of $d \sin(x)/Dx=\cos(x)$; '//& + 'S='//trim(str(self%ui%S(s), .true.))//'Np='//trim(str(self%ui%points_number(pn), .true.)) + call plt%initialize(grid=.true., xlabel='angle (rad)', title=buffer, legend=.true.) + call plt%add_plot(x=self%solution(pn, s)%x_cell(1:self%ui%points_number(pn)), & + y=self%solution(pn, s)%dfx_cell(:), & + label='$\cos(x)$', & + linestyle='k-', & + linewidth=2, & + ylim=[-1.1_RPP, 1.1_RPP]) + call plt%add_plot(x=self%solution(pn, s)%x_cell(1:self%ui%points_number(pn)), & + y=self%solution(pn, s)%reconstruction(:), & + label='WENO reconstruction', & + linestyle='ro', & + markersize=6, & + ylim=[-1.1_RPP, 1.1_RPP]) + call plt%savefig(file_bname//& + '-S_'//trim(str(self%ui%S(s), .true.))//'-Np_'//trim(str(self%ui%points_number(pn), .true.))//'.png') + enddo + enddo + endif + endif +#endif + endsubroutine save_results_and_plots + + subroutine analize_errors(self) + !< Analize errors. + class(test), intent(inout) :: self !< Test. + integer(I_P) :: s !< Counter. + integer(I_P) :: pn !< Counter. + integer(I_P) :: i !< Counter. + + if (self%ui%errors_analysis) then + if (self%ui%interpolate) then + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + associate(error_L2=>self%solution(pn, s)%error_L2, & + Dx=>self%solution(pn, s)%Dx, & + fx_int=>self%solution(pn, s)%fx_int, & + interpolation=>self%solution(pn, s)%interpolation) + error_L2 = 0._RPP + do i=1, self%ui%points_number(pn) + error_L2 = error_L2 + (interpolation(i) - fx_int(i))**2 + enddo + error_L2 = sqrt(error_L2) + endassociate + enddo + enddo + if (self%ui%pn_number>1) then + do s=1, self%ui%S_number + do pn=2, self%ui%pn_number + self%accuracy(pn, s) = log(self%solution(pn - 1, s)%error_L2 / self%solution(pn, s)%error_L2) / & + log(self%solution(pn - 1, s)%Dx / self%solution(pn, s)%Dx) + enddo + enddo + endif + else + do s=1, self%ui%S_number + do pn=1, self%ui%pn_number + associate(error_L2=>self%solution(pn, s)%error_L2, & + Dx=>self%solution(pn, s)%Dx, & + dfx_cell=>self%solution(pn, s)%dfx_cell, & + reconstruction=>self%solution(pn, s)%reconstruction) + error_L2 = 0._RPP + do i=1, self%ui%points_number(pn) + error_L2 = error_L2 + (reconstruction(i) - dfx_cell(i))**2 + enddo + error_L2 = sqrt(error_L2) + endassociate + enddo + enddo + if (self%ui%pn_number>1) then + do s=1, self%ui%S_number + do pn=2, self%ui%pn_number + self%accuracy(pn, s) = log(self%solution(pn - 1, s)%error_L2 / self%solution(pn, s)%error_L2) / & + log(self%solution(pn - 1, s)%Dx / self%solution(pn, s)%Dx) + enddo + enddo + endif + endif + endif + endsubroutine analize_errors +endmodule sin_test_module + +program sin_test_program +!< WenOOF test: interpolation or reconstruction of sine function. + +use sin_test_module + +implicit none +type(test) :: sin_test + +call sin_test%execute +endprogram sin_test_program diff --git a/src/tests/wenoof_test_ui.f90 b/src/tests/wenoof_test_ui.f90 index 16003e4..ac6fb70 100644 --- a/src/tests/wenoof_test_ui.f90 +++ b/src/tests/wenoof_test_ui.f90 @@ -13,27 +13,30 @@ module wenoof_test_ui private public :: test_ui -character(99), parameter :: interpolators(1:4) = ["reconstructor-JS ", & - "reconstructor-M-JS", & - "reconstructor-M-Z ", & - "reconstructor-Z "] !< List of available interpolators. +character(99), parameter :: interpolators(1:4) = ["JS ", & + "M-JS", & + "M-Z ", & + "Z "] !< List of available interpolators. type :: test_ui !< Class to handle test(s) User Interface (UI). - type(command_line_interface) :: cli !< Command line interface handler. - integer(I_P) :: error=0 !< Error handler. - character(99) :: interpolator_type='JS' !< Interpolator used. - character(99) :: output_bname='unset' !< Output files basename. - character(99) :: output_dir='' !< Output directory. - integer(I_P) :: pn_number !< Number of different points-number tested. - integer(I_P), allocatable :: points_number(:) !< Points number used to discretize the domain. - integer(I_P) :: S_number !< Number of different stencils tested. - integer(I_P), allocatable :: S(:) !< Stencils used. - real(RPP) :: eps !< Smal episol to avoid zero-division. - logical :: errors_analysis=.false. !< Flag for activating errors analysis. - logical :: plots=.false. !< Flag for activating plots saving. - logical :: results=.false. !< Flag for activating results saving. - logical :: verbose=.false. !< Flag for activating verbose output. + type(command_line_interface) :: cli !< Command line interface handler. + integer(I_P) :: error=0 !< Error handler. + character(99) :: interpolator_type='JS' !< Interpolator used. + character(99) :: output_bname='unset' !< Output files basename. + character(99) :: output_dir='' !< Output directory. + integer(I_P) :: pn_number !< Number of different points-number tested. + integer(I_P), allocatable :: points_number(:) !< Points number used to discretize the domain. + integer(I_P) :: S_number !< Number of different stencils tested. + integer(I_P), allocatable :: S(:) !< Stencils used. + real(RPP) :: eps !< Small epsilon to avoid zero-division. + real(RPP) :: x_target !< Interpolation target coordinate. + logical :: interpolate=.false. !< Flag for activating interpolation. + logical :: reconstruct=.false. !< Flag for activating reconstruction. + logical :: errors_analysis=.false. !< Flag for activating errors analysis. + logical :: plots=.false. !< Flag for activating plots saving. + logical :: results=.false. !< Flag for activating results saving. + logical :: verbose=.false. !< Flag for activating verbose output. contains ! public methods procedure, pass(self) :: get !< Get user options. @@ -53,21 +56,25 @@ subroutine set_cli() !< Set Command Line Interface. associate(cli => self%cli) - call cli%init(progname = 'WenOOF Test', & - authors = 'Fortran-FOSS-Programmers', & - license = 'GNU GPLv3', & - description = 'Test WenOOF library on sin function reconstruction', & - examples = ["sin_reconstruction --interpolator JS --results", & - "sin_reconstruction --interpolator JS-Z -r ", & - "sin_reconstruction --interpolator JS-M ", & - "sin_reconstruction --interpolator all -p -r "]) + call cli%init(progname = 'WenOOF Test', & + authors = 'Fortran-FOSS-Programmers', & + license = 'GNU GPLv3', & + description = 'Test WenOOF library on function reconstruction', & + examples = ["$EXECUTABLE --interpolate -i JS --results", & + "$EXECUTABLE --interpolate -i JS-Z -r ", & + "$EXECUTABLE --reconstruct -i JS-M ", & + "$EXECUTABLE --reconstruct -i all -p -r "]) + + call cli%add(switch='--interpolate', help='Perform interpolation', required=.false., act='store_true', def='.false.') + call cli%add(switch='--reconstruct', help='Perform interpolation', required=.false., act='store_true', def='.false.') + call cli%add(switch='--x_target', switch_ab='-x', help='WENO interpolation target point coordinate', & + required=.false., def='0.0', act='store') call cli%add(switch='--interpolator', switch_ab='-i', help='WENO interpolator type', required=.false., & - def='reconstructor-JS', act='store', & - choices='all,reconstructor-JS,reconstructor-M-JS,reconstructor-M-Z,reconstructor-Z') + def='JS', act='store', choices='all,JS,M-JS,M-Z,Z') call cli%add(switch='--points_number', switch_ab='-pn', nargs='+', help='Number of points used to discretize the domain', & required=.false., act='store', def='50 100') - call cli%add(switch='--stencils', switch_ab='-s', nargs='+', help='Stencils dimensions (and number)', & - required=.false., act='store', def='2 3 4 5 6 7 8 9', choices='2, 3, 4, 5, 6, 7, 8, 9') + call cli%add(switch='--stencils', switch_ab='-s', nargs='+', help='Stencils dimensions (and number)', required=.false., & + act='store', def='2 3 4 5 6 7 8 9', choices='2, 3, 4, 5, 6, 7, 8, 9') call cli%add(switch='--eps', help='Small epsilon to avoid zero-division', required=.false., act='store', def='1.e-6') call cli%add(switch='--output_dir', help='Output directory', required=.false., act='store', def='./') call cli%add(switch='--results', switch_ab='-r', help='Save results', required=.false., act='store_true', def='.false.') @@ -82,6 +89,9 @@ subroutine parse_cli() !< Parse Command Line Interface and check its validity. call self%cli%parse(error=self%error) ; if (self%error/=0) stop + call self%cli%get(switch='--interpolate', val=self%interpolate, error=self%error) ; if (self%error/=0) stop + call self%cli%get(switch='--reconstruct', val=self%reconstruct, error=self%error) ; if (self%error/=0) stop + call self%cli%get(switch='-x', val=self%x_target, error=self%error) ; if (self%error/=0) stop call self%cli%get(switch='-i', val=self%interpolator_type, error=self%error) ; if (self%error/=0) stop call self%cli%get_varying(switch='-pn', val=self%points_number, error=self%error) ; if (self%error/=0) stop call self%cli%get_varying(switch='-s', val=self%S, error=self%error) ; if (self%error/=0) stop @@ -93,6 +103,12 @@ subroutine parse_cli() call self%cli%get(switch='--errors_analysis', val=self%errors_analysis, error=self%error) ; if (self%error/=0) stop call self%cli%get(switch='--verbose', val=self%verbose, error=self%error) ; if (self%error/=0) stop + if ((.not.self%interpolate).and.(.not.self%reconstruct)) then + ! activate both for coverage tests + self%interpolate = .true. + self%reconstruct = .true. + endif + self%pn_number = size(self%points_number, dim=1) self%S_number = size(self%S, dim=1) endsubroutine parse_cli @@ -100,10 +116,10 @@ subroutine parse_cli() function loop_interpolator(self, interpolator) result(again) !< Loop over available interpolators. - class(test_ui), intent(in) :: self !< Test UI. - character(99), intent(out) :: interpolator !< Interpolator name. - logical :: again !< Flag continuing the loop. - integer(I_P), save :: i = 0 !< Counter. + class(test_ui), intent(in) :: self !< Test UI. + character(99), intent(out) :: interpolator !< Interpolator name. + logical :: again !< Flag continuing the loop. + integer(I_P), save :: i = 0 !< Counter. again = .false. if (i==0) then