Neko  0.9.0
A portable framework for high-order spectral element flow simulations
scalar_source_term.f90
Go to the documentation of this file.
1 
2 ! Copyright (c) 2024, The Neko Authors
3 ! All rights reserved.
4 !
5 ! Redistribution and use in source and binary forms, with or without
6 ! modification, are permitted provided that the following conditions
7 ! are met:
8 !
9 ! * Redistributions of source code must retain the above copyright
10 ! notice, this list of conditions and the following disclaimer.
11 !
12 ! * Redistributions in binary form must reproduce the above
13 ! copyright notice, this list of conditions and the following
14 ! disclaimer in the documentation and/or other materials provided
15 ! with the distribution.
16 !
17 ! * Neither the name of the authors nor the names of its
18 ! contributors may be used to endorse or promote products derived
19 ! from this software without specific prior written permission.
20 !
21 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 ! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 ! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 ! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 ! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 ! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 ! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 ! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 ! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 ! POSSIBILITY OF SUCH DAMAGE.
33 !
37  use source_term, only: source_term_t
39  use field, only: field_t
40  use field_list, only: field_list_t
41  use coefs, only: coef_t
42  use user_intf, only: user_t
43  implicit none
44  private
45 
50  type, public, extends(source_term_handler_t) :: scalar_source_term_t
51 
52  contains
54  procedure, pass(this) :: init => scalar_source_term_init
56  procedure, nopass :: init_user_source => scalar_init_user_source
57 
58  end type scalar_source_term_t
59 
60 contains
61 
63  subroutine scalar_source_term_init(this, f, coef, user)
64  class(scalar_source_term_t), intent(inout) :: this
65  type(field_t), pointer, intent(in) :: f
66  type(coef_t), target, intent(inout) :: coef
67  type(user_t), target, intent(in) :: user
68 
69  type(field_list_t) :: rhs_fields
70 
71  ! We package the fields for the source term to operate on in a field list.
72  call rhs_fields%init(1)
73  call rhs_fields%assign(1, f)
74 
75  call this%init_base(rhs_fields, coef, user)
76  end subroutine scalar_source_term_init
77 
85  subroutine scalar_init_user_source(source_term, rhs_fields, coef, type, user)
86  class(source_term_t), allocatable, intent(inout) :: source_term
87  type(field_list_t) :: rhs_fields
88  type(coef_t), intent(inout) :: coef
89  character(len=*) :: type
90  type(user_t), intent(in) :: user
91 
93 
94  select type (source_term)
96  call source_term%init_from_components(rhs_fields, coef, type, &
97  user%scalar_user_f_vector, &
98  user%scalar_user_f)
99  end select
100  end subroutine scalar_init_user_source
101 
102 end module scalar_source_term
Coefficients.
Definition: coef.f90:34
Defines a field.
Definition: field.f90:34
Implements the scalar_source_term_t type.
subroutine scalar_init_user_source(source_term, rhs_fields, coef, type, user)
Initialize the user source term.
subroutine scalar_source_term_init(this, f, coef, user)
Constructor.
Implements the scalar_user_source_term_t type.
Implements the source_term_handler_t type.
Implements the source_term_t type and a wrapper source_term_wrapper_t.
Definition: source_term.f90:34
Interfaces for user interaction with NEKO.
Definition: user_intf.f90:34
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Definition: coef.f90:55
field_list_t, To be able to group fields together
Definition: field_list.f90:13
Wrapper contaning and executing the scalar source terms.
A source-term for the scalar, with procedure pointers pointing to the actual implementation in the us...
Base abstract type for source terms.
Definition: source_term.f90:43
Abstract class for handling source terms.