Skip to content

Conversation

jcurtis2
Copy link
Member

@jcurtis2 jcurtis2 commented Jul 30, 2024

  • Add CampCore() that takes a filename argument
  • Add alternative initializations for GasData, AeroData to accept CampCore
  • Example notebook of partmc/scenarios/5_camp
  • Handle json input files in notebook

@jcurtis2 jcurtis2 self-assigned this Jul 30, 2024
@slayoo
Copy link
Member

slayoo commented Oct 20, 2024

@jcurtis2, in the recent commits, there are:

  • a refactor of the time-stepping logic making the code shorter and a bit more Pythoni
  • a workaround for the JSON files issue (inability to ship seperate files with notebooks) by downloading them from github.com

Still, the new CAMP notebook fails for a variety of reasons:

  • on Windows:
ERROR (PartMC-592148911): Solver failed for aerosol-phase with code -6
terminate called after throwing an instance of 'std::runtime_error'
  what():  845183800
  • on macos-14 (Apple Silicon):
libc++abi: terminating due to uncaught exception of type std::runtime_error: to_json not implemented for this type of object: <_PyPartMC.CampCore object at 0x109d731b0>
  • on Linux:
free(): double free detected in tcache 2

Could you please check on your machine? Thanks

@slayoo
Copy link
Member

slayoo commented Oct 26, 2024

OK, managed to get a backtrace for the macOS error (libc++abi: terminating due to uncaught exception of type std::runtime_error: to_json not implemented for this type of object: <_PyPartMC.CampCore object at 0x109d731b0>):

    frame #1: 0x0000000106601f00 _PyPartMC.cpython-310-darwin.so`pyjson::to_json(obj=0x000000016fdfbfb0) at pybind11_json.hpp:137:9
    frame #2: 0x000000010660136c _PyPartMC.cpython-310-darwin.so`pybind11::detail::type_caster<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std:
:__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >, void>::load(this=0x000
000016fdfc0f8, src=handle @ 0x000000016fdfbfb0, (null)=false) at pybind11_json.hpp:206:29
    frame #3: 0x0000000106601240 _PyPartMC.cpython-310-darwin.so`bool pybind11::detail::argument_loader<pybind11::detail::value_and_holder&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_
string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::alloca
tor<unsigned char> > > const&>::load_impl_sequence<0ul, 1ul>(this=0x000000016fdfc0f0, call=0x000000016fdfc7b0, (null)=std::__1::index_sequence<0UL, 1UL> @ 0x000000016fdfc04e) at cast.h:1415:47
    frame #4: 0x00000001065fdc14 _PyPartMC.cpython-310-darwin.so`pybind11::detail::argument_loader<pybind11::detail::value_and_holder&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_strin
g<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<u
nsigned char> > > const&>::load_args(this=0x000000016fdfc0f0, call=0x000000016fdfc7b0) at cast.h:1393:50
    frame #5: 0x00000001065fdac4 _PyPartMC.cpython-310-darwin.so`void pybind11::cpp_function::initialize<void pybind11::detail::initimpl::constructor<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__
1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__
1::allocator<unsigned char> > > const&>::execute<pybind11::class_<AeroData, std::__1::shared_ptr<AeroData> >, 0>(pybind11::class_<AeroData, std::__1::shared_ptr<AeroData> >&)::'lambda'(pybind11::detail::value_an
d_holder&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allo
cator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > const&), void, pybind11::detail::value_and_holder&, nlohmann::basic_json<std::__1::map, std::__1::vector, s
td::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, s
td::__1::allocator<unsigned char> > > const&, pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::detail::is_new_style_constructor>(this=0x000000016fdfc7b0, call=0x000000016fdfc7b0)(pybind11::detai
l::value_and_holder&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std
::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > const&), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, pybind11::
detail::is_new_style_constructor const&)::'lambda'(pybind11::detail::function_call&)::operator()(pybind11::detail::function_call&) const at pybind11.h:228:33
    frame #6: 0x00000001065fda7c _PyPartMC.cpython-310-darwin.so`void pybind11::cpp_function::initialize<void pybind11::detail::initimpl::constructor<nlohmann::basic_json<std::__1::map, std::__1::vector, std::__
1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__
1::allocator<unsigned char> > > const&>::execute<pybind11::class_<AeroData, std::__1::shared_ptr<AeroData> >, 0>(pybind11::class_<AeroData, std::__1::shared_ptr<AeroData> >&)::'lambda'(pybind11::detail::value_an
d_holder&, nlohmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allo
cator, nlohmann::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > const&), void, pybind11::detail::value_and_holder&, nlohmann::basic_json<std::__1::map, std::__1::vector, s
td::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::adl_serializer, std::__1::vector<unsigned char, s
td::__1::allocator<unsigned char> > > const&, pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::detail::is_new_style_constructor>(call=0x000000016fdfc7b0)(pybind11::detail::value_and_holder&, nlo
hmann::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool, long long, unsigned long long, double, std::__1::allocator, nlohman
n::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > const&), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, pybind11::detail::is_new_style_cons
tructor const&)::'lambda'(pybind11::detail::function_call&)::__invoke(pybind11::detail::function_call&) at pybind11.h:224:21
    frame #7: 0x00000001065bd59c _PyPartMC.cpython-310-darwin.so`pybind11::cpp_function::dispatcher(self=0x000000010453f9f0, args_in=0x0000000104353900, kwargs_in=0x0000000000000000) at pybind11.h:929:30
    frame #8: 0x0000000100e8832c Python`cfunction_call + 60
    frame #9: 0x0000000100e20cf8 Python`_PyObject_MakeTpCall + 136
    frame #10: 0x0000000100e24dc0 Python`method_vectorcall + 636
    frame #11: 0x0000000100eb57fc Python`slot_tp_init + 480
    frame #12: 0x0000000100eac4e0 Python`type_call + 312
    frame #13: 0x0000000100d6f644 _c_internal_utils.cpython-310-darwin.so`pybind11_meta_call + 40
    frame #14: 0x0000000100e20cf8 Python`_PyObject_MakeTpCall + 136
    frame #15: 0x0000000100f57238 Python`call_function + 380
    frame #16: 0x0000000100f4f470 Python`_PyEval_EvalFrameDefault + 23772
    frame #17: 0x0000000100f47f28 Python`_PyEval_Vector + 360
    frame #18: 0x0000000100fb2c54 Python`pyrun_file + 308
    frame #19: 0x0000000100fb2398 Python`_PyRun_SimpleFileObject + 336
    frame #20: 0x0000000100fb19e4 Python`_PyRun_AnyFileObject + 216
    frame #21: 0x0000000100fdddd0 Python`pymain_run_file_obj + 180
    frame #22: 0x0000000100fdd470 Python`pymain_run_file + 72
    frame #23: 0x0000000100fdca58 Python`pymain_run_python + 300
    frame #24: 0x0000000100fdc8ec Python`Py_RunMain + 24
    frame #25: 0x0000000100fddf78 Python`pymain_main + 56
    frame #26: 0x0000000100fde23c Python`Py_BytesMain + 40
    frame #27: 0x0000000192be7154 dyld`start + 2476

@jcurtis2 jcurtis2 requested a review from Copilot August 26, 2025 18:50
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@slayoo slayoo marked this pull request as ready for review August 28, 2025 15:17
@slayoo slayoo self-requested a review August 28, 2025 15:17
@slayoo slayoo changed the title Add enabling of CAMP for chemistry CAMP-enabled object initialisation (incl. new multiphase chemistry example notebook depicting CAMP-enabled simulation) Aug 28, 2025
@slayoo slayoo added this pull request to the merge queue Aug 28, 2025
Merged via the queue into open-atmos:main with commit d9e1107 Aug 28, 2025
30 checks passed
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.

3 participants