Skip to content

Commit e8ff800

Browse files
committed
[Pylib][COALA] reduce differential velocity input dimensionality
1 parent 32f3676 commit e8ff800

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/pylib/shamrock/external/coala/interface_coala_shamrock.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .generate_flux_intflux import compute_flux_coag_k0_kdv
44

55

6-
def coala_source_term_k0(nbins, massgrid, rhodust, rhodust_eps, tensor_tabflux_coag, dv):
6+
def coala_source_term_k0(nbins, massgrid, rhodust, rhodust_eps, tensor_tabflux_coag, v_dust):
77
"""
88
Function to compute the source for coagulation and fragmentation in continuity equation for piecewise constant approximation (see Lombart et al., 2021)
99
Function for ballistic kernel with differential velocities dv
@@ -23,9 +23,8 @@ def coala_source_term_k0(nbins, massgrid, rhodust, rhodust_eps, tensor_tabflux_c
2323
threshold value for rhodust
2424
tensor_tabflux_coag : 3D array (dim = (nbins,nbins,nbins)), type -> float
2525
array to evaluate coagulation flux
26-
dv : 2D array (dim = (nbins,nbins)), type -> float
27-
array of the differential velocity between grains
28-
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)
2928
3029
Returns
3130
-------
@@ -41,6 +40,12 @@ def coala_source_term_k0(nbins, massgrid, rhodust, rhodust_eps, tensor_tabflux_c
4140
if rhodust[j] > rhodust_eps:
4241
gij[j] = rhodust[j] / (massgrid[j + 1] - massgrid[j])
4342

43+
# dv_ij = v_dust_j - v_dust_i
44+
dv = np.zeros((nbins, nbins))
45+
for i in range(nbins):
46+
for j in range(nbins):
47+
dv[i, j] = v_dust[j] - v_dust[i]
48+
4449
# copmute flux for all dust bins
4550
flux = compute_flux_coag_k0_kdv(gij, tensor_tabflux_coag, dv)
4651

0 commit comments

Comments
 (0)