Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
inflow.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!
34module inflow
36 use num_types, only : rp
37 use bc, only : bc_t
38 use, intrinsic :: iso_c_binding, only : c_ptr, c_loc
39 implicit none
40 private
41
43 type, public, extends(bc_t) :: inflow_t
44 real(kind=rp), dimension(3) :: x = (/0d0, 0d0, 0d0 /)
45 contains
46 procedure, pass(this) :: apply_scalar => inflow_apply_scalar
47 procedure, pass(this) :: apply_vector => inflow_apply_vector
48 procedure, pass(this) :: apply_scalar_dev => inflow_apply_scalar_dev
49 procedure, pass(this) :: apply_vector_dev => inflow_apply_vector_dev
50 procedure, pass(this) :: set_inflow => inflow_set_vector
52 procedure, pass(this) :: free => inflow_free
53 end type inflow_t
54
55contains
56
58 subroutine inflow_apply_scalar(this, x, n, t, tstep)
59 class(inflow_t), intent(inout) :: this
60 integer, intent(in) :: n
61 real(kind=rp), intent(inout), dimension(n) :: x
62 real(kind=rp), intent(in), optional :: t
63 integer, intent(in), optional :: tstep
64 end subroutine inflow_apply_scalar
65
67 subroutine inflow_apply_scalar_dev(this, x_d, t, tstep)
68 class(inflow_t), intent(inout), target :: this
69 type(c_ptr) :: x_d
70 real(kind=rp), intent(in), optional :: t
71 integer, intent(in), optional :: tstep
72 end subroutine inflow_apply_scalar_dev
73
75 subroutine inflow_apply_vector(this, x, y, z, n, t, tstep)
76 class(inflow_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) = this%x(1)
89 y(k) = this%x(2)
90 z(k) = this%x(3)
91 end do
92 end subroutine inflow_apply_vector
93
95 subroutine inflow_apply_vector_dev(this, x_d, y_d, z_d, t, tstep)
96 class(inflow_t), intent(inout), target :: this
97 type(c_ptr) :: x_d
98 type(c_ptr) :: y_d
99 type(c_ptr) :: z_d
100 real(kind=rp), intent(in), optional :: t
101 integer, intent(in), optional :: tstep
102
103 call device_inflow_apply_vector(this%msk_d, x_d, y_d, z_d, &
104 c_loc(this%x), this%msk(0))
105
106 end subroutine inflow_apply_vector_dev
107
109 subroutine inflow_set_vector(this, x)
110 class(inflow_t), intent(inout) :: this
111 real(kind=rp), dimension(3), intent(inout) :: x
112 this%x = x
113 end subroutine inflow_set_vector
114
116 subroutine inflow_free(this)
117 class(inflow_t), target, intent(inout) :: this
118
119 call this%free_base()
120
121 end subroutine inflow_free
122
123
124end module inflow
Defines a boundary condition.
Definition bc.f90:34
subroutine, public device_inflow_apply_vector(msk, x, y, z, g, m)
Defines inflow dirichlet conditions.
Definition inflow.f90:34
subroutine inflow_set_vector(this, x)
Set inflow vector.
Definition inflow.f90:110
subroutine inflow_apply_scalar(this, x, n, t, tstep)
No-op scalar apply.
Definition inflow.f90:59
subroutine inflow_free(this)
Destructor.
Definition inflow.f90:117
subroutine inflow_apply_vector_dev(this, x_d, y_d, z_d, t, tstep)
Apply inflow conditions (vector valued) (device version)
Definition inflow.f90:96
subroutine inflow_apply_vector(this, x, y, z, n, t, tstep)
Apply inflow conditions (vector valued)
Definition inflow.f90:76
subroutine inflow_apply_scalar_dev(this, x_d, t, tstep)
No-op scalar apply (device version)
Definition inflow.f90:68
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Base type for a boundary condition.
Definition bc.f90:51
Dirichlet condition for inlet (vector valued)
Definition inflow.f90:43