ETS-Core  version:0.0.4-46-ge2d8
Core actors for the ETS-6
 All Classes Files Functions Variables Pages
hyperdiffusion.f90
Go to the documentation of this file.
2 
3  use ids_schemas, only: ids_real, ids_real_invalid
5 
6 contains
7 
8  subroutine get_hyper_values(hyper, rho, nrho_bnd, prof, deriv, diff, params, active, prof_name, error_index, error_message)
10  use control_parameters, only: id_diffusion_and_advection, id_diffusion_and_source
11 
12  ! Input/Output
13  type(hyperdiffusion_type), intent(inout) :: hyper
14  real(ids_real), intent(in) :: rho(:)
15  integer, intent(in) :: nrho_bnd
16  real(ids_real), intent(in) :: prof(:)
17  real(ids_real), intent(in) :: deriv(:)
18  real(ids_real), intent(in) :: diff(:)
19  type(type_hyperdiffusion_params), intent(in) :: params
20  logical, intent(in) :: active
21  character(*), intent(in) :: prof_name
22  integer, intent(out) :: error_index
23  character(*), intent(inout) :: error_message
24 
25  ! Internal
26  real(ids_real) :: max_rho(size(rho))
27  integer :: nrho
28 
29  nrho = size(rho)
30 
31  hyper%diff = 0.0_ids_real
32  hyper%vconv = 0.0_ids_real
33  hyper%src = 0.0_ids_real
34 
35  ! If hyper-diffusion is turned off, then we should return zero coefficients
36  if (.not. active) return
37 
38  ! Set the value of the hyper diffusion, but do not fill the entire rho-domain...
39  ! - leave at least one grid point by boundary between the core and the edge, here described by nrho_bnd;
40  ! - do not fill the hyper-diffusion beyond the "rho_norm_cutoff".
41  max_rho = min( 0.5_ids_real*(rho(nrho_bnd-1)+rho(nrho_bnd)) , params%rho_norm_cutoff)
42  where (rho <= max_rho)
43  hyper%diff = params%explicit + params%implicit * maxval(diff(1:nrho_bnd))
44  end where
45 
46  ! Fill the term that will cancel the flux from the hyper diffusion, i.e. either a convection term or an source term
47  if (params%terms == id_diffusion_and_advection) THEN
48  where (abs(deriv) <= tiny(1.0_ids_real))
49  hyper%vconv = hyper%diff * deriv / prof
50  end where
51  elseif (params%terms == id_diffusion_and_source) THEN
52  error_index = -1
53  error_message = 'in hyper_value ('//prof_name//'), hyperdiffusion with sources is not yet implemented'
54  return
55  else
56  error_index = -1
57  error_message = 'in hyper_value ('//prof_name//'), cannot determine how to set up the hyperdiffusion'
58  return
59  end if
60 
61  error_index = 0
62 
63  end subroutine get_hyper_values
64 
65 end module hyperdiffusion
subroutine get_hyper_values(hyper, rho, nrho_bnd, prof, deriv, diff, params, active, prof_name, error_index, error_message)
The module defines derived types used by ETS6-CoreActor and subroutines to allocate and deallocate in...
Definition: ets_plasma.f90:26
Structure describing the hyper-diffusion/convection/source Here the concept of hyper diffusion refers...
The module declares types of variables used by numerical solvers.