Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
regularization.f90
Go to the documentation of this file.
1! Copyright (c) 2025, 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 use num_types, only : rp
35 use json_module, only : json_file
36 use field, only : field_t
37 use coefs, only : coef_t
38 use dofmap, only : dofmap_t
39 use time_state, only : time_state_t
40 implicit none
41 private
42
43 type, abstract, public :: regularization_t
44 type(field_t), pointer :: reg_coeff => null()
45 type(coef_t), pointer :: coef => null()
46 type(dofmap_t), pointer :: dof => null()
47 contains
48 procedure, pass(this) :: init_base => regularization_init_base
49 procedure, pass(this) :: free_base => regularization_free_base
50 procedure(reg_init), pass(this), deferred :: init
51 procedure(reg_free), pass(this), deferred :: free
52 procedure(reg_compute), pass(this), deferred :: compute
53 end type regularization_t
54
55 abstract interface
56 subroutine reg_init(this, json, coef, dof, reg_coeff)
57 import regularization_t, json_file, coef_t, dofmap_t, field_t
58 class(regularization_t), intent(inout) :: this
59 type(json_file), intent(inout) :: json
60 type(coef_t), intent(in), target :: coef
61 type(dofmap_t), intent(in), target :: dof
62 type(field_t), intent(in), target :: reg_coeff
63 end subroutine reg_init
64 end interface
65
66 abstract interface
67 subroutine reg_free(this)
68 import regularization_t
69 class(regularization_t), intent(inout) :: this
70 end subroutine reg_free
71 end interface
72
73 abstract interface
74 subroutine reg_compute(this, time)
76 class(regularization_t), intent(inout) :: this
77 type(time_state_t), intent(in) :: time
78 end subroutine reg_compute
79 end interface
80
81 interface
82 module subroutine regularization_factory(object, type_name, json, &
83 coef, dof, reg_coeff)
84 class(regularization_t), allocatable, intent(inout) :: object
85 character(len=*), intent(in) :: type_name
86 type(json_file), intent(inout) :: json
87 type(coef_t), intent(in), target :: coef
88 type(dofmap_t), intent(in), target :: dof
89 type(field_t), intent(in), target :: reg_coeff
90 end subroutine regularization_factory
91 end interface
92
93 public :: regularization_factory
94
95contains
96
97 subroutine regularization_init_base(this, json, coef, dof, reg_coeff)
98 class(regularization_t), intent(inout) :: this
99 type(json_file), intent(inout) :: json
100 type(coef_t), intent(in), target :: coef
101 type(dofmap_t), intent(in), target :: dof
102 type(field_t), intent(in), target :: reg_coeff
103
104 this%coef => coef
105 this%dof => dof
106 this%reg_coeff => reg_coeff
107
108 end subroutine regularization_init_base
109
110 subroutine regularization_free_base(this)
111 class(regularization_t), intent(inout) :: this
112
113 nullify(this%coef)
114 nullify(this%dof)
115 nullify(this%reg_coeff)
116
117 end subroutine regularization_free_base
118
119end module regularization
Coefficients.
Definition coef.f90:34
Defines a mapping of the degrees of freedom.
Definition dofmap.f90:35
Defines a field.
Definition field.f90:34
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
subroutine regularization_init_base(this, json, coef, dof, reg_coeff)
subroutine regularization_free_base(this)
Module with things related to the simulation time.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:93
A struct that contains all info about the time, expand as needed.