Skip to content

Commit bad0507

Browse files
committed
Merge branch 'release/0.1.4'
2 parents d5265fa + 87fed69 commit bad0507

10 files changed

+122
-46
lines changed

src/lib/concrete_objects/wenoof_alpha_rec_m.F90

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ module wenoof_alpha_rec_m
77
!< 2005, vol. 207, pp. 542-567, doi:10.1016/j.jcp.2005.01.023
88

99
#ifdef r16p
10-
use penf, only: I_P, RPP=>R16P
10+
use penf, only: I_P, RPP=>R16P, str
1111
#else
12-
use penf, only: I_P, RPP=>R8P
12+
use penf, only: I_P, RPP=>R8P, str
1313
#endif
1414
use wenoof_alpha_object
1515
use wenoof_alpha_rec_js
@@ -52,6 +52,10 @@ subroutine create(self, constructor)
5252

5353
call self%destroy
5454
call self%create_(constructor=constructor)
55+
allocate(self%values(1:2, 0:self%S - 1))
56+
allocate(self%values_sum(1:2))
57+
self%values = 0._RPP
58+
self%values_sum = 0._RPP
5559
select type(constructor)
5660
type is(alpha_rec_m_constructor)
5761
if (allocated(constructor%base_type)) then
@@ -95,20 +99,33 @@ pure subroutine compute(self, beta, kappa)
9599

96100
pure function description(self) result(string)
97101
!< Return alpha string-descripition.
98-
class(alpha_rec_m), intent(in) :: self !< Alpha.
99-
character(len=:), allocatable :: string !< String-description.
102+
class(alpha_rec_m), intent(in) :: self !< Alpha.
103+
character(len=:), allocatable :: string !< String-description.
104+
character(len=1), parameter :: nl=new_line('a') !< New line char.
100105

101-
#ifndef DEBUG
102-
! error stop in pure procedure is a F2015 feature not yet supported in debug mode
103-
error stop 'alpha_rec_m%description to be implemented, do not use!'
104-
#endif
106+
string = ' Henrick alpha coefficients for reconstructor:'//nl
107+
string = string//' - S = '//trim(str(self%S))//nl
108+
string = string//' - f1 = '//trim(str(self%f1))//nl
109+
string = string//' - f2 = '//trim(str(self%f2))//nl
110+
string = string//' - ff = '//trim(str(self%ff))//nl
111+
string = string//' - eps = '//trim(str(self%eps))//nl
112+
associate(alpha_base=>self%alpha_base)
113+
select type(alpha_base)
114+
type is(alpha_rec_js)
115+
string = string//' - base-mapped-alpha type = Jiang-Shu'
116+
type is(alpha_rec_z)
117+
string = string//' - base-mapped-alpha type = Bogeg'
118+
endselect
119+
endassociate
105120
endfunction description
106121

107122
elemental subroutine destroy(self)
108123
!< Destroy alpha.
109124
class(alpha_rec_m), intent(inout) :: self !< Alpha.
110125

111126
call self%destroy_
127+
if (allocated(self%values)) deallocate(self%values)
128+
if (allocated(self%values_sum)) deallocate(self%values_sum)
112129
if (allocated(self%alpha_base)) deallocate(self%alpha_base)
113130
endsubroutine destroy
114131
endmodule wenoof_alpha_rec_m

src/lib/concrete_objects/wenoof_alpha_rec_z.F90

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ module wenoof_alpha_rec_z
77
!< vol. 227, pp. 3191-3211, doi: 10.1016/j.jcp.2007.11.038.
88

99
#ifdef r16p
10-
use penf, only: I_P, RPP=>R16P
10+
use penf, only: I_P, RPP=>R16P, str
1111
#else
12-
use penf, only: I_P, RPP=>R8P
12+
use penf, only: I_P, RPP=>R8P, str
1313
#endif
1414
use wenoof_alpha_object
1515
use wenoof_base_object
@@ -47,6 +47,10 @@ subroutine create(self, constructor)
4747

4848
call self%destroy
4949
call self%create_(constructor=constructor)
50+
allocate(self%values(1:2, 0:self%S - 1))
51+
allocate(self%values_sum(1:2))
52+
self%values = 0._RPP
53+
self%values_sum = 0._RPP
5054
endsubroutine create
5155

5256
pure subroutine compute(self, beta, kappa)
@@ -68,20 +72,26 @@ pure subroutine compute(self, beta, kappa)
6872

6973
pure function description(self) result(string)
7074
!< Return alpha string-descripition.
71-
class(alpha_rec_z), intent(in) :: self !< Alpha coefficients.
72-
character(len=:), allocatable :: string !< String-description.
75+
class(alpha_rec_z), intent(in) :: self !< Alpha coefficients.
76+
character(len=:), allocatable :: string !< String-description.
77+
character(len=1), parameter :: nl=new_line('a') !< New line char.
78+
79+
string = ' Borges alpha coefficients for reconstructor:'//nl
80+
string = string//' - S = '//trim(str(self%S))//nl
81+
string = string//' - f1 = '//trim(str(self%f1))//nl
82+
string = string//' - f2 = '//trim(str(self%f2))//nl
83+
string = string//' - ff = '//trim(str(self%ff))//nl
84+
string = string//' - eps = '//trim(str(self%eps))
7385

74-
#ifndef DEBUG
75-
! error stop in pure procedure is a F2015 feature not yet supported in debug mode
76-
error stop 'alpha_rec_z%description to be implemented, do not use!'
77-
#endif
7886
endfunction description
7987

8088
elemental subroutine destroy(self)
8189
!< Destroy alpha.
8290
class(alpha_rec_z), intent(inout) :: self !< Alpha.
8391

8492
call self%destroy_
93+
if (allocated(self%values)) deallocate(self%values)
94+
if (allocated(self%values_sum)) deallocate(self%values_sum)
8595
endsubroutine destroy
8696

8797
! private non TBP

src/lib/concrete_objects/wenoof_weights_js.F90

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ module wenoof_weights_js
1818
use wenoof_alpha_rec_m
1919
use wenoof_alpha_rec_z
2020
use wenoof_base_object
21+
use wenoof_beta_factory
2122
use wenoof_beta_object
2223
use wenoof_beta_rec_js
24+
use wenoof_kappa_factory
2325
use wenoof_kappa_object
2426
use wenoof_kappa_rec_js
2527
use wenoof_weights_object
@@ -61,7 +63,9 @@ subroutine create(self, constructor)
6163
!< Create reconstructor.
6264
class(weights_js), intent(inout) :: self !< Weights.
6365
class(base_object_constructor), intent(in) :: constructor !< Constructor.
64-
type(alpha_factory) :: factory !< Objects factory.
66+
type(alpha_factory) :: a_factory !< Alpha factory.
67+
type(beta_factory) :: b_factory !< Beta factory.
68+
type(kappa_factory) :: k_factory !< Kappa factory.
6569

6670
call self%destroy
6771
call self%create_(constructor=constructor)
@@ -73,30 +77,29 @@ subroutine create(self, constructor)
7377
beta_constructor=>constructor%beta_constructor, &
7478
kappa_constructor=>constructor%kappa_constructor)
7579

76-
select type(alpha_constructor)
77-
type is(alpha_rec_js_constructor)
78-
! allocate(alpha_rec_js :: self%alpha)
79-
! call self%alpha%create(constructor=alpha_constructor)
80-
call factory%create(constructor=alpha_constructor, object=self%alpha)
81-
type is(alpha_rec_m_constructor)
82-
! @TODO implement this
83-
error stop 'alpha_rec_m to be implemented'
84-
type is(alpha_rec_z_constructor)
85-
! @TODO implement this
86-
error stop 'alpha_rec_z to be implemented'
87-
endselect
88-
89-
select type(beta_constructor)
90-
type is(beta_rec_js_constructor)
91-
allocate(beta_rec_js :: self%beta)
92-
call self%beta%create(constructor=beta_constructor)
93-
endselect
94-
95-
select type(kappa_constructor)
96-
type is(kappa_rec_js_constructor)
97-
allocate(kappa_rec_js :: self%kappa)
98-
call self%kappa%create(constructor=kappa_constructor)
99-
endselect
80+
call a_factory%create(constructor=alpha_constructor, object=self%alpha)
81+
! select type(alpha_constructor)
82+
! type is(alpha_rec_js_constructor)
83+
! call factory%create(constructor=alpha_constructor, object=self%alpha)
84+
! type is(alpha_rec_m_constructor)
85+
! call factory%create(constructor=alpha_constructor, object=self%alpha)
86+
! type is(alpha_rec_z_constructor)
87+
! call factory%create(constructor=alpha_constructor, object=self%alpha)
88+
! endselect
89+
90+
call b_factory%create(constructor=beta_constructor, object=self%beta)
91+
! select type(beta_constructor)
92+
! type is(beta_rec_js_constructor)
93+
! allocate(beta_rec_js :: self%beta)
94+
! call self%beta%create(constructor=beta_constructor)
95+
! endselect
96+
97+
call k_factory%create(constructor=kappa_constructor, object=self%kappa)
98+
! select type(kappa_constructor)
99+
! type is(kappa_rec_js_constructor)
100+
! allocate(kappa_rec_js :: self%kappa)
101+
! call self%kappa%create(constructor=kappa_constructor)
102+
! endselect
100103
endassociate
101104
endselect
102105
endsubroutine create

src/lib/factories/wenoof_alpha_factory.f90

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ subroutine create_constructor(interpolator_type, S, constructor, face_left, face
5858
error stop 'interpolator-JS to be implemented'
5959
case('reconstructor-JS')
6060
allocate(alpha_rec_js_constructor :: constructor)
61+
case('reconstructor-M-JS')
62+
allocate(alpha_rec_m_constructor :: constructor)
63+
select type(constructor)
64+
type is(alpha_rec_m_constructor)
65+
constructor%base_type = 'JS'
66+
endselect
67+
case('reconstructor-M-Z')
68+
allocate(alpha_rec_m_constructor :: constructor)
69+
select type(constructor)
70+
type is(alpha_rec_m_constructor)
71+
constructor%base_type = 'Z'
72+
endselect
73+
case('reconstructor-Z')
74+
allocate(alpha_rec_z_constructor :: constructor)
6175
endselect
6276
call constructor%create(S=S, face_left=face_left, face_right=face_right, eps=eps)
6377
endsubroutine create_constructor

src/lib/factories/wenoof_beta_factory.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ subroutine create_constructor(interpolator_type, S, constructor, face_left, face
4747
error stop 'interpolator-JS to be implemented'
4848
case('reconstructor-JS')
4949
allocate(beta_rec_js_constructor :: constructor)
50+
case('reconstructor-M-JS')
51+
allocate(beta_rec_js_constructor :: constructor)
52+
case('reconstructor-M-Z')
53+
allocate(beta_rec_js_constructor :: constructor)
54+
case('reconstructor-Z')
55+
allocate(beta_rec_js_constructor :: constructor)
5056
endselect
5157
call constructor%create(S=S, face_left=face_left, face_right=face_right)
5258
endsubroutine create_constructor

src/lib/factories/wenoof_interpolations_factory.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ subroutine create_constructor(interpolator_type, S, constructor, face_left, face
4747
error stop 'interpolator-JS to be implemented'
4848
case('reconstructor-JS')
4949
allocate(interpolations_rec_js_constructor :: constructor)
50+
case('reconstructor-M-JS')
51+
allocate(interpolations_rec_js_constructor :: constructor)
52+
case('reconstructor-M-Z')
53+
allocate(interpolations_rec_js_constructor :: constructor)
54+
case('reconstructor-Z')
55+
allocate(interpolations_rec_js_constructor :: constructor)
5056
endselect
5157
call constructor%create(S=S, face_left=face_left, face_right=face_right)
5258
endsubroutine create_constructor

src/lib/factories/wenoof_interpolator_factory.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ subroutine create_constructor(interpolator_type, S, interpolations_constructor,
5555
error stop 'interpolator-JS to be implemented'
5656
case('reconstructor-JS')
5757
allocate(reconstructor_js_constructor :: constructor)
58+
case('reconstructor-M-JS')
59+
allocate(reconstructor_js_constructor :: constructor)
60+
case('reconstructor-M-Z')
61+
allocate(reconstructor_js_constructor :: constructor)
62+
case('reconstructor-Z')
63+
allocate(reconstructor_js_constructor :: constructor)
5864
endselect
5965
call constructor%create(S=S, face_left=face_left, face_right=face_right)
6066
select type(constructor)

src/lib/factories/wenoof_kappa_factory.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ subroutine create_constructor(interpolator_type, S, constructor)
4545
error stop 'interpolator-JS to be implemented'
4646
case('reconstructor-JS')
4747
allocate(kappa_rec_js_constructor :: constructor)
48+
case('reconstructor-M-JS')
49+
allocate(kappa_rec_js_constructor :: constructor)
50+
case('reconstructor-M-Z')
51+
allocate(kappa_rec_js_constructor :: constructor)
52+
case('reconstructor-Z')
53+
allocate(kappa_rec_js_constructor :: constructor)
4854
endselect
4955
call constructor%create(S=S)
5056
endsubroutine create_constructor

src/lib/factories/wenoof_weights_factory.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ subroutine create_constructor(interpolator_type, S, alpha_constructor, beta_cons
5454
error stop 'interpolator-JS to be implemented'
5555
case('reconstructor-JS')
5656
allocate(weights_js_constructor :: constructor)
57+
case('reconstructor-M-JS')
58+
allocate(weights_js_constructor :: constructor)
59+
case('reconstructor-M-Z')
60+
allocate(weights_js_constructor :: constructor)
61+
case('reconstructor-Z')
62+
allocate(weights_js_constructor :: constructor)
5763
endselect
5864
call constructor%create(S=S, face_left=face_left, face_right=face_right)
5965
select type(constructor)

src/tests/sin_reconstruction.f90

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ module test_module
1515
private
1616
public :: test
1717

18-
character(99), parameter :: interpolators(1:4) = ["all ", &
19-
"reconstructor-JS", &
20-
"JS-Z ", &
21-
"JS-M "] !< List of available interpolators.
18+
character(99), parameter :: interpolators(1:5) = ["all ", &
19+
"reconstructor-JS ", &
20+
"reconstructor-M-JS", &
21+
"reconstructor-M-Z ", &
22+
"reconstructor-Z "] !< List of available interpolators.
2223
real(RPP), parameter :: pi = 4._RPP * atan(1._RPP) !< Pi greek.
2324

2425
type :: solution_data
@@ -185,7 +186,8 @@ subroutine set_cli()
185186
"sin_reconstruction --interpolator JS-M ", &
186187
"sin_reconstruction --interpolator all -p -r "])
187188
call cli%add(switch='--interpolator', switch_ab='-i', help='WENO interpolator type', required=.false., &
188-
def='reconstructor-JS', act='store', choices='all,reconstructor-JS')
189+
def='reconstructor-JS', act='store', &
190+
choices='all,reconstructor-JS,reconstructor-M-JS,reconstructor-M-Z,reconstructor-Z')
189191
call cli%add(switch='--points_number', switch_ab='-pn', nargs='+', help='Number of points used to discretize the domain', &
190192
required=.false., act='store', def='50 100')
191193
call cli%add(switch='--stencils', switch_ab='-s', nargs='+', help='Stencils dimensions (and number)', &

0 commit comments

Comments
 (0)