8from .utils_polynomials
import *
11def compute_coagtabflux_k0(
12 kernel, K0, Q, vecnodes, vecweights, nbins, massgrid, mat_coeffs_leg, tensor_tabflux_coag
15 Function to precompute array depending only on massgrid to evaluate the coagulation flux
16 DG scheme with piecewise constant approximation
20 kernel : scalar, type -> integer
21 select the collisional kernel function
22 K0 : scalar, type -> float
23 constant value of the kernel function (used to adapt to code unit)
24 Q : scalar, type -> integer
25 number of points for Gauss-Legendre quadrature
26 vecnodes : 1D array (dim = Q), type -> float
27 nodes of the Legendre polynomials
28 vecweights : 1D array (dim = Q), type -> float
29 weights coefficients for the Gauss-Legendre polynomials
30 nbins : scalar, type -> integer
32 massgrid : 1D array (dim = nbins+1), type -> float
33 grid of masses given borders value of mass bins
34 mat_coeffs_leg : 2D array (dmin = (kpol+1,kpol+1)), type -> float
35 array containing on each line Legendre polynomial coefficients from degree 0 to kpol inclusive
36 on each line coefficients are ordered from low to high orders
37 tensor_tabflux_coag : 3D array (dim = (nbins,nbins,nbins)), type -> float
38 array to evaluate coagulation flux
42 filled array tensor_tabflux_coag
49 for j
in range(nbins):
50 for lp
in range(j + 1):
51 for l
in range(nbins):
52 res = coagfluxfunction(
69 tensor_tabflux_coag[j, lp, l] = res
77def compute_coagtabflux_k0_numba(
78 kernel, K0, Q, vecnodes, vecweights, nbins, massgrid, mat_coeffs_leg, tensor_tabflux_coag
81 Function to precompute array depending only on massgrid to evaluate the coagulation flux
82 DG scheme with piecewise constant approximation
87 kernel : scalar, type -> integer
88 select the collisional kernel function
89 K0 : scalar, type -> float
90 constant value of the kernel function (used to adapt to code unit)
91 Q : scalar, type -> integer
92 number of points for Gauss-Legendre quadrature
93 vecnodes : 1D array (dim = Q), type -> float
94 nodes of the Legendre polynomials
95 vecweights : 1D array (dim = Q), type -> float
96 weights coefficients for the Gauss-Legendre polynomials
97 nbins : scalar, type -> integer
99 massgrid : 1D array (dim = nbins+1), type -> float
100 grid of masses given borders value of mass bins
101 mat_coeffs_leg : 2D array (dmin = (kpol+1,kpol+1)), type -> float
102 array containing on each line Legendre polynomial coefficients from degree 0 to kpol inclusive
103 on each line coefficients are ordered from low to high orders
104 tensor_tabflux_coag : 3D array (dim = (nbins,nbins,nbins)), type -> float
105 array to evaluate coagulation flux
106 progress : used for numba progress bar
110 filled array tensor_tabflux_coag
114 for j
in range(nbins):
116 for lp
in range(j + 1):
117 for l
in range(nbins):
118 res = coagfluxfunction_numba(
135 tensor_tabflux_coag[j, lp, l] = res
138def compute_coagtabflux(
139 kernel, K0, Q, vecnodes, vecweights, nbins, kpol, massgrid, mat_coeffs_leg, tensor_tabflux_coag
142 Function to precompute array depending only on massgrid to evaluate the coagulation flux
143 DG scheme with piecewise polynomial approximation
147 kernel : scalar, type -> integer
148 select the collisional kernel function
149 K0 : scalar, type -> float
150 constant value of the kernel function (used to adapt to code unit)
151 Q : scalar, type -> integer
152 number of points for Gauss-Legendre quadrature
153 vecnodes : 1D array (dim = Q), type -> float
154 nodes of the Legendre polynomials
155 vecweights : 1D array (dim = Q), type -> float
156 weights coefficients for the Gauss-Legendre polynomials
157 nbins : scalar, type -> integer
159 kpol : scalar, type -> integer
160 degree of polynomials for approximation
161 massgrid : 1D array (dim = nbins+1), type -> float
162 grid of masses given borders value of mass bins
163 mat_coeffs_leg : 2D array (dmin = (kpol+1,kpol+1)), type -> float
164 array containing on each line Legendre polynomial coefficients from degree 0 to kpol inclusive
165 on each line coefficients are ordered from low to high orders
166 tensor_tabflux_coag : 5D array (dim = (nbins,nbins,nbins,kpol+1,kpol+1)), type -> float
167 array to evaluate coagulation flux
172 filled array tensor_tabflux_coag
179 for j
in range(nbins):
180 for lp
in range(j + 1):
181 for l
in range(nbins):
182 for ip
in range(kpol + 1):
183 for i
in range(kpol + 1):
184 res = coagfluxfunction(
201 tensor_tabflux_coag[j, lp, l, ip, i] = res
209def compute_coagtabflux_numba(
210 kernel, K0, Q, vecnodes, vecweights, nbins, kpol, massgrid, mat_coeffs_leg, tensor_tabflux_coag
213 Function to precompute array depending only on massgrid to evaluate the coagulation flux
214 DG scheme with piecewise polynomial approximation
219 kernel : scalar, type -> integer
220 select the collisional kernel function
221 K0 : scalar, type -> float
222 constant value of the kernel function (used to adapt to code unit)
223 Q : scalar, type -> integer
224 number of points for Gauss-Legendre quadrature
225 vecnodes : 1D array (dim = Q), type -> float
226 nodes of the Legendre polynomials
227 vecweights : 1D array (dim = Q), type -> float
228 weights coefficients for the Gauss-Legendre polynomials
229 nbins : scalar, type -> integer
231 kpol : scalar, type -> integer
232 degree of polynomials for approximation
233 massgrid : 1D array (dim = nbins+1), type -> float
234 grid of masses given borders value of mass bins
235 mat_coeffs_leg : 2D array (dmin = (kpol+1,kpol+1)), type -> float
236 array containing on each line Legendre polynomial coefficients from degree 0 to kpol inclusive
237 on each line coefficients are ordered from low to high orders
238 tensor_tabflux_coag : 5D array (dim = (nbins,nbins,nbins,kpol+1,kpol+1)), type -> float
239 array to evaluate coagulation flux
244 filled array tensor_tabflux_coag
248 for j
in range(nbins):
250 for lp
in range(j + 1):
251 for l
in range(nbins):
252 for ip
in range(kpol + 1):
253 for i
in range(kpol + 1):
254 res = coagfluxfunction_numba(
271 tensor_tabflux_coag[j, lp, l, ip, i] = res
274def compute_coagtabintflux(
284 tensor_tabintflux_coag,
287 Function to precompute array depending only on massgrid to evaluate the term including the integral of coagulation flux
288 DG scheme with piecewise polynomial approximation
292 kernel : scalar, type -> integer
293 select the collisional kernel function
294 K0 : scalar, type -> float
295 constant value of the kernel function (used to adapt to code unit)
296 Q : scalar, type -> integer
297 number of points for Gauss-Legendre quadrature
298 vecnodes : 1D array (dim = Q), type -> float
299 nodes of the Legendre polynomials
300 vecweights : 1D array (dim = Q), type -> float
301 weights coefficients for the Gauss-Legendre polynomials
302 nbins : scalar, type -> integer
304 kpol : scalar, type -> integer
305 degree of polynomials for approximation
306 massgrid : 1D array (dim = nbins+1), type -> float
307 grid of masses given borders value of mass bins
308 mat_coeffs_leg : 2D array (dmin = (kpol+1,kpol+1)), type -> float
309 array containing on each line Legendre polynomial coefficients from degree 0 to kpol inclusive
310 on each line coefficients are ordered from low to high orders
311 tensor_tabintflux_coag : 6D array (dim = (nbins,kpol+1,nbins,nbins,kpol+1,kpol+1)), type -> float
312 array to evaluate the term including the integral of the coagulation flux
317 filled array tensor_tabintflux_coag
323 for j
in range(nbins):
324 for k
in range(1, kpol + 1):
325 for lp
in range(j + 1):
326 for l
in range(nbins):
327 for ip
in range(kpol + 1):
328 for i
in range(kpol + 1):
329 res = coagintfluxfunction(
347 tensor_tabintflux_coag[j, k, lp, l, ip, i] = res
355def compute_coagtabintflux_numba(
365 tensor_tabintflux_coag,
368 Function to precompute array depending only on massgrid to evaluate the term including the integral of coagulation flux
369 DG scheme with piecewise polynomial approximation
374 kernel : scalar, type -> integer
375 select the collisional kernel function
376 K0 : scalar, type -> float
377 constant value of the kernel function (used to adapt to code unit)
378 Q : scalar, type -> integer
379 number of points for Gauss-Legendre quadrature
380 vecnodes : 1D array (dim = Q), type -> float
381 nodes of the Legendre polynomials
382 vecweights : 1D array (dim = Q), type -> float
383 weights coefficients for the Gauss-Legendre polynomials
384 nbins : scalar, type -> integer
386 kpol : scalar, type -> integer
387 degree of polynomials for approximation
388 massgrid : 1D array (dim = nbins+1), type -> float
389 grid of masses given borders value of mass bins
390 mat_coeffs_leg : 2D array (dmin = (kpol+1,kpol+1)), type -> float
391 array containing on each line Legendre polynomial coefficients from degree 0 to kpol inclusive
392 on each line coefficients are ordered from low to high orders
393 tensor_tabintflux_coag : 6D array (dim = (nbins,kpol+1,nbins,nbins,kpol+1,kpol+1)), type -> float
394 array to evaluate the term including the integral of the coagulation flux
395 progress : used for numba progress bar
400 filled array tensor_tabintflux_coag
405 for j
in range(nbins):
407 for k
in range(1, kpol + 1):
408 for lp
in range(j + 1):
409 for l
in range(nbins):
410 for ip
in range(kpol + 1):
411 for i
in range(kpol + 1):
412 res = coagintfluxfunction_numba(
430 tensor_tabintflux_coag[j, k, lp, l, ip, i] = res