Neko 1.99.2
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, tstep, dt)
76 class(regularization_t), intent(inout) :: this
77 type(time_state_t), intent(in) :: time
78 integer, intent(in) :: tstep
79 real(kind=rp), intent(in) :: dt
80 end subroutine reg_compute
81 end interface
82
83 interface
84 module subroutine regularization_factory(object, type_name, json, &
85 coef, dof, reg_coeff)
86 class(regularization_t), allocatable, intent(inout) :: object
87 character(len=*), intent(in) :: type_name
88 type(json_file), intent(inout) :: json
89 type(coef_t), intent(in), target :: coef
90 type(dofmap_t), intent(in), target :: dof
91 type(field_t), intent(in), target :: reg_coeff
92 end subroutine regularization_factory
93 end interface
94
95 public :: regularization_factory
96
97contains
98
99 subroutine regularization_init_base(this, json, coef, dof, reg_coeff)
100 class(regularization_t), intent(inout) :: this
101 type(json_file), intent(inout) :: json
102 type(coef_t), intent(in), target :: coef
103 type(dofmap_t), intent(in), target :: dof
104 type(field_t), intent(in), target :: reg_coeff
105
106 this%coef => coef
107 this%dof => dof
108 this%reg_coeff => reg_coeff
109
110 end subroutine regularization_init_base
111
112 subroutine regularization_free_base(this)
113 class(regularization_t), intent(inout) :: this
114
115 nullify(this%coef)
116 nullify(this%dof)
117 nullify(this%reg_coeff)
118
119 end subroutine regularization_free_base
120
121end module regularization
122
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:12
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:56
A struct that contains all info about the time, expand as needed.