Neko 1.99.3
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
filter.f90
Go to the documentation of this file.
1! Copyright (c) 2023, 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!
33!
35
36! (sorry about the naming convention of filter vs filters, I want the
37! name "filters" for this eventually)
38module filter
39 use num_types, only : rp
40 use json_module, only : json_file
41 use coefs, only : coef_t
42 use field, only : field_t
43 implicit none
44 private
45
47 type, abstract, public :: filter_t
49 type(coef_t), pointer :: coef => null()
50
51 contains
53 procedure, pass(this) :: init_base => filter_init_base
55 procedure, pass(this) :: free_base => filter_free_base
57 procedure(filter_init), pass(this), deferred :: init
59 procedure(filter_free), pass(this), deferred :: free
61 procedure(filter_apply), pass(this), deferred :: apply
62 end type filter_t
63
64
65
66
67 abstract interface
68
71 subroutine filter_init(this, json, coef)
72 import filter_t, json_file, coef_t
73 class(filter_t), intent(inout) :: this
74 type(json_file), intent(inout) :: json
75 type(coef_t), intent(in), target :: coef
76 end subroutine filter_init
77 end interface
78
79 abstract interface
80
81 subroutine filter_free(this)
82 import filter_t
83 class(filter_t), intent(inout) :: this
84 end subroutine filter_free
85 end interface
86
87 abstract interface
88
91 subroutine filter_apply(this, F_out, F_in)
92 import filter_t, field_t
93 class(filter_t), intent(inout) :: this
94 type(field_t), intent(in) :: F_in
95 type(field_t), intent(inout) :: F_out
96 end subroutine filter_apply
97 end interface
98
99 interface
100
105 module subroutine filter_factory(object, type_name, json, coef)
106 class(filter_t), allocatable, intent(inout) :: object
107 character(len=*), intent(in) :: type_name
108 type(coef_t), intent(in), target :: coef
109 type(json_file), intent(inout) :: json
110 end subroutine filter_factory
111 end interface
112
113 public :: filter_factory
114
115contains
117 subroutine filter_init_base(this, coef)
118 class(filter_t), intent(inout) :: this
119 type(coef_t), intent(in), target :: coef
120
121 this%coef => coef
122
123 end subroutine filter_init_base
124
126 subroutine filter_free_base(this)
127 class(filter_t), intent(inout) :: this
128
129 nullify(this%coef)
130 end subroutine filter_free_base
131
132
133
134end module filter
The application of the filter.
Definition filter.f90:91
Destructor.
Definition filter.f90:81
The common constructor using a JSON dictionary.
Definition filter.f90:71
Coefficients.
Definition coef.f90:34
Defines a field.
Definition field.f90:34
Filter to be applied to a scalar field.
Definition filter.f90:38
subroutine filter_init_base(this, coef)
Filter factory. Both constructs and initializes the object.
Definition filter.f90:118
subroutine filter_free_base(this)
Destructor for the filter_t (base) class.
Definition filter.f90:127
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:63
Base abstract class for filter.
Definition filter.f90:47