3from .generate_flux_intflux
import compute_flux_coag_k0_kdv
6def coala_source_term_k0(nbins, massgrid, rhodust, rhodust_eps, tensor_tabflux_coag, v_dust):
8 Function to compute the source for coagulation and fragmentation in continuity equation for piecewise constant approximation (see Lombart et al., 2021)
9 Function for ballistic kernel with differential velocities dv
10 Used to evaluate the source term, then hydro code applies time solver
12 /!\ Only coagulation so far
16 nbins : scalar, type -> integer
18 massgrid : 1D array (dim = nbins+1), type -> float
19 grid of masses given borders value of mass bins
20 rhodust : 1D array (dim = nbins), type -> float
21 dust density for each grain size
22 rhodust_eps : scalar, type -> float
23 threshold value for rhodust
24 tensor_tabflux_coag : 3D array (dim = (nbins,nbins,nbins)), type -> float
25 array to evaluate coagulation flux
26 v_dust : 1D array (dim = (nbins)), type -> float
27 array of the dust velocities (could also be delta_v in monofluid since it is a delta)
31 S_coag : 1D array (dim = nbins), type -> float
32 Source term for dust coagulation in continuity equation
33 DG operator for piecewise constant approximation in each binls
39 for j
in range(nbins):
40 if rhodust[j] > rhodust_eps:
41 gij[j] = rhodust[j] / (massgrid[j + 1] - massgrid[j])
44 dv = v_dust[
None, :] - v_dust[:,
None]
47 flux = compute_flux_coag_k0_kdv(gij, tensor_tabflux_coag, dv)
49 S_coag = np.zeros(nbins)
51 S_coag[1:] = flux[:-1] - flux[1:]