Skip to content

Commit e6f2d38

Browse files
committed
Merge branch 'main' into gas_improvements
2 parents a6aa0d6 + 2223661 commit e6f2d38

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1811
-57
lines changed

.github/workflows/tests+artifacts+pypi.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,15 @@ jobs:
3030
needs: [todos_annotated]
3131
strategy:
3232
matrix:
33-
platform: [ubuntu-latest, macos-11, macos-12, windows-latest]
33+
platform: [ubuntu-latest, macos-12, windows-latest]
3434
python-version: ["3.7", "3.8", "3.9", "3.10"]
35+
exclude:
36+
- platform: macos-12
37+
python-version: "3.7"
38+
- platform: macos-12
39+
python-version: "3.8"
40+
- platform: macos-12
41+
python-version: "3.9"
3542
runs-on: ${{ matrix.platform }}
3643
steps:
3744
- if: startsWith(matrix.platform, 'macos-')
@@ -66,6 +73,7 @@ jobs:
6673
with:
6774
python-version: ${{ matrix.python-version }}
6875

76+
- run: python -m pip install --upgrade pip==22.1.2
6977
- run: pip install build wheel
7078
- run: pip install -r test-time-requirements.txt
7179

@@ -94,31 +102,17 @@ jobs:
94102
name: dist
95103
path: dist
96104

97-
# TODO #114: should be doable on any OS
98-
- if: matrix.platform == 'windows-latest' || matrix.platform == 'ubuntu-latest'
99-
run: |
100-
pip install dist/*.whl
105+
- run: |
106+
pip debug --verbose
107+
SYSTEM_VERSION_COMPAT=0 pip install dist/*.whl
101108
pip show --verbose PyPartMC
102109
103-
- if: startsWith(matrix.platform, 'macos-')
104-
run: |
105-
DEBUG=0 VERBOSE=1 pip install --verbose -e .
106-
107110
### make sure PyPartMC is not picked up from a local folder
108111
- run: |
109112
cd tests
110113
python -c "import PyPartMC"
111114
pytest -v -s -We -p no:unraisableexception -k 'not test_todos_annotated' .
112115
113-
# TODO #114: worth checking but perhaps in a separater workflow? (here conflicts with build dir created for manylinux by other user)
114-
# - run: DEBUG=1 VERBOSE=1 pip install --verbose -e .
115-
#
116-
# - run: pytest -v -s -We -p no:unraisableexception tests
117-
#
118-
# - run: DEBUG=0 VERBOSE=1 pip install --verbose -e .
119-
#
120-
# - run: pytest -v -s -We -p no:unraisableexception tests
121-
122116
### uncomment to gain ssh access in case of failure
123117
# - if: ${{ failure() }}
124118
# uses: mxschmitt/action-tmate@v3

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,15 @@
2626
path = gitmodules/string_view-standalone
2727
url = https://github.com/bitwizeshift/string_view-standalone.git
2828
shallow = true
29+
[submodule "gitmodules/camp"]
30+
path = gitmodules/camp
31+
url = https://github.com/zdaq12/camp
32+
shallow = true
33+
[submodule "gitmodules/SuiteSparse"]
34+
path = gitmodules/SuiteSparse
35+
url = https://github.com/DrTimothyAldenDavis/SuiteSparse
36+
shallow = true
37+
[submodule "gitmodules/json-fortran"]
38+
path = gitmodules/json-fortran
39+
url = https://github.com/jacobwilliams/json-fortran
40+
shallow = true

CMakeLists.txt

Lines changed: 176 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
1515

1616
if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
1717
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-fimplicit-none>)
18+
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-ffree-line-length-none>)
19+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58175
20+
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-Wno-surprising>)
1821
endif()
1922

2023
macro(add_prefix prefix rootlist)
@@ -25,15 +28,102 @@ macro(add_prefix prefix rootlist)
2528
set(${rootlist} ${outlist})
2629
endmacro(add_prefix)
2730

31+
add_definitions("-DSuiteSparse_long=long")
32+
add_definitions("-DSuiteSparse_long_max=LONG_MAX")
33+
add_definitions("-DSuiteSparse_long_idd=ld")
34+
add_definitions("-DSUNDIALS_INT64_T=1")
35+
2836
### sources ########################################################################################
2937

3038
set(PyPartMC_sources
3139
pypartmc.cpp gimmicks.cpp fake_netcdf.cpp fake_mpi.cpp fake_spec_file.cpp
3240
run_part.F90 run_part_opt.F90 util.F90 aero_data.F90 aero_state.F90 env_state.F90 gas_data.F90
33-
gas_state.F90 scenario.F90 condense.F90 bin_grid.F90
41+
gas_state.F90 scenario.F90 condense.F90 aero_particle.F90 bin_grid.F90
42+
camp_core.F90 photolysis.F90
3443
)
3544
add_prefix(src/ PyPartMC_sources)
3645

46+
set(camp_SOURCES
47+
Jacobian.c
48+
aero_phase_data.F90
49+
aero_phase_solver.c
50+
aero_rep_data.F90
51+
aero_rep_solver.c
52+
aero_rep_factory.F90
53+
camp_core.F90
54+
camp_solver_data.F90
55+
camp_solver.c
56+
camp_state.F90
57+
chem_spec_data.F90
58+
constants.F90
59+
debug_diff_check.F90
60+
env_state.F90
61+
mechanism_data.F90
62+
mpi.F90
63+
property.F90
64+
rand.F90
65+
rxn_data.F90
66+
rxn_factory.F90
67+
rxn_solver.c
68+
solver_stats.F90
69+
sub_model_data.F90
70+
sub_model_solver.c
71+
sub_model_factory.F90
72+
time_derivative.c
73+
util.F90
74+
aero_reps/aero_rep_modal_binned_mass.F90
75+
aero_reps/aero_rep_single_particle.F90
76+
aero_reps/aero_rep_modal_binned_mass.c
77+
aero_reps/aero_rep_single_particle.c
78+
rxns/rxn_aqueous_equilibrium.c
79+
rxns/rxn_aqueous_equilibrium.F90
80+
rxns/rxn_ternary_chemical_activation.c
81+
rxns/rxn_ternary_chemical_activation.F90
82+
rxns/rxn_arrhenius.c
83+
rxns/rxn_arrhenius.F90
84+
rxns/rxn_CMAQ_H2O2.c
85+
rxns/rxn_CMAQ_H2O2.F90
86+
rxns/rxn_CMAQ_OH_HNO3.c
87+
rxns/rxn_CMAQ_OH_HNO3.F90
88+
rxns/rxn_condensed_phase_arrhenius.c
89+
rxns/rxn_condensed_phase_arrhenius.F90
90+
rxns/rxn_emission.c
91+
rxns/rxn_emission.F90
92+
rxns/rxn_first_order_loss.c
93+
rxns/rxn_first_order_loss.F90
94+
rxns/rxn_HL_phase_transfer.c
95+
rxns/rxn_HL_phase_transfer.F90
96+
rxns/rxn_photolysis.c
97+
rxns/rxn_photolysis.F90
98+
rxns/rxn_SIMPOL_phase_transfer.c
99+
rxns/rxn_SIMPOL_phase_transfer.F90
100+
rxns/rxn_troe.c
101+
rxns/rxn_troe.F90
102+
rxns/rxn_wennberg_no_ro2.c
103+
rxns/rxn_wennberg_no_ro2.F90
104+
rxns/rxn_wennberg_tunneling.c
105+
rxns/rxn_wennberg_tunneling.F90
106+
rxns/rxn_wet_deposition.c
107+
rxns/rxn_wet_deposition.F90
108+
sub_models/sub_model_PDFiTE.c
109+
sub_models/sub_model_PDFiTE.F90
110+
sub_models/sub_model_UNIFAC.c
111+
sub_models/sub_model_UNIFAC.F90
112+
sub_models/sub_model_ZSR_aerosol_water.F90
113+
sub_models/sub_model_ZSR_aerosol_water.c
114+
)
115+
add_prefix(gitmodules/camp/src/ camp_SOURCES)
116+
117+
set(json_fortran_SOURCES
118+
json_kinds.F90
119+
json_parameters.F90
120+
json_string_utilities.F90
121+
json_value_module.F90
122+
json_file_module.F90
123+
json_module.F90
124+
)
125+
add_prefix(gitmodules/json-fortran/src/ json_fortran_SOURCES)
126+
37127
set(partmclib_SOURCES condense_solver.c aero_state.F90 integer_varray.F90 integer_rmap.F90
38128
integer_rmap2.F90 aero_sorted.F90 aero_binned.F90 bin_grid.F90 constants.F90 scenario.F90
39129
env_state.F90 aero_mode.F90 aero_dist.F90 aero_weight.F90 aero_weight_array.F90
@@ -48,6 +138,60 @@ set(partmclib_SOURCES condense_solver.c aero_state.F90 integer_varray.F90 intege
48138
add_prefix(gitmodules/partmc/src/ partmclib_SOURCES)
49139
list(APPEND partmclib_SOURCES src/fake_mpi.F90 src/fake_netcdf.F90 src/fake_spec_file.F90)
50140

141+
set(klu_SOURCES
142+
KLU/Source/klu_analyze.c
143+
KLU/Source/klu_memory.c
144+
KLU/Source/klu_tsolve.c
145+
KLU/Source/klu_solve.c
146+
KLU/Source/klu.c
147+
KLU/Source/klu_kernel.c
148+
KLU/Source/klu_defaults.c
149+
KLU/Source/klu_dump.c
150+
KLU/Source/klu_factor.c
151+
KLU/Source/klu_free_numeric.c
152+
KLU/Source/klu_free_symbolic.c
153+
KLU/Source/klu_scale.c
154+
KLU/Source/klu_refactor.c
155+
KLU/Source/klu_diagnostics.c
156+
KLU/Source/klu_sort.c
157+
KLU/Source/klu_extract.c
158+
KLU/Source/klu_analyze_given.c
159+
COLAMD/Source/colamd.c
160+
SuiteSparse_config/SuiteSparse_config.c
161+
AMD/Source/amd_aat.c
162+
AMD/Source/amd_1.c
163+
AMD/Source/amd_2.c
164+
AMD/Source/amd_dump.c
165+
AMD/Source/amd_postorder.c
166+
AMD/Source/amd_defaults.c
167+
AMD/Source/amd_post_tree.c
168+
AMD/Source/amd_order.c
169+
AMD/Source/amd_control.c
170+
AMD/Source/amd_info.c
171+
AMD/Source/amd_valid.c
172+
AMD/Source/amd_preprocess.c
173+
BTF/Source/btf_order.c
174+
BTF/Source/btf_maxtrans.c
175+
BTF/Source/btf_strongcomp.c
176+
)
177+
add_prefix(gitmodules/SuiteSparse/ klu_SOURCES)
178+
179+
set(KLU_INCLUDE_DIRS
180+
${CMAKE_SOURCE_DIR}/gitmodules/SuiteSparse/KLU/Include
181+
${CMAKE_SOURCE_DIR}/gitmodules/SuiteSparse/AMD/Include
182+
${CMAKE_SOURCE_DIR}/gitmodules/SuiteSparse/SuiteSparse_config
183+
${CMAKE_SOURCE_DIR}/gitmodules/SuiteSparse/COLAMD/Include
184+
${CMAKE_SOURCE_DIR}/gitmodules/SuiteSparse/BTF/Include
185+
)
186+
187+
### KLU ############################################################################################
188+
189+
add_library(klulib STATIC
190+
${klu_SOURCES}
191+
)
192+
target_compile_definitions(klulib PRIVATE DLONG="1")
193+
target_include_directories(klulib PRIVATE ${KLU_INCLUDE_DIRS})
194+
51195
### SUNDIALS #######################################################################################
52196

53197
set(SUNDIALS_SOURCE_DIR "${CMAKE_SOURCE_DIR}/gitmodules/sundials")
@@ -67,9 +211,12 @@ macro(sundials_add_library target)
67211
)
68212
add_library(${target} STATIC ${sundials_add_library_SOURCES})
69213
target_compile_definitions(${target} PRIVATE SUNDIALS_STATIC_DEFINE)
70-
target_include_directories(${target} PRIVATE ${SUNDIALS_SOURCE_DIR}/src/sundials)
71-
target_include_directories(${target} PRIVATE ${SUNDIALS_SOURCE_DIR}/include)
72-
target_include_directories(${target} PRIVATE ${CMAKE_BINARY_DIR}/include)
214+
target_include_directories(${target} PRIVATE
215+
${SUNDIALS_SOURCE_DIR}/src/sundials
216+
${SUNDIALS_SOURCE_DIR}/include
217+
${KLU_INCLUDE_DIRS}
218+
${CMAKE_BINARY_DIR}/include
219+
)
73220
endmacro()
74221

75222
function(print_error)
@@ -91,30 +238,49 @@ scoped_sundials_setup_config()
91238
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SUNDIALS_SOURCE_DIR}/cmake)
92239
include(${SUNDIALS_SOURCE_DIR}/cmake/SundialsSetupCompilers.cmake)
93240

94-
foreach(item cvode;sunmatrix;sunlinsol;sunnonlinsol;nvector;sundials)
95-
add_subdirectory(${SUNDIALS_SOURCE_DIR}/src/${item})
241+
foreach(item cvode;sunmatrix;sunlinsol;sunnonlinsol;nvector;sundials;sunlinsol/klu)
242+
add_subdirectory(${SUNDIALS_SOURCE_DIR}/src/${item})
96243
endforeach()
97244

98245
set(SUNDIALS_items
99-
cvode nvecserial
246+
cvode
247+
nvecserial
100248
sunmatrixband
101249
sunmatrixdense
250+
sunmatrixsparse
102251
sunlinsolband
252+
sunlinsolklu
103253
sunnonlinsolnewton
104254
sunlinsolspgmr
105255
generic
106256
)
107257
add_prefix(sundials_ SUNDIALS_items)
108258

259+
### CAMP ###########################################################################################
260+
261+
add_library(camplib STATIC ${camp_SOURCES} ${json_fortran_SOURCES})
262+
target_compile_definitions(camplib PRIVATE CAMP_USE_JSON="1")
263+
target_compile_definitions(camplib PRIVATE CAMP_USE_SUNDIALS="1")
264+
target_include_directories(camplib PRIVATE
265+
${KLU_INCLUDE_DIRS}
266+
${SUNDIALS_SOURCE_DIR}/include
267+
${CMAKE_BINARY_DIR}/include
268+
)
269+
109270
### partmclib ######################################################################################
110271

111272
add_library(partmclib STATIC ${partmclib_SOURCES})
112273
target_compile_definitions(partmclib PRIVATE PMC_USE_SUNDIALS="1")
113274
target_compile_definitions(partmclib PRIVATE PMC_USE_MPI="1")
275+
target_compile_definitions(partmclib PRIVATE PMC_USE_CAMP="1")
114276
add_dependencies(partmclib ${SUNDIALS_items})
115-
target_include_directories(partmclib PRIVATE ${SUNDIALS_SOURCE_DIR}/include)
116-
target_include_directories(partmclib PRIVATE ${CMAKE_BINARY_DIR}/include)
277+
target_include_directories(partmclib PRIVATE
278+
${SUNDIALS_SOURCE_DIR}/include
279+
${CMAKE_BINARY_DIR}/include
280+
)
281+
target_link_libraries(partmclib PRIVATE camplib)
117282
target_link_libraries(partmclib PRIVATE ${SUNDIALS_items})
283+
target_link_libraries(partmclib PRIVATE klulib)
118284

119285
### PYBIND11 & PyPartMC ############################################################################
120286

@@ -142,7 +308,7 @@ foreach(target _PyPartMC)
142308
target_compile_options(${target} PRIVATE
143309
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
144310
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror>
145-
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-unused-parameter>
311+
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-unused-parameter>
146312
)
147313
endforeach()
148314

MANIFEST.in

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
graft gitmodules/partmc/src
2+
graft gitmodules/camp/src
3+
graft gitmodules/json-fortran/src
4+
graft gitmodules/SuiteSparse/KLU/Source
5+
graft gitmodules/SuiteSparse/KLU/Include
6+
graft gitmodules/SuiteSparse/COLAMD/Source
7+
graft gitmodules/SuiteSparse/COLAMD/Include
8+
graft gitmodules/SuiteSparse/AMD/Source
9+
graft gitmodules/SuiteSparse/AMD/Include
10+
graft gitmodules/SuiteSparse/BTF/Source
11+
graft gitmodules/SuiteSparse/BTF/Include
212
graft gitmodules/sundials/src/sunnonlinsol/newton
313
graft gitmodules/sundials/src/sunnonlinsol/fixedpoint
414
graft gitmodules/sundials/src/nvector/serial
515
graft gitmodules/sundials/src/sunlinsol/band
616
graft gitmodules/sundials/src/sunlinsol/dense
17+
graft gitmodules/sundials/src/sunlinsol/klu
718
graft gitmodules/sundials/src/cvode
819
graft gitmodules/sundials/src/sundials
920
graft gitmodules/sundials/include/cvode
@@ -12,6 +23,8 @@ graft gitmodules/sundials/include/sunnonlinsol
1223
graft gitmodules/sundials/include/sunmatrix
1324
graft gitmodules/sundials/include/sunlinsol
1425
graft gitmodules/sundials/include/nvector
26+
include gitmodules/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c
27+
include gitmodules/SuiteSparse/SuiteSparse_config/SuiteSparse_config.h
1528
include gitmodules/sundials/cmake/SundialsSetupConfig.cmake
1629
include gitmodules/sundials/cmake/SundialsSetupCompilers.cmake
1730
include gitmodules/sundials/cmake/SundialsIndexSize.cmake
@@ -20,8 +33,6 @@ include gitmodules/sundials/src/sunmatrix/band/CMakeLists.txt
2033
include gitmodules/sundials/src/sunmatrix/dense/CMakeLists.txt
2134
include gitmodules/sundials/src/sunmatrix/sparse/CMakeLists.txt
2235
include gitmodules/sundials/src/sunlinsol/CMakeLists.txt
23-
include gitmodules/sundials/src/sunlinsol/band/CMakeLists.txt
24-
include gitmodules/sundials/src/sunlinsol/dense/CMakeLists.txt
2536
include gitmodules/sundials/src/sunlinsol/pcg/CMakeLists.txt
2637
include gitmodules/sundials/src/sunlinsol/spbcgs/CMakeLists.txt
2738
include gitmodules/sundials/src/sunlinsol/spfgmr/CMakeLists.txt

PyPartMC/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ def __build_extension_env():
2424

2525
# TODO #113: 2 x loop over prefixes and units
2626
si = namedtuple("SI", (
27-
"m", "cm", "um",
27+
"m", "cm", "um", "nm",
2828
"kg", "g",
2929
"s",
3030
"K",
3131
"Pa", "hPa",
3232
"mol"
3333
))(
34-
m=1., cm=.01, um=1e-6,
34+
m=1., cm=.01, um=1e-6, nm=1e-9,
3535
kg=1., g=1e-3,
3636
s=1.,
3737
K=1.,

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ gdb python
109109

110110
#### PyPartMC:
111111

112-
author: [Sylwester Arabas et al.](https://github.com/open-atmos/PyPartMC/graphs/contributors)
112+
author: [PyPartMC developers](https://github.com/open-atmos/PyPartMC/graphs/contributors)
113113
funding: [US Department of Energy Atmospheric System Research programme](https://asr.science.energy.gov/)
114114
copyright: [University of Illinois at Urbana-Champaign](https://atmos.illinois.edu/)
115115
licence: [GPL v3](https://www.gnu.org/licenses/gpl-3.0.en.html)

gitmodules/SuiteSparse

Submodule SuiteSparse added at 05b25d3

gitmodules/camp

Submodule camp added at b067e10

0 commit comments

Comments
 (0)