Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
artificial_viscosity.f90
Go to the documentation of this file.
1! Copyright (c) 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!
33!
36 use num_types, only : rp
38 use registry, only : neko_registry
39 use field, only : field_t
40 use json_module, only : json_file
41 use json_utils, only : json_get
42 use coefs, only : coef_t
44 use dofmap, only : dofmap_t
45 use utils, only : neko_error
46 implicit none
47 private
48
51 contains
53 procedure, pass(this) :: init => artificial_viscosity_init_from_json
55 procedure, pass(this) :: free => artificial_viscosity_free
57 procedure, pass(this) :: update => artificial_viscosity_update
59
60contains
66 subroutine artificial_viscosity_init_from_json(this, json, coef, dof)
67 class(artificial_viscosity_t), intent(inout) :: this
68 type(json_file), intent(inout) :: json
69 type(coef_t), intent(in), target :: coef
70 type(dofmap_t), intent(in), target :: dof
71
72 call this%free()
73 call this%init_base(json, coef, dof)
74
75 call json_get(json, "reg_coeff_name", &
76 this%reg_coeff_name)
77
78 call neko_registry%add_field(dof, this%reg_coeff_name)
79 this%reg_coeff => neko_registry%get_field(this%reg_coeff_name)
80
82
86 class(artificial_viscosity_t), intent(inout) :: this
87
88 nullify(this%reg_coeff)
89 call this%free_base()
90
91 end subroutine artificial_viscosity_free
92
97 subroutine artificial_viscosity_update(this, effective_visc, mu)
98 class(artificial_viscosity_t), intent(inout) :: this
99 type(field_t), intent(inout) :: effective_visc
100 type(field_t), intent(in), optional :: mu
101
102 call field_copy(effective_visc, this%reg_coeff, this%coef%dof%size())
103 if (present(mu)) then
104 call field_add2(effective_visc, mu, this%coef%dof%size())
105 end if
106
107 end subroutine artificial_viscosity_update
108
109end module artificial_viscosity
Retrieves a parameter by name or throws an error.
Implements artificial_viscosity_t.
subroutine artificial_viscosity_free(this)
Free an artificial viscosity regularization.
subroutine artificial_viscosity_update(this, effective_visc, mu)
Update the effective viscosity with artificial and physical viscosity.
subroutine artificial_viscosity_init_from_json(this, json, coef, dof)
Construct an artificial viscosity regularization from JSON.
Coefficients.
Definition coef.f90:34
Defines a mapping of the degrees of freedom.
Definition dofmap.f90:35
subroutine, public field_add2(a, b, n)
Vector addition .
subroutine, public field_copy(a, b, n)
Copy a vector .
Defines a field.
Definition field.f90:34
Utilities for retrieving parameters from the case files.
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Defines a registry for storing solution fields.
Definition registry.f90:34
type(registry_t), target, public neko_registry
Global field registry.
Definition registry.f90:158
Utilities.
Definition utils.f90:35
Defines the base interface for viscous regularization methods.
The handler for the artificial viscosity.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition coef.f90:135
Base abstract type for viscous regularization methods.