4def compute_flux_coag_k0(gij, tensor_tabflux_coag):
6 Function to compute the approximation of the coagulation flux with DG scheme k=0
7 Flux defined at the right boundary of mass bins, i.e. flux[j] ~ F(m_{j+1/2})
11 gij : 1D array (dim = nbins), type -> float
12 components of g on the polynomial basis
13 tensor_tabflux_coag : 3D array (dim = (nbins,nbins,nbins)), type -> float
14 array to evaluate coagulation flux
19 flux : 1D array (dim = nbins), type -> float
20 approximation of the coagulation flux at each bin
26 flux = np.einsum(
"jlm,l,m->j", tensor_tabflux_coag, gij, gij)
31def compute_flux_coag_k0_kdv(gij, tensor_tabflux_coag, dv):
33 Function to compute the approximation of the coagulation flux with DG scheme k=0
34 Flux defined at the right boundary of mass bins, i.e. flux[j] ~ F(m_{j+1/2})
35 Function for ballistic kernel with differential velocities dv
39 gij : 1D array (dim = nbins), type -> float
40 components of g on the polynomial basis
41 tensor_tabflux_coag : 3D array (dim = (nbins,nbins,nbins)), type -> float
42 array to evaluate coagulation flux
43 dv : 2D array (dim = (nbins,nbins)), type -> float
44 array of the differential velocity between grains
49 flux : 1D array (dim = nbins), type -> float
50 approximation of the coagulation flux at each bin
56 flux = np.einsum(
"jlm,lm,l,m->j", tensor_tabflux_coag, dv, gij, gij)
61def compute_flux_coag(gij, tensor_tabflux_coag):
63 Function to compute the approximation of the coagulation flux with DG scheme k>0
64 Flux defined at the right boundary of mass bins, i.e. flux[j] ~ F(m_{j+1/2})
68 gij : 2D array (dim = (nbins,kpol+1)), type -> float
69 components of g on the polynomial basis
70 tensor_tabflux_coag : 5D array (dim = (nbins,nbins,nbins,kpol+1,kpol+1)), type -> float
71 array to evaluate coagulation flux
76 flux : 1D array (dim = nbins), type -> float
77 approximation of the coagulation flux at each bin
86 arr_gij = np.einsum(
"ac,bd->abcd", gij, gij)
88 [np.sum(tensor_tabflux_coag[j, :, :, :, :] * arr_gij)
for j
in range(len(gij[:, 0]))]
94def compute_flux_coag_kdv(gij, tensor_tabflux_coag, dv):
96 Function to compute the approximation of the coagulation flux with DG scheme k>0
97 Flux defined at the right boundary of mass bins, i.e. flux[j] ~ F(m_{j+1/2})
98 Function for ballistic kernel with differential velocities dv
102 gij : 2D array (dim = (nbins,kpol+1)), type -> float
103 components of g on the polynomial basis
104 tensor_tabflux_coag : 5D array (dim = (nbins,nbins,nbins,kpol+1,kpol+1)), type -> float
105 array to evaluate coagulation flux
106 dv : 2D array (dim = (nbins,nbins)), type -> float
107 array of the differential velocity between grains
112 flux : 1D array (dim = nbins), type -> float
113 approximation of the coagulation flux at each bin
125 nbins = len(gij[:, 0])
126 kpol = len(gij[0, :]) - 1
127 arr_gij_dv = np.zeros((nbins, nbins, kpol + 1, kpol + 1))
128 for lp
in range(nbins):
129 for l
in range(nbins):
130 for ip
in range(kpol + 1):
131 for i
in range(kpol + 1):
132 arr_gij_dv[lp, l, ip, i] = gij[lp, ip] * gij[l, i] * dv[lp, l]
135 [np.sum(tensor_tabflux_coag[j, :, :, :, :] * arr_gij_dv)
for j
in range(len(gij[:, 0]))]
141def compute_intflux_coag(gij, tensor_tabintflux_coag):
143 Function to compute the approximation of the term including the integral of coagulation flux with DG scheme k>0
147 gij : 2D array (dim = (nbins,kpol+1)), type -> float
148 components of g on the polynomial basis
149 tensor_tabintflux_coag : 6D array (dim = (nbins,kpol+1,nbins,nbins,kpol+1,kpol+1)), type -> float
150 array to evaluate the term including the intgegral of the coagulation flux
155 intflux : 2D array (dim = (nbins,kpol+1)), type -> float
156 approximation of the term including the integral of coagulation flux at each bin
160 arr_gij = np.einsum(
"ac,bd->abcd", gij, gij)
162 nbins = len(gij[:, 0])
163 dim_kpol = len(gij[0, :])
164 intflux = np.zeros((nbins, dim_kpol))
165 for j
in range(nbins):
166 for k
in range(1, dim_kpol):
167 intflux[j, k] = np.sum(tensor_tabintflux_coag[j, k, :, :, :, :] * arr_gij)
172def compute_intflux_coag_kdv(gij, tensor_tabintflux_coag, dv):
174 Function to compute the approximation of the term including the integral of coagulation flux with DG scheme k>0
175 Function for ballistic kernel with differential velocities dv
179 gij : 2D array (dim = (nbins,kpol+1)), type -> float
180 components of g on the polynomial basis
181 tensor_tabintflux_coag : 6D array (dim = (nbins,kpol+1,nbins,nbins,kpol+1,kpol+1)), type -> float
182 array to evaluate the term including the integral of the coagulation flux
183 dv : 2D array (dim = (nbins,nbins)), type -> float
184 array of the differential velocity between grains
188 intflux : 2D array (dim = (nbins,kpol+1)), type -> float
189 approximation of the term including the integral of coagulation flux at each bin
193 arr_gij_dv = np.einsum(
"ac,bd,ab->abcd", gij, gij, dv)
195 nbins = len(gij[:, 0])
196 dim_kpol = len(gij[0, :])
197 intflux = np.zeros((nbins, dim_kpol))
198 for j
in range(nbins):
199 for k
in range(1, dim_kpol):
200 intflux[j, k] = np.sum(tensor_tabintflux_coag[j, k, :, :, :, :] * arr_gij_dv)