Neko 1.99.1
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
43 use field, only: field_t
44 implicit none
45 private
46
48 type, abstract, public :: filter_t
50 type(coef_t), pointer :: coef => null()
51
52 contains
54 procedure, pass(this) :: init_base => filter_init_base
56 procedure, pass(this) :: free_base => filter_free_base
58 procedure(filter_init), pass(this), deferred :: init
60 procedure(filter_free), pass(this), deferred :: free
62 procedure(filter_apply), pass(this), deferred :: apply
63 end type filter_t
64
65
66
67
68 abstract interface
69
72 subroutine filter_init(this, json, coef)
73 import filter_t, json_file, coef_t
74 class(filter_t), intent(inout) :: this
75 type(json_file), intent(inout) :: json
76 type(coef_t), intent(in) :: coef
77 end subroutine filter_init
78 end interface
79
80 abstract interface
81
82 subroutine filter_free(this)
83 import filter_t
84 class(filter_t), intent(inout) :: this
85 end subroutine filter_free
86 end interface
87
88 abstract interface
89
92 subroutine filter_apply(this, F_out, F_in)
93 import filter_t, field_t
94 class(filter_t), intent(inout) :: this
95 type(field_t), intent(in) :: F_in
96 type(field_t), intent(inout) :: F_out
97 end subroutine filter_apply
98 end interface
99
100 interface
101
106 module subroutine filter_factory(object, type_name, json, coef)
107 class(filter_t), allocatable, intent(inout) :: object
108 character(len=*), intent(in) :: type_name
109 type(coef_t), intent(in) :: coef
110 type(json_file), intent(inout) :: json
111 end subroutine filter_factory
112 end interface
113
114 public :: filter_factory
115
116contains
118 subroutine filter_init_base(this, json, coef)
119 class(filter_t), intent(inout) :: this
120 type(json_file), intent(inout) :: json
121 type(coef_t), intent(in), target :: coef
122
123 this%coef => coef
124
125 end subroutine filter_init_base
126
128 subroutine filter_free_base(this)
129 class(filter_t), intent(inout) :: this
130
131 nullify(this%coef)
132 end subroutine filter_free_base
133
134
135
136end module filter
The application of the filter.
Definition filter.f90:92
Destructor.
Definition filter.f90:82
The common constructor using a JSON dictionary.
Definition filter.f90:72
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
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_free_base(this)
Destructor for the filter_t (base) class.
Definition filter.f90:129
subroutine filter_init_base(this, json, coef)
Filter factory. Both constructs and initializes the object.
Definition filter.f90:119
Utilities for retrieving parameters from the case files.
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:55
Base abstract class for filter.
Definition filter.f90:48