Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New functionality #34

Merged
merged 165 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
c395c3e
Added QuantumMie (FH-Mie) model.
vegardjervell Oct 13, 2023
3b9cc91
Implemented proper handling of effective parameters for QuantumMie, i…
vegardjervell Oct 20, 2023
15cb5a6
Implemented non-additive BH-diameter override
vegardjervell Oct 20, 2023
e12912b
Initial commit for Sutherland model.
vegardjervell Oct 25, 2023
e6ba5f0
Implemented Van der Waals alpha for QuantumMie.
vegardjervell Nov 3, 2023
7ae1263
Added Zarate definition of Soret coefficient.
vegardjervell Nov 15, 2023
4108d38
Ensuring that zarate formulation for diffusion also works for binaries.
vegardjervell Nov 20, 2023
3d5ee03
Changed conductivity_matrix T-Psi formulation from (T, c) to (T, p)
vegardjervell Nov 20, 2023
2e996cc
Ensuring that dependent_idx defaults to last component when None is s…
vegardjervell Nov 20, 2023
2406f57
Implemented contribution to thermal conductivity from internal degree…
vegardjervell Dec 8, 2023
ef12146
Merge branch 'main' into cond_cp
vegardjervell Dec 8, 2023
af29cd3
Merge branch 'zarate_soret' into Tpsi
vegardjervell Dec 9, 2023
8bc7969
Merge branch 'main' into Tpsi
vegardjervell Dec 9, 2023
3126bd9
Merge branch 'Tpsi' into cond_cp
vegardjervell Dec 9, 2023
054e4ed
Methods to generate effective Mie potential for QuantumMie.
vegardjervell Feb 12, 2024
c3fd78d
Cleaning up const qualifiers
vegardjervell Feb 15, 2024
fac3435
Initial implementation of g0 and g1. Still untested.
vegardjervell Feb 15, 2024
b073d01
Merge branch 'main' into clean_const
vegardjervell Feb 15, 2024
b5b48df
Merge branch 'clean_const' into sutherland
vegardjervell Feb 15, 2024
481e205
Merge branch 'main' into sutherland
vegardjervell Feb 15, 2024
5a1cc38
Sutherland rdf_g0 and rdf_g1 terms tested to reproduce MieKinGas value.
vegardjervell Feb 15, 2024
d3b3fa3
Implemented and tested full rdf at contact for Sutherland, now reprod…
vegardjervell Feb 19, 2024
e3c0c82
Implemented a couple convenience functions for testing.
vegardjervell Feb 19, 2024
0ca8579
Cleaned up tests for radial distribution function.
vegardjervell Feb 20, 2024
2af1a7e
Renamed get_contact_diameters -> get_collision_diameters
vegardjervell Feb 20, 2024
83607fe
Moved computation of collision diameter to Spherical class. Inheritin…
vegardjervell Feb 20, 2024
a2db6e5
Cleaned up headers and encapsulation.
vegardjervell Feb 20, 2024
6ec67cc
Merge branch 'sutherland' into fh_mie
vegardjervell Feb 20, 2024
ba7ca2f
Reformatted fluid files to work better with QuantumMie. Wrote and tes…
vegardjervell Feb 22, 2024
f7c312d
Sutherland model appears to work for QuantumMie now. Tested that Quan…
vegardjervell Feb 27, 2024
299feb3
Prevent the use of Fokin-Correlations for non-physical collision inte…
vegardjervell Feb 28, 2024
6b46b89
More conservative encapsulation in KineticGas and Spherical.
vegardjervell Feb 28, 2024
b98e6e5
QuantumMie now passes test suite.
vegardjervell Feb 28, 2024
44bbe81
Setting Cmake policy.
vegardjervell Feb 28, 2024
0278521
Re-adding all models to test list.
vegardjervell Feb 28, 2024
df42979
Removed lagging print statements.
vegardjervell Feb 29, 2024
dd68e98
Correcting type hint for fh_order.
vegardjervell Mar 3, 2024
4fb832c
Merge branch 'cond_cp' into fh_mie
vegardjervell Mar 3, 2024
ee8f51d
Fixed bug in RDF.
vegardjervell Apr 11, 2024
255a27f
Ported RDF patch to Sutherland.
vegardjervell Apr 11, 2024
03cce4d
Merge branch 'main' into fh_mie
vegardjervell Apr 16, 2024
2b52c55
Cleanup after merge.
vegardjervell Apr 16, 2024
db77e03
Maybe fixed RDF at contact for Sutherland.
vegardjervell Apr 17, 2024
26ba0ac
Remove confusing, unneccessary and bug-prone argument from rdf_chi_fu…
vegardjervell Apr 17, 2024
56d878d
Cleaning up.
vegardjervell Apr 18, 2024
1d47e57
Using eps_eff for g2 correction.
vegardjervell Apr 22, 2024
a188ab5
Implemented Modified Tang-Toennis potential for Argon.
vegardjervell Apr 25, 2024
0a2043e
Bindings for Ab Initio argon potential.
vegardjervell Apr 25, 2024
d317529
Finished and tested Modified Tang-Toennis potential for Argon.
vegardjervell Apr 25, 2024
ac770c1
Collision diameter tested, checked dimensionless relative distributio…
vegardjervell Apr 29, 2024
2c34747
Preventing inf in Sutherland potential. (Divide before power)
vegardjervell May 8, 2024
426a9dc
Testing new collision diameters.
vegardjervell May 8, 2024
454b6e9
Speeding up integration by not overkilling on integral resolution.
vegardjervell May 10, 2024
1f1fc12
No unnessecary override of collision diameter. Expose set_cd_model bi…
vegardjervell May 10, 2024
2be9156
Clean out some prints, prevent unnessecary computation of collision d…
vegardjervell May 10, 2024
147dcfe
Improved robustness of Sutherland constructor, and added compatibilit…
vegardjervell May 15, 2024
890f220
Updating tests, and ensuring everything passes.
vegardjervell May 15, 2024
5df2f4d
Add dummy methods for idealenthalpysingle to IdealGas and HardSphereE…
vegardjervell May 16, 2024
a7d2b48
Implemented new collision diameter for multicomponent systems
vegardjervell May 16, 2024
43b6353
Bump version to 2b1.dev1, and build new wheels.
vegardjervell May 16, 2024
6cbef98
Added new parametrisation of eta_eff for RDF from Tage.
vegardjervell May 23, 2024
5ce2718
Clean up docstrings.
vegardjervell May 23, 2024
16eb21a
Implemented two new collision diameter models: Energy transfer length…
vegardjervell Jun 3, 2024
be5e7a4
Implemented all considered transfer length models
vegardjervell Jun 13, 2024
034ef36
Cleaned up transfer length code structure
vegardjervell Jun 14, 2024
9bf65d0
Consistent syntax for std::vector.
vegardjervell Jun 18, 2024
fe8d094
Started implementing pure cpp.
vegardjervell Jun 18, 2024
b18e650
Implemented init without python, including init of thermopack eos. Te…
vegardjervell Jun 20, 2024
34c34fd
Implemented C++ side thermal conductivity, and fluid file path
vegardjervell Jun 21, 2024
50c5936
Merge branch 'main' into pure_cpp
vegardjervell Jul 28, 2024
dbcdfb6
Add external c++ dependencies as submodules.
vegardjervell Jul 28, 2024
bbead6f
Integrate pure-cpp build with new build system, and update paths to u…
vegardjervell Jul 28, 2024
e2e1b70
Delete thermopack symlink.
vegardjervell Jul 28, 2024
1eacd1e
Add thermopack as submodule.
vegardjervell Jul 28, 2024
eaea12a
Implement C++ side diffusion coefficient calculations.
vegardjervell Jul 28, 2024
b37c173
Implemented thermal diffusion.
vegardjervell Jul 28, 2024
82c5ee5
Implement generic EoS interface instead of relying on a pointer to Th…
vegardjervell Jul 29, 2024
a30a0fe
Running tests on all pushes.
vegardjervell Jul 29, 2024
301e3bd
Only including eos_interface.h when compiling with -DNOPYTHON.
vegardjervell Jul 29, 2024
f1c70ac
Ensure fluid dir is copied to pykingas.
vegardjervell Jul 29, 2024
0724aa1
Ensuring fluid files are included in pykingas.
vegardjervell Jul 29, 2024
9bcf27e
Remove redundant copying of fluids.
vegardjervell Jul 29, 2024
15fe372
Merge branch 'pure_cpp' into autodiff
vegardjervell Aug 2, 2024
e73e20d
Consolidate KineticGas_properties to use transfer lengths.
vegardjervell Aug 2, 2024
5aa25fd
Use autodiff instead of numerical derivatives in ModTangToennis.
vegardjervell Aug 2, 2024
5c32d6e
Implement potential with autodiff as default, keep existing analytic …
vegardjervell Aug 2, 2024
fc62950
Fix bindings to work with autodiff.
vegardjervell Aug 2, 2024
1495cbb
Implement Extended Sutherland C++ side and output tests for sutherlan…
vegardjervell Aug 7, 2024
75cbcff
Handle setting of internal model state (density and temperature depen…
vegardjervell Aug 8, 2024
906e78d
First attempt at MTL correlation.
vegardjervell Aug 14, 2024
7df2069
Currently best correlations for MTL and ETL.
vegardjervell Aug 15, 2024
3c6a096
Adding comments on transfer lengths.
vegardjervell Aug 28, 2024
85f43c1
Implement PyWrapper for python-side implementation of eos objects.
vegardjervell Aug 28, 2024
c5b8a81
Change ifdef guards for python-specific code sections to specify when…
vegardjervell Aug 28, 2024
a2abc1d
Modify ideal-gas case to use the ThermoPack ideal class, and modify i…
vegardjervell Aug 28, 2024
6d0538a
More status output from cmake config file.
vegardjervell Aug 28, 2024
2da3187
Implement Axilrod-Teller corrected Tang-Toennies potential. Add neces…
vegardjervell Sep 4, 2024
538914c
Merge commit '6d0538a6f88e9fd38988fab0e17f208acd9bc08a' into axilrod_…
vegardjervell Sep 4, 2024
fb03f61
Finished first implementation of Axilrod-Teller correction for Tang-T…
vegardjervell Sep 4, 2024
b392b3a
Ensuring that multithreading methods respect density dependent potent…
vegardjervell Sep 5, 2024
c2ede34
Implement methods to get effective params and vdw_alpha for AT-correc…
vegardjervell Sep 5, 2024
18fcc29
Implement weighted_simpson to speed up transfer length calculation
vegardjervell Sep 6, 2024
4850baa
Implement ModTangToennies potential that doesn't go via double.
vegardjervell Sep 6, 2024
fafd49c
More readable status output.
vegardjervell Sep 6, 2024
930db5c
Only compute transfer lengths if necessary.
vegardjervell Sep 6, 2024
f2ec30e
Speed up transfer length calculations
vegardjervell Sep 6, 2024
1316342
Update docpages
vegardjervell Oct 9, 2024
067d4a1
Improve feedback for missing thermopack installation.
vegardjervell Oct 11, 2024
33d5e86
Clean up, fix linux RPATH, and update workflow.
vegardjervell Oct 11, 2024
a5f469a
Fix test workflow.
vegardjervell Oct 11, 2024
c1b9c06
Defaulting to submodule if thermopack_dir is not set.
vegardjervell Oct 11, 2024
6332646
Defaulting to submodule if thermopack_dir is not set.
vegardjervell Oct 11, 2024
ebb27e4
Update submodules.
vegardjervell Oct 11, 2024
b17b6d2
Better handling of EoS pointer. Workaround for thermopack cmake build…
vegardjervell Oct 11, 2024
9ec327c
Fix build path.
vegardjervell Oct 11, 2024
363b37c
Ensuring set_eos is properly wrapped by pybind.
vegardjervell Oct 11, 2024
b9e7c68
Lower thermopack version requirement.
vegardjervell Oct 11, 2024
ae90bb9
Actually install pytest ...
vegardjervell Oct 11, 2024
e30b704
Add pytest optional dependency.
vegardjervell Oct 14, 2024
09f537b
Handle platform specific search paths for fluid directory.
vegardjervell Oct 15, 2024
ad0b7f7
Update submodules and fix search path for thermopack if installation …
vegardjervell Oct 16, 2024
953b375
Update docs and clean up links.
vegardjervell Oct 16, 2024
82260f2
Fix typo in include path.
vegardjervell Oct 16, 2024
aba49a8
Try downloading thermopack from latest release in actions.
vegardjervell Oct 17, 2024
0cf92ba
Follow links when downloading thermopack.
vegardjervell Oct 17, 2024
4959283
Correct environment variable for thermopack_dir.
vegardjervell Oct 17, 2024
11e49dc
Also download latest thermopack wheel.
vegardjervell Oct 17, 2024
94fd5e6
Try setting rpath to link path also on macOS.
vegardjervell Oct 17, 2024
12c4e8b
Add matplotlib test dependency.
vegardjervell Oct 17, 2024
d889d63
Install with test dependencies.
vegardjervell Oct 17, 2024
f25f72c
Fix duplicate definition of thermal_conductivity_tp and test.
vegardjervell Oct 17, 2024
408949c
Format and clear compiler warnings.
vegardjervell Oct 17, 2024
b51fc9c
Add testing of windows to workflow.
vegardjervell Oct 17, 2024
d2641fb
Implement kinematic viscosity and thermal diffusivity.
vegardjervell Oct 21, 2024
5d457c1
Merge commit 'f2ec30edbd8c1a3f24a0fbd8e8f1d978575987df' into merge_sp…
vegardjervell Oct 21, 2024
1128938
Moved transfer length utility functions to KineticGas, and exposed me…
vegardjervell Oct 22, 2024
e67aaf7
Indicating which model is the default.
vegardjervell Oct 22, 2024
52d05dd
Dont output (default) twice in model identifier.
vegardjervell Oct 24, 2024
b807931
Cleaning up comments and removing obsolete code.
vegardjervell Oct 30, 2024
41857ea
Add Units struct to C++ side.
vegardjervell Oct 30, 2024
5308151
Remove redundant python-side computations. All work is being done on …
vegardjervell Nov 4, 2024
17770d0
Fix bugs in initialisation sequence, and in C++ side interdiffusion
vegardjervell Nov 4, 2024
e1f02fd
Expose some of the utility methods in Spherical.
vegardjervell Nov 6, 2024
1a757f8
Actually initialize zarate_x matrix before adding stuff to it.
vegardjervell Nov 6, 2024
ac23a09
Correctly recurse through Fokin correlation for collision integrals. …
vegardjervell Nov 6, 2024
f22f370
Fix construction of Units structure on C++ side.
vegardjervell Nov 6, 2024
319a1a6
Fix C++ side computation of internal contribution to thermal conducti…
vegardjervell Nov 7, 2024
9ef9ee1
Fix include order.
vegardjervell Nov 7, 2024
f7cd66e
Added test grid to detect if output changes, will be expanded to incl…
vegardjervell Nov 7, 2024
5f01c0c
Ensure pandas test dependency is installed when testing.
vegardjervell Nov 7, 2024
49ca75b
Install thermopack wheel in windows workflow.
vegardjervell Nov 8, 2024
b01f90d
Properly set environment variable in Windows.
vegardjervell Nov 8, 2024
18c8e09
Fix windows workflow.
vegardjervell Nov 8, 2024
453494a
Windows nests stuff when unzipping ...
vegardjervell Nov 8, 2024
0c4258a
Widows env variables ...
vegardjervell Nov 8, 2024
0cf973d
Fix windows fluid dir path.
vegardjervell Nov 8, 2024
a519e17
Fluid path on windows ...
vegardjervell Nov 8, 2024
4a6565b
Windows fluid file path ...
vegardjervell Nov 8, 2024
d8a2239
Get thermopack files in cibuildwheel workflow.
vegardjervell Nov 8, 2024
b4fbc54
Pass environment variables to cibw.
vegardjervell Nov 8, 2024
56a3b15
Powershell syntax ...
vegardjervell Nov 8, 2024
11d85ec
Powershell syntax ...
vegardjervell Nov 8, 2024
343357b
Windows stuff
vegardjervell Nov 8, 2024
4e75cfd
Windows stuff
vegardjervell Nov 8, 2024
d088835
Windows stuff
vegardjervell Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
44 changes: 33 additions & 11 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ jobs:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest]

os: [windows-latest, macOS-latest, ubuntu-latest]
env:
THERMOPACK_DIR: thermopack-${{ matrix.os }}
THERMOPACK_DIR_WINDOWS: "D:/a/KineticGas/KineticGas/thermopack-windows-latest/thermopack-windows-latest"
THERMOPACK_URL: https://github.com/vegardjervell/thermopack/releases/download/Latest-beta
steps:
- uses: actions/checkout@v4
- name: checkout submodules
Expand All @@ -18,20 +22,38 @@ jobs:
# Used to host cibuildwheel
- uses: actions/setup-python@v4

- name: Install cibuildwheel and other dependencies
run: python -m pip install cibuildwheel==2.17.0 build wheel setuptools
- name: Fetch Thermopack
if: matrix.os != 'windows-latest'
run: |
curl -L -o thermopack.zip ${{ env.THERMOPACK_URL }}/thermopack-${{ matrix.os }}.zip
unzip thermopack.zip
export THERMOPACK_DIR=${PWD}/${{ env.THERMOPACK_DIR }}/
curl -L -o thermopack_whl.zip ${{ env.THERMOPACK_URL }}/wheel-v2-${{ matrix.os }}.zip
unzip thermopack_whl.zip
pip install wheel-v2-${{ matrix.os }}/*

- name: Build sdist
run: pipx run build --sdist --outdir wheelhouse
if: runner.os == 'Windows'
- name: Fetch Thermopack (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest -Uri "${{ env.THERMOPACK_URL }}/thermopack-${{ matrix.os }}.zip" -OutFile "thermopack.zip"
Expand-Archive -Path "thermopack.zip" -DestinationPath "${{ env.THERMOPACK_DIR }}"
$THERMOPACK_DIR = "${PWD}/${{ env.THERMOPACK_DIR }}/${{ env.THERMOPACK_DIR }}"
[System.Environment]::SetEnvironmentVariable("THERMOPACK_DIR", $THERMOPACK_DIR)
"$THERMOPACK_DIR=$THERMOPACK_DIR" | Out-File -FilePath $env:GITHUB_ENV -Append
Invoke-WebRequest -Uri "${{ env.THERMOPACK_URL }}/wheel-v2-${{ matrix.os }}.zip" -OutFile "thermopack_whl.zip"
Expand-Archive -Path "thermopack_whl.zip" -DestinationPath "wheel-v2-${{ matrix.os }}"
cd wheel-v2-${{ matrix.os }}
pip install (Get-ChildItem wheel-v2-windows-latest\*.whl).FullName

- name: Build wheels
uses: pypa/[email protected] # run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS: auto64
CIBW_ARCHS_MACOS: "universal2"
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0
CIBW_ENVIRONMENT_LINUX: CXXFLAGS='-fconcepts'
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=11.0 THERMOPACK_DIR=${PWD}/${{ env.THERMOPACK_DIR }}
CIBW_ENVIRONMENT_LINUX: CXXFLAGS='-fconcepts' THERMOPACK_DIR=${PWD}/${{ env.THERMOPACK_DIR }}
CIBW_ENVIRONMENT_WINDOWS: THERMOPACK_DIR=${{ env.THERMOPACK_DIR_WINDOWS}}
CIBW_BUILD_VERBOSITY_WINDOWS: 2
CIBW_SKIP: "*pypy* *pp* *cp36* *cp37* *musl*"
with:
Expand All @@ -56,7 +78,7 @@ jobs:
pattern: wheels-*

release_wheels: # Create or update the release tagged Latest-beta, and upload wheels to that release.
if: ${{ github.event.pull_request.merged }}
# if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: build_wheels
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -91,7 +113,7 @@ jobs:
tag: Latest-beta
commit: main
makeLatest: true
bodyFile: "release_bodyFile.md"
bodyFile: ".github/release_bodyFile.md"
artifacts: "wheels-*.zip"


85 changes: 85 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Run Tests
on: push

jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, macOS-12, ubuntu-latest, windows-latest]
env:
THERMOPACK_DIR: thermopack-${{ matrix.os }}
THERMOPACK_URL: https://github.com/vegardjervell/thermopack/releases/download/Latest-beta
steps:
- uses: actions/checkout@v4
- name: checkout submodules
run: git submodule update --init --recursive

# Used to host cibuildwheel
- uses: actions/setup-python@v4

- name: Install thermopack
if: matrix.os != 'windows-latest'
run: |
curl -L -o thermopack.zip ${{ env.THERMOPACK_URL }}/thermopack-${{ matrix.os }}.zip
unzip thermopack.zip
export THERMOPACK_DIR=${PWD}/thermopack-${{ matrix.os }}/
curl -L -o thermopack_whl.zip ${{ env.THERMOPACK_URL }}/wheel-v2-${{ matrix.os }}.zip
unzip thermopack_whl.zip
pip install wheel-v2-${{ matrix.os }}/*

- name: Build KineticGas
if: matrix.os != 'windows-latest'
run: |
echo "THERMOPACK_DIR (GH_ENV) : ${{ env.THERMOPACK_DIR }} / (ENV) ${THERMOPACK_DIR}"
export THERMOPACK_DIR=${PWD}/${{ env.THERMOPACK_DIR }}
ls -R ${THERMOPACK_DIR}
mkdir build
cd build
cmake ..
make -j4 install

- name: Install thermopack Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest -Uri "${{ env.THERMOPACK_URL }}/wheel-v2-${{ matrix.os }}.zip" -OutFile "thermopack_whl.zip"
Expand-Archive -Path "thermopack_whl.zip" -DestinationPath "wheel-v2-${{ matrix.os }}"
cd wheel-v2-${{ matrix.os }}
pip install (Get-ChildItem wheel-v2-windows-latest\*.whl).FullName

- name: Build KineticGas Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest -Uri "${{ env.THERMOPACK_URL }}/thermopack-${{ matrix.os }}.zip" -OutFile "thermopack.zip"
Expand-Archive -Path "thermopack.zip" -DestinationPath "${{ env.THERMOPACK_DIR }}"
$THERMOPACK_DIR = "$PWD\${{ env.THERMOPACK_DIR }}\thermopack-${{ matrix.os }}"
[System.Environment]::SetEnvironmentVariable("THERMOPACK_DIR", $THERMOPACK_DIR)
ls -R ${THERMOPACK_DIR}
mkdir build
cd build
cmake ..
cmake --build . --config=Release --target install

- name: Build KineticGas Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
pip install .
$THERMOPACK_DIR = "$PWD/${{ env.THERMOPACK_DIR }}"
mkdir build
cd build
cmake ..
cmake --build . --config=Release --target install

- name: Inspect libpykingas
if: matrix.os != 'ubuntu-latest' && matrix.os != 'windows-latest'
run: otool -L pykingas/libpykingas.*

- name: Run pytests
run: |
pip install .[test]
pytest tests/
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ venv/
venv*/
pypi_release/wheelhouse/*.whl
*__pycache__/
pypi_release/dist/

build/
pykingas/fluids/
pykingas.egg-info/
venv*
rebuild.sh
Expand All @@ -19,4 +21,5 @@ rebuild.sh
*.mplstyle
sandbox/*
sandbox/archive/*
*.so
*.so
*.dylib
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
[submodule "cpp/external/pybind11"]
path = cpp/external/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "cpp/external/json"]
path = cpp/external/json
url = https://github.com/nlohmann/json.git
[submodule "cpp/external/eigen"]
path = cpp/external/eigen
url = https://gitlab.com/libeigen/eigen.git
[submodule "cpp/external/autodiff"]
path = cpp/external/autodiff
url = https://github.com/autodiff/autodiff.git
[submodule "cpp/external/thermopack"]
path = cpp/external/thermopack
url = https://github.com/thermotools/thermopack.git
103 changes: 94 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,110 @@ cmake_minimum_required(VERSION 3.16)
cmake_policy(VERSION 3.12)
project(KineticGas LANGUAGES C CXX)

string(ASCII 27 Esc)
set(ColorDefault "${Esc}[0m")
set(ColorBlue "${Esc}[34m")
set(ColorYellow "${Esc}[93m")
set(ColorRed "${Esc}[31m")
set(ColorDefault "${Esc}[0m")

option(build "Recompile KineticGas?" ON) # If set to off, assumes that KineticGas is installed and does nothing. Useful in combination with pip
if(NOT build)
message(STATUS "Assuming KineticGas is already built and installed. Exiting ...")
message(STATUS "${ColorBlue}To disable this behaviour, clear the CMakeCache and re-run cmake.${ColorDefault}")
return()
endif()

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type specified, defaulting to Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
endif()

SET(CMAKE_CXX_STANDARD 17)

# Find the module development requirements (requires FindPython from 3.17 or scikit-build-core's built-in backport)
set(Python_FIND_VIRTUALENV ONLY)

if(NOT MSVC)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter -Wno-sign-compare -pthread")
set(CMAKE_CXX_FLAGS "-Wfatal-errors -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter -Wno-sign-compare -pthread")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DDEBUG -Wno-unused-parameter -Wno-unused-const-variable")
endif(NOT MSVC)

file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/*.cpp)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cpp/external)

set(JSON_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/cpp/external/json/include/)
set(EIGEN_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/cpp/external/eigen/)
set(AUTODIFF_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/cpp/external/autodiff)
set(PYBIND11_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/cpp/external/pybind11)

set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cpp)
file(GLOB COMMON_SRC ${SRC_DIR}/*.cpp)
list(REMOVE_ITEM COMMON_SRC ${SRC_DIR}/bindings.cpp ${SRC_DIR}/run_kineticgas.cpp)
list(APPEND COMMON_SRC ${SRC_DIR}/Integration/Integration.cpp)

if (DEFINED ENV{THERMOPACK_DIR})
set(THERMOPACK_DIR $ENV{THERMOPACK_DIR})
message(STATUS "Searching for thermopack in THERMOPACK_DIR: $ENV{THERMOPACK_DIR}")
else()
message(STATUS "THERMOPACK_DIR is not defined!")
set(THERMOPACK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cpp/external/thermopack)
message(STATUS "Setting THERMOPACK_DIR: ${THERMOPACK_DIR}")
endif()

find_package(THERMOPACK REQUIRED)
if(NOT THERMOPACK_INSTALLED)
message(STATUS "${ColorRed}ThermoPack was found, but is not installed. If you have installed ThermoPack,
set the environment variable 'THERMOPACK_DIR=</path/to/thermopack>' to help cmake find your installation.${ColorDefault}")
message(STATUS "${ColorBlue}Target 'thermopack' created from the files found at ${THERMOPACK_ROOT}.${ColorDefault}")
message(STATUS "${ColorBlue}Try Running `make install` to build and install thermopack, before re-running `cmake .. && make install` to build KineticGas.${ColorDefault}")
add_subdirectory(${THERMOPACK_ROOT}) # We need to build thermopack, because it has not been installed.
return() # Hoping that thermopack target has been created by thermopack, exiting ...
endif()

if(NOT DEFINED(FLUID_DIR))
set(FLUID_DIR "../fluids" CACHE STRING "Default search path for fluid files")
endif()
message(STATUS "Default search path for fluid files (relative to dynamic library): ${FLUID_DIR}")

option(purecpp "Build pure cpp lib" OFF)
if (purecpp)
message(STATUS "${ColorBlue}Generating C++ library targets. Run `cmake [-Dpurecpp=OFF] ..` to skip this target (you will need to clear the CMakeCache first).${ColorDefault}")
set(libTARGET kineticgas)
add_library(${libTARGET} SHARED ${COMMON_SRC})
target_include_directories(${libTARGET} PUBLIC ${JSON_INCLUDE} ${EIGEN_INCLUDE} ${AUTODIFF_INCLUDE})
target_compile_definitions(${libTARGET} PUBLIC "-DFLUID_DIR=${FLUID_DIR}")
target_link_libraries(${libTARGET} thermopack)
install(TARGETS ${libTARGET} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/lib)

set(runTARGET run_kineticgas)
add_executable(${runTARGET} ${SRC_DIR}/run_kineticgas.cpp)
target_link_libraries(${runTARGET} ${libTARGET})
else()
message(STATUS "${ColorYellow}Not generating C++ library targets. Run `cmake -Dpurecpp=ON ..` to generate these targets (you will need to clear the CMakeCache first).${ColorDefault}")
endif()

option(pylib "Build library for pykingas" ON)
if (pylib)
message(STATUS "${ColorBlue}Generating libpykingas target. Run `cmake -Dpylib=OFF ..` to skip this target (you will need to clear the CMakeCache first).${ColorDefault}")
set(pyTARGET libpykingas)
set(pykingas_path ${CMAKE_CURRENT_SOURCE_DIR}/pykingas)
add_subdirectory(${PYBIND11_ROOT})
pybind11_add_module(${pyTARGET} ${COMMON_SRC} ${SRC_DIR}/bindings.cpp)

if(NOT MSVC)
set_target_properties(${pyTARGET} PROPERTIES
INSTALL_RPATH ${THERMOPACK_ROOT}/installed
INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()

project(pykingas)
set(TARGET libpykingas)
set(pyFLUID_DIR "./fluids" CACHE STRING "Default search path for fluid files (pykingas)")
message(STATUS "pykingas search path for fluids (relative to pykingas directory): ${pyFLUID_DIR}")

# Add a library using FindPython's tooling (pybind11 also provides a helper like this)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/cpp/external/pybind11")
pybind11_add_module(${TARGET} ${SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/cpp/Integration/Integration.cpp")
target_include_directories(${pyTARGET} PUBLIC ${JSON_INCLUDE} ${EIGEN_INCLUDE} ${AUTODIFF_INCLUDE})
target_link_libraries(${pyTARGET} PRIVATE thermopack)
target_compile_definitions(${pyTARGET} PUBLIC "-DPYLIB -DFLUID_DIR=${pyFLUID_DIR}")

# The install directory is the output (wheel) directory
install(TARGETS ${TARGET} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/pykingas)
install(TARGETS ${pyTARGET} DESTINATION ${pykingas_path})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/fluids DESTINATION ${pykingas_path})
endif()
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,12 @@ The `frame_of_reference` kwarg works as normal when setting `use_independent=Fal

A standalone C++ library, that does not depend upon the Python wrapper, is currently under development. See branches under `pure_cpp/` for the most up to date information on that.

# Advanced usage
---
layout: default
version:
title: Advanced usage
permalink: /vcurrent/advanced.html
---

## Modifying and adding fluids

Expand Down Expand Up @@ -542,7 +547,7 @@ Functionality making it simple to implement new potentials is at the core of `Ki

### Implementing the C++ side

All classes that inherit from `KineticGas` must implement the methods `omega`, which returns the collision integrals, the method `model_rdf`, which returns the radial distribution function at contact, and the method `get_contact_diameters`, which returns the collision diameters.
All classes that inherit from `KineticGas` must implement the methods `omega`, which returns the collision integrals, the method `model_rdf`, which returns the radial distribution function at contact, and the method `get_collision_diameters`, which returns the collision diameters.

Out of these, the `omega` method is implemented in the `Spherical` class which instead requires that inheritting classes implement the methods `potential`, `potential_derivative_r` and `potential_dblderivative_rr`, corresponding to the pair potential, and its first and second derivative wrt. distance.

Expand All @@ -551,13 +556,13 @@ The options for implementing a new potential are then
* Inherit `KineticGas`
* Implement `omega` (The collision integrals)
* Implement `model_rdf` (The radial distribution function at contact)
* Implement `get_contact_diameters` (The collision diameters)
* Implement `get_collision_diameters` (The collision diameters)
* Inherit `Spherical`
* Implement `potential` (The pair-potential)
* Implement `potential_derivative_r` (Derivative of the pair-potential)
* Implement `potential_dblderivative_rr` (Second derivative of the pair-potential)
* Implement `model_rdf` (The radial distribution function at contact)
* Implement `get_contact_diameters` (The collision diameters)
* Implement `get_collision_diameters` (The collision diameters)

### Implementing the Python side

Expand All @@ -574,7 +579,12 @@ class MyNewPotential(py_KineticGas)
self.eos = <Some ThermoPack EoS>(comps)
```

# Structure
---
layout: default
version:
title: Structure
permalink: /vcurrent/structure.html
---

See the [structure docs](https://github.com/thermotools/KineticGas/blob/main/docs/structure/structure.pdf) for more information.

Expand Down Expand Up @@ -626,7 +636,12 @@ Stuff is illustrated here as well:

`docs/` : Documentation

# Fluid identifiers
---
layout: default
version:
title: Fluid identifiers
permalink: /vcurrent/fluid_identifiers.html
---

*Note* : Many of these fluid parameters have been pulled directly from the [ThermoPack](https://github.com/thermotools/thermopack) fluid database for SAFT-VR Mie parameters. In the cases where SAFT-VR Mie uses segment numbers $>1$ to describe the fluids, the parameter sets cannot be expected to be suitable for use with RET-Mie.

Expand Down
Loading
Loading