Neko  0.8.99
A portable framework for high-order spectral element flow simulations
fluid_source_term.f90
Go to the documentation of this file.
1 
2 ! Copyright (c) 2023, 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) :: fluid_source_term_t
51 
52  contains
54  procedure, pass(this) :: init => fluid_source_term_init
56  procedure, nopass :: init_user_source => fluid_init_user_source
57 
58  end type fluid_source_term_t
59 
60 contains
61 
63  subroutine fluid_source_term_init(this, f_x, f_y, f_z, coef, user)
64  class(fluid_source_term_t), intent(inout) :: this
65  type(field_t), pointer, intent(in) :: f_x, f_y, f_z
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(3)
73  call rhs_fields%assign(1, f_x)
74  call rhs_fields%assign(2, f_y)
75  call rhs_fields%assign(3, f_z)
76 
77  call this%init_base(rhs_fields, coef, user)
78  end subroutine fluid_source_term_init
79 
87  subroutine fluid_init_user_source(source_term, rhs_fields, coef, type, user)
88  class(source_term_t), allocatable, intent(inout) :: source_term
89  type(field_list_t) :: rhs_fields
90  type(coef_t), intent(inout) :: coef
91  character(len=*) :: type
92  type(user_t), intent(in) :: user
93 
95 
96  select type (source_term)
97  type is (fluid_user_source_term_t)
98  call source_term%init_from_components(rhs_fields, coef, type, &
99  user%fluid_user_f_vector, &
100  user%fluid_user_f)
101  end select
102  end subroutine fluid_init_user_source
103 
104 end module fluid_source_term
Coefficients.
Definition: coef.f90:34
Defines a field.
Definition: field.f90:34
Implements the fluid_source_term_t type.
subroutine fluid_init_user_source(source_term, rhs_fields, coef, type, user)
Initialize the user source term.
subroutine fluid_source_term_init(this, f_x, f_y, f_z, coef, user)
Constructor.
Implements the fluid_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 fluid source terms.
A source-term for the fluid, with procedure pointers pointing to the actual implementation in the use...
Base abstract type for source terms.
Definition: source_term.f90:43
Abstract class for handling source terms.