Neko  0.9.0
A portable framework for high-order spectral element flow simulations
wall.f90
Go to the documentation of this file.
1 ! Copyright (c) 2020-2021, The Neko Authors
2 ! All rights reserved.
3 !
4 ! Redistribution and use in source and binary forms, with or without
5 ! modification, are permitted provided that the following conditions
6 ! are met:
7 !
8 ! * Redistributions of source code must retain the above copyright
9 ! notice, this list of conditions and the following disclaimer.
10 !
11 ! * Redistributions in binary form must reproduce the above
12 ! copyright notice, this list of conditions and the following
13 ! disclaimer in the documentation and/or other materials provided
14 ! with the distribution.
15 !
16 ! * Neither the name of the authors nor the names of its
17 ! contributors may be used to endorse or promote products derived
18 ! from this software without specific prior written permission.
19 !
20 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 ! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 ! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 ! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 ! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 ! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 ! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 ! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 ! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 ! POSSIBILITY OF SUCH DAMAGE.
32 !
34 module wall
35  use device_wall
36  use num_types, only : rp
37  use bc, only : bc_t
38  use, intrinsic :: iso_c_binding, only : c_ptr
39  implicit none
40  private
41 
43  type, public, extends(bc_t) :: no_slip_wall_t
44  contains
45  procedure, pass(this) :: apply_scalar => no_slip_wall_apply_scalar
46  procedure, pass(this) :: apply_vector => no_slip_wall_apply_vector
47  procedure, pass(this) :: apply_scalar_dev => no_slip_wall_apply_scalar_dev
48  procedure, pass(this) :: apply_vector_dev => no_slip_wall_apply_vector_dev
50  procedure, pass(this) :: free => no_slip_wall_free
51  end type no_slip_wall_t
52 
53 contains
54 
57  subroutine no_slip_wall_apply_scalar(this, x, n, t, tstep)
58  class(no_slip_wall_t), intent(inout) :: this
59  integer, intent(in) :: n
60  real(kind=rp), intent(inout), dimension(n) :: x
61  real(kind=rp), intent(in), optional :: t
62  integer, intent(in), optional :: tstep
63  integer :: i, m, k
64 
65  m = this%msk(0)
66  do i = 1, m
67  k = this%msk(i)
68  x(k) = 0d0
69  end do
70 
71  end subroutine no_slip_wall_apply_scalar
72 
75  subroutine no_slip_wall_apply_vector(this, x, y, z, n, t, tstep)
76  class(no_slip_wall_t), intent(inout) :: this
77  integer, intent(in) :: n
78  real(kind=rp), intent(inout), dimension(n) :: x
79  real(kind=rp), intent(inout), dimension(n) :: y
80  real(kind=rp), intent(inout), dimension(n) :: z
81  real(kind=rp), intent(in), optional :: t
82  integer, intent(in), optional :: tstep
83  integer :: i, m, k
84 
85  m = this%msk(0)
86  do i = 1, m
87  k = this%msk(i)
88  x(k) = 0d0
89  y(k) = 0d0
90  z(k) = 0d0
91  end do
92 
93  end subroutine no_slip_wall_apply_vector
94 
97  subroutine no_slip_wall_apply_scalar_dev(this, x_d, t, tstep)
98  class(no_slip_wall_t), intent(inout), target :: this
99  type(c_ptr) :: x_d
100  real(kind=rp), intent(in), optional :: t
101  integer, intent(in), optional :: tstep
102 
103  call device_no_slip_wall_apply_scalar(this%msk_d, x_d, size(this%msk))
104 
105  end subroutine no_slip_wall_apply_scalar_dev
106 
109  subroutine no_slip_wall_apply_vector_dev(this, x_d, y_d, z_d, t, tstep)
110  class(no_slip_wall_t), intent(inout), target :: this
111  type(c_ptr) :: x_d
112  type(c_ptr) :: y_d
113  type(c_ptr) :: z_d
114  real(kind=rp), intent(in), optional :: t
115  integer, intent(in), optional :: tstep
116 
117  call device_no_slip_wall_apply_vector(this%msk_d, x_d, y_d, z_d, &
118  size(this%msk))
119 
120  end subroutine no_slip_wall_apply_vector_dev
121 
123  subroutine no_slip_wall_free(this)
124  class(no_slip_wall_t), target, intent(inout) :: this
125 
126  call this%free_base()
127 
128  end subroutine no_slip_wall_free
129 
130 end module wall
Defines a boundary condition.
Definition: bc.f90:34
subroutine, public device_no_slip_wall_apply_vector(msk, x, y, z, m)
subroutine, public device_no_slip_wall_apply_scalar(msk, x, m)
integer, parameter, public rp
Global precision used in computations.
Definition: num_types.f90:12
Defines wall boundary conditions.
Definition: wall.f90:34
subroutine no_slip_wall_apply_vector_dev(this, x_d, y_d, z_d, t, tstep)
Boundary condition apply for a no-slip wall condition to vectors x, y and z (device version)
Definition: wall.f90:110
subroutine no_slip_wall_apply_scalar(this, x, n, t, tstep)
Boundary condition apply for a no-slip wall condition to a vector x.
Definition: wall.f90:58
subroutine no_slip_wall_apply_scalar_dev(this, x_d, t, tstep)
Boundary condition apply for a no-slip wall condition to a vector x (device version)
Definition: wall.f90:98
subroutine no_slip_wall_apply_vector(this, x, y, z, n, t, tstep)
Boundary condition apply for a no-slip wall condition to vectors x, y and z.
Definition: wall.f90:76
subroutine no_slip_wall_free(this)
Destructor.
Definition: wall.f90:124
Base type for a boundary condition.
Definition: bc.f90:51
No-slip Wall boundary condition.
Definition: wall.f90:43