Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
viscous_regularization.f90
Go to the documentation of this file.
1! Copyright (c) 2025-2026, 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!
35 use num_types, only : rp
36 use json_module, only : json_file
37 use field, only : field_t
38 use coefs, only : coef_t
39 use dofmap, only : dofmap_t
40 use time_state, only : time_state_t
41 implicit none
42 private
43
45 type, abstract, public :: viscous_regularization_t
47 type(field_t), pointer :: reg_coeff => null()
49 character(len=:), allocatable :: reg_coeff_name
51 type(coef_t), pointer :: coef => null()
53 type(dofmap_t), pointer :: dof => null()
54 contains
56 procedure, pass(this) :: init_base => viscous_regularization_init_base
58 procedure, pass(this) :: free_base => viscous_regularization_free_base
60 procedure(reg_init), pass(this), deferred :: init
62 procedure(reg_free), pass(this), deferred :: free
64 procedure(reg_update), pass(this), deferred :: update
66
67 abstract interface
68
73 subroutine reg_init(this, json, coef, dof)
75 class(viscous_regularization_t), intent(inout) :: this
76 type(json_file), intent(inout) :: json
77 type(coef_t), intent(in), target :: coef
78 type(dofmap_t), intent(in), target :: dof
79 end subroutine reg_init
80 end interface
81
82 abstract interface
83
85 subroutine reg_free(this)
87 class(viscous_regularization_t), intent(inout) :: this
88 end subroutine reg_free
89 end interface
90
91 abstract interface
92
96 subroutine reg_update(this, effective_visc, mu)
98 class(viscous_regularization_t), intent(inout) :: this
99 type(field_t), intent(inout) :: effective_visc
100 type(field_t), intent(in), optional :: mu
101 end subroutine reg_update
102 end interface
103
104 interface
105
111 module subroutine viscous_regularization_factory(object, type_name, json, &
112 coef, dof)
113 class(viscous_regularization_t), allocatable, intent(inout) :: object
114 character(len=*), intent(in) :: type_name
115 type(json_file), intent(inout) :: json
116 type(coef_t), intent(in), target :: coef
117 type(dofmap_t), intent(in), target :: dof
118 end subroutine viscous_regularization_factory
119 end interface
120
121 public :: viscous_regularization_factory
122
123contains
124
130 subroutine viscous_regularization_init_base(this, json, coef, dof)
131 class(viscous_regularization_t), intent(inout) :: this
132 type(json_file), intent(inout) :: json
133 type(coef_t), intent(in), target :: coef
134 type(dofmap_t), intent(in), target :: dof
135
136 this%coef => coef
137 this%dof => dof
138
139 end subroutine viscous_regularization_init_base
140
143 subroutine viscous_regularization_free_base(this)
144 class(viscous_regularization_t), intent(inout) :: this
145
146 nullify(this%reg_coeff)
147 if (allocated(this%reg_coeff_name)) deallocate(this%reg_coeff_name)
148 nullify(this%coef)
149 nullify(this%dof)
150
151 end subroutine viscous_regularization_free_base
152
153end module viscous_regularization
Free a viscous regularization method.
Initialize a viscous regularization method.
Update an effective viscosity field.
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
Module with things related to the simulation time.
Defines the base interface for viscous regularization methods.
subroutine viscous_regularization_init_base(this, json, coef, dof)
Allocate and initialize a viscous regularization method.
subroutine viscous_regularization_free_base(this)
Free state shared by all viscous regularization methods.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:135
A struct that contains all info about the time, expand as needed.
Base abstract type for viscous regularization methods.