Skip to content

Add the Long 1974 piecewise collision kernel#1785

Merged
slayoo merged 43 commits intomainfrom
ej/add_longkernel
Mar 24, 2026
Merged

Add the Long 1974 piecewise collision kernel#1785
slayoo merged 43 commits intomainfrom
ej/add_longkernel

Conversation

@ekdejong
Copy link
Copy Markdown
Collaborator

@ekdejong ekdejong commented Jan 8, 2026

  • Includes additional functionality in pair methods to support comparison and "where"
  • Adds a new option for collision kernel dynamics
  • Includes a new unit test in collision kernels

@slayoo
Copy link
Copy Markdown
Member

slayoo commented Jan 8, 2026

thank you @ekdejong !!!
CC-ing @yoctoyotta1024, @jbarr444 and @emmacware

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.93%. Comparing base (2b58ab4) to head (9a4c747).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1785      +/-   ##
==========================================
+ Coverage   86.85%   86.93%   +0.08%     
==========================================
  Files         415      416       +1     
  Lines       10558    10625      +67     
==========================================
+ Hits         9170     9237      +67     
  Misses       1388     1388              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ekdejong
Copy link
Copy Markdown
Collaborator Author

ekdejong commented Jan 9, 2026

@slayoo Can you help me understand the test that is currently failing? I made the linter happy, but it seems like black is still acting. Do I just need to run Black locally?

@slayoo
Copy link
Copy Markdown
Member

slayoo commented Jan 9, 2026

@slayoo Can you help me understand the test that is currently failing? I made the linter happy, but it seems like black is still acting. Do I just need to run Black locally?

black is executed automatically via a pre-commit hook after doing pre-commit install. Following it, a git commit ... command will trigger black, which will alter the files, and will stop the commit. Here, you can do git diff to make sure all of the automatic changes to the code are OK, following which repeating the same git commit ... command should work.

(this is mentioned in the README: https://github.com/open-atmos/PySDM/blob/main/README.md?plain=1#L131-L135, but any feedback on how to better explain the workflow warmly welcome!)

@ekdejong
Copy link
Copy Markdown
Collaborator Author

Thank you, @slayoo ! It's been some time since I contributed, clearly...

(this is mentioned in the README: https://github.com/open-atmos/PySDM/blob/main/README.md?plain=1#L131-L135, but any feedback on how to better explain the workflow warmly welcome!)

And speaking of which, thank you for bringing to my attention that the README has some valuable information on contributing! My bad for overlooking this.

@ekdejong ekdejong requested review from emmacware and slayoo January 10, 2026 05:16
@slayoo
Copy link
Copy Markdown
Member

slayoo commented Jan 11, 2026

(let me also clarify that from all the above comments, adding an example notebook reproducing a figure from the paper is by far my key suggestion here, and I'm happy to help with equipping it later with a smoke test executing the notebook code)

@slayoo
Copy link
Copy Markdown
Member

slayoo commented Jan 16, 2026

(let me also clarify that from all the above comments, adding an example notebook reproducing a figure from the paper is by far my key suggestion here, and I'm happy to help with equipping it later with a smoke test executing the notebook code)

Thanks @slayoo! I've added a notebook to replicate some of the DSDs in the Long paper. I think an appropriate smoke test could be to confirm the size of the mode in the DSD, and/or to confirm a comparison between the mean size predicted using the Long kernel versus Golovin kernel.

Thank you @ekdejong !

BTW, fun fact (thanks to @emmacware): Golovin's solution was actually given a bit earlier in the same journal by Safranov, which is why it is called Safranov kernel/solution in astrophysical literature: Safranov, V. S. (1962). "A particular solution of the coagulation equation" [in Russian: "Частный случай решения уравнения коагуляции"]. Bull. Acad. Sci. SSSR Geophys. Ser., 147 (1), 64—67. https://mathnet.ru/dan27172

@ekdejong
Copy link
Copy Markdown
Collaborator Author

@slayoo The current failing test appears related to condensation, not the kernels. Would you mind giving this PR another look (or suggesting another reviewer) so we can work toward merging?

@slayoo
Copy link
Copy Markdown
Member

slayoo commented Mar 19, 2026

@slayoo The current failing test appears related to condensation, not the kernels. Would you mind giving this PR another look (or suggesting another reviewer) so we can work toward merging?

hi @ekdejong, the job name is misleading here, but the failure is related to the changes here:

=========================== short test summary info ============================
FAILED tests/examples_tests/test_tests_completeness.py::test_all_cases_in_testsuites - AssertionError: assert {'/home/runne..._ARG.py', ...} == {'/home/runne..._ARG.py', ...}
  
  Extra items in the right set:
  '/home/runner/work/PySDM/PySDM/examples/PySDM_examples/Long_1974/simulation.py'
  '/home/runner/work/PySDM/PySDM/examples/PySDM_examples/Long_1974/fig10_11_13_14.ipynb'
  '/home/runner/work/PySDM/PySDM/examples/PySDM_examples/Long_1974/settings.py'

fix on the way...

@slayoo
Copy link
Copy Markdown
Member

slayoo commented Mar 19, 2026

for the record, the "failure" can be reproduced locally with:

$ pytest tests/examples_tests/test_tests_completeness.py 
============================= test session starts ==============================
platform linux -- Python 3.13.5, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/user/devel/PySDM
configfile: pyproject.toml
plugins: anyio-4.12.1
collected 3 items                                                              

tests/examples_tests/test_tests_completeness.py F..                      [100%]

=================================== FAILURES ===================================
_________________________ test_all_cases_in_testsuites _________________________

    def test_all_cases_in_testsuites():
        """raise error, e.g., if a newly added example is not within TEST_SUITES dict"""
        tmp = findfiles(
            pathlib.Path(__file__)
            .parent.parent.parent.absolute()
            .joinpath("examples")
            .joinpath("PySDM_examples"),
            r".*\.(py|ipynb)$",
        )
        all_files = list(
            filter(
                lambda x: pathlib.Path(x).name != "__init__.py",
                tmp,
            )
        )
    
        selected_paths_set = set()
        for suite_name in TEST_SUITES:
            selected_paths_set.update(
                map(str, get_selected_test_paths(suite_name, all_files))
            )
    
        assert len(all_files) > 0
>       assert selected_paths_set == set(all_files)
E       AssertionError: assert {'/home/user/..._ARG.py', ...} == {'/home/user/..._ARG.py', ...}
E         
E         Extra items in the right set:
E         '/home/user/devel/PySDM/examples/PySDM_examples/Long_1974/simulation.py'
E         '/home/user/devel/PySDM/examples/PySDM_examples/Long_1974/settings.py'
E         '/home/user/devel/PySDM/examples/PySDM_examples/Long_1974/fig10_11_13_14.ipynb'
E         Use -v to get more diff

tests/examples_tests/test_tests_completeness.py:32: AssertionError
=========================== short test summary info ============================
FAILED tests/examples_tests/test_tests_completeness.py::test_all_cases_in_testsuites - AssertionError: assert {'/home/user/..._ARG.py', ...} == {'/home/user/..._A...
========================= 1 failed, 2 passed in 0.16s ==========================

@slayoo slayoo added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 16dc774 Mar 24, 2026
98 checks passed
@slayoo slayoo mentioned this pull request Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants