38  use json_module, 
only : json_file
 
   47     type(
coef_t), 
pointer :: coef => null()
 
   49     real(kind=
rp) :: start_time = 0.0_rp
 
   51     real(kind=
rp) :: end_time = huge(0.0_rp)
 
 
   85       type(json_file), 
intent(inout) :: json
 
   87       type(
coef_t), 
intent(inout), 
target :: coef
 
 
  106       real(kind=
rp), 
intent(in) :: t
 
  107       integer, 
intent(in) :: tstep
 
 
  116     module subroutine source_term_factory(object, json, fields, coef)
 
  117       class(source_term_t), 
allocatable, 
intent(inout) :: object
 
  118       type(json_file), 
intent(inout) :: json
 
  120       type(
coef_t), 
intent(inout) :: coef
 
  121     end subroutine source_term_factory
 
  124  public :: source_term_factory
 
  134  subroutine source_term_init_base(this, fields, coef, start_time, end_time)
 
  135    class(source_term_t), 
intent(inout) :: this
 
  137    type(
coef_t), 
intent(inout), 
target :: coef
 
  138    real(kind=
rp), 
intent(in) :: start_time
 
  139    real(kind=
rp), 
intent(in) :: end_time
 
  140    integer :: n_fields, i
 
  143    this%start_time = start_time
 
  144    this%end_time = end_time
 
  145    n_fields = fields%size()
 
  147    call this%fields%init(n_fields)
 
  152       call this%fields%assign(i, fields%get(i))
 
 
  154  end subroutine source_term_init_base
 
  157  subroutine source_term_free_base(this)
 
  158    class(source_term_t), 
intent(inout) :: this
 
  160    call this%fields%free()
 
 
  162  end subroutine source_term_free_base
 
  165  subroutine source_term_wrapper_free(this)
 
  166    class(source_term_wrapper_t), 
intent(inout) :: this
 
  167    integer :: n_fields, i
 
  169    if (
allocated(this%source_term)) 
then 
  170       call this%source_term%free()
 
  171       deallocate(this%source_term)
 
 
  173  end subroutine source_term_wrapper_free
 
  178  subroutine source_term_compute_wrapper(this, t, tstep)
 
  179    class(source_term_t), 
intent(inout) :: this
 
  180    real(kind=
rp), 
intent(in) :: t
 
  181    integer, 
intent(in) :: tstep
 
  183    if (t .ge. this%start_time .and. t .le. this%end_time) 
then 
  184       call this%compute_(t, tstep)
 
 
  187  end subroutine source_term_compute_wrapper
 
Computes the source term and adds the result to fields.
 
The common constructor using a JSON object.
 
integer, parameter, public rp
Global precision used in computations.
 
Implements the source_term_t type and a wrapper source_term_wrapper_t.
 
subroutine source_term_wrapper_free(this)
Destructor for the source_term_wrapper_t type.
 
subroutine source_term_compute_wrapper(this, t, tstep)
Executes compute_ based on time conditions.
 
subroutine source_term_free_base(this)
Destructor for the source_term_t (base) type.
 
subroutine source_term_init_base(this, fields, coef, start_time, end_time)
Source term factory. Both constructs and initializes the object.
 
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
 
field_list_t, To be able to group fields together
 
Base abstract type for source terms.
 
A helper type that is needed to have an array of polymorphic objects.