afivo-streamer 1.1
1D/2D/3D streamer simulations with AMR
Loading...
Searching...
No Matches
m_coupling.f90
Go to the documentation of this file.
1!> Module for the coupling between the gas dynamics and the fluid model
3#include "../afivo/src/cpp_macros.h"
4 use m_types
5 use m_af_all
7 use m_gas
8 use m_streamer
10 use m_field
11
12 implicit none
13 private
14
17
18contains
19
20 !> Add source terms form the fluid model to the Euler equations
21 subroutine coupling_add_fluid_source(tree, dt)
22 type(af_t), intent(inout) :: tree
23 real(dp), intent(in) :: dt
24
25 call af_loop_box_arg(tree, add_heating_box, [dt], .true.)
26 end subroutine coupling_add_fluid_source
27
28 subroutine add_heating_box(box, dt_vec)
29 type(box_t), intent(inout) :: box
30 real(dp), intent(in) :: dt_vec(:)
31 integer :: ijk, nc
32 real(dp) :: j_dot_e, ehd_force(ndim)
33 real(dp) :: e_vt_release, tmp, eff_fast, eff_slow
34 real(dp) :: e_vector(dtimes(1:box%n_cell), ndim)
35
36 nc = box%n_cell
37 do kji_do(1, nc)
38 ! Compute inner product flux * field over the cell faces
39 j_dot_e = 0.5_dp * sum(box%fc(ijk, :, flux_elec) * box%fc(ijk, :, electric_fld))
40#if NDIM == 1
41 j_dot_e = j_dot_e + 0.5_dp * (&
42 box%fc(i+1, 1, flux_elec) * box%fc(i+1, 1, electric_fld))
43#elif NDIM == 2
44 j_dot_e = j_dot_e + 0.5_dp * (&
45 box%fc(i+1, j, 1, flux_elec) * box%fc(i+1, j, 1, electric_fld) + &
46 box%fc(i, j+1, 2, flux_elec) * box%fc(i, j+1, 2, electric_fld))
47#elif NDIM == 3
48 j_dot_e = j_dot_e + 0.5_dp * (&
49 box%fc(i+1, j, k, 1, flux_elec) * box%fc(i+1, j, k, 1, electric_fld) + &
50 box%fc(i, j+1, k, 2, flux_elec) * box%fc(i, j+1, k, 2, electric_fld) + &
51 box%fc(i, j, k+1, 3, flux_elec) * box%fc(i, j, k+1, 3, electric_fld))
52#endif
53
54 tmp = j_dot_e * uc_elec_charge * dt_vec(1)
55
56 if (gas_fraction_slow_heating > 0) then
59
60 e_vt_release = box%cc(ijk, i_vibration_energy)/gas_vt_time * dt_vec(1)
61 box%cc(ijk, i_vibration_energy) = box%cc(ijk, i_vibration_energy) + &
62 eff_slow * tmp - e_vt_release
63 box%cc(ijk, gas_vars(i_e)) = box%cc(ijk, gas_vars(i_e)) + &
64 eff_fast * tmp + e_vt_release
65 else
66 box%cc(ijk, gas_vars(i_e)) = box%cc(ijk, gas_vars(i_e)) + &
68 end if
69 end do; close_do
70
71 e_vector = field_get_e_vector(box)
72
73 ! EHD force
74 do kji_do(1, nc)
75 ehd_force = uc_elem_charge * sum(box%cc(ijk, charged_species_itree) * &
76 charged_species_charge) * e_vector(ijk, :)
77
78 box%cc(ijk, gas_vars(i_mom)) = box%cc(ijk, gas_vars(i_mom)) + &
79 gas_ehd_factor * ehd_force * dt_vec(1)
80 end do; close_do
81
82 end subroutine add_heating_box
83
84 !> Update gas number density in the fluid model
86 type(af_t), intent(inout) :: tree
87
88 call af_loop_box(tree, update_gas_density, .true.)
89 call af_gc_tree(tree, [i_gas_dens])
90 end subroutine coupling_update_gas_density
91
92 subroutine update_gas_density(box)
93 type(box_t), intent(inout) :: box
94 integer :: nc
95 real(dp) :: inv_weight
96
97 nc = box%n_cell
98 inv_weight = 1/gas_molecular_weight
99
100 box%cc(dtimes(1:nc), i_gas_dens) = &
101 box%cc(dtimes(1:nc), gas_vars(i_rho)) * inv_weight
102 end subroutine update_gas_density
103
104end module m_coupling
Module for handling chemical reactions.
integer, dimension(:), allocatable, public, protected charged_species_itree
List with indices of charged species.
integer, dimension(:), allocatable, public, protected charged_species_charge
List with charges of charged species.
Module for the coupling between the gas dynamics and the fluid model.
Definition m_coupling.f90:2
subroutine, public coupling_add_fluid_source(tree, dt)
Add source terms form the fluid model to the Euler equations.
subroutine, public coupling_update_gas_density(tree)
Update gas number density in the fluid model.
Module to compute electric fields.
Definition m_field.f90:2
real(dp) function, dimension(dtimes(1:box%n_cell), ndim), public field_get_e_vector(box)
Definition m_field.f90:808
Module that stores parameters related to the gas.
Definition m_gas.f90:2
integer, dimension(ndim), parameter, public i_mom
Definition m_gas.f90:85
real(dp), public, protected gas_heating_efficiency
Definition m_gas.f90:54
integer, dimension(n_vars_euler), public, protected gas_vars
Definition m_gas.f90:69
real(dp), public, protected gas_fraction_slow_heating
Definition m_gas.f90:57
integer, parameter, public i_e
Definition m_gas.f90:91
integer, public, protected i_vibration_energy
Definition m_gas.f90:77
real(dp), public, protected gas_vt_time
Vibration-Translation relaxation time (s)
Definition m_gas.f90:51
real(dp), public, protected gas_ehd_factor
Definition m_gas.f90:60
This module contains several pre-defined variables like:
Definition m_streamer.f90:6
integer, public, protected flux_elec
Index of electron flux.
integer, public, protected electric_fld
Index of electric field vector.
Module with basic types.
Definition m_types.f90:2
Module that contains physical and numerical constants.
real(dp), parameter uc_elem_charge
real(dp), parameter uc_elec_charge