Skip to content

Commit 11e7249

Browse files
committed
Initial derivatives branch
0 parents  commit 11e7249

208 files changed

Lines changed: 71008 additions & 0 deletions

File tree

Some content is hidden

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

.github/workflows/basic_build.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Basic Build
2+
run-name: "[${{ github.actor }}]: ${{ github.event_name }} to ${{ github.ref_name }}"
3+
on: [push]
4+
jobs:
5+
build-ubuntu-22:
6+
runs-on: [self-hosted, linux]
7+
container: ecpe4s/ubuntu22.04-runner-x86_64:2023-01-01
8+
steps:
9+
- name: Install build tools
10+
run: |
11+
apt-get update
12+
apt-get -y install cmake ninja-build
13+
- name: Record toolchain info
14+
run: |
15+
git --version
16+
gcc --version
17+
g++ --version
18+
gfortran --version
19+
python3 --version
20+
ninja --version
21+
cmake --version
22+
- name: Check out CEA
23+
uses: actions/checkout@v3
24+
- name: Install Python dependencies
25+
run: |
26+
python3 -m pip install --upgrade pip
27+
python3 -m pip install numpy cython
28+
- name: Build CEA in developer mode
29+
run: |
30+
scripts/develop.sh -G Ninja
31+
- name: Run test harness
32+
run: |
33+
ctest --output-on-failure --test-dir build-dev
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build and Publish Wheels
2+
3+
on:
4+
pull_request:
5+
push:
6+
tags:
7+
- "v*"
8+
9+
jobs:
10+
build-wheels:
11+
name: Wheels (${{ matrix.os }})
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-22.04, macos-13, macos-14, windows-2022]
17+
steps:
18+
- name: Check out CEA
19+
uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.12"
27+
28+
- name: Install build tools (Linux)
29+
if: runner.os == 'Linux'
30+
run: |
31+
python -m pip install --upgrade pip
32+
python -m pip install cibuildwheel build
33+
34+
- name: Install build tools (macOS)
35+
if: runner.os == 'macOS'
36+
run: |
37+
python -m pip install --upgrade pip
38+
python -m pip install cibuildwheel build
39+
40+
- name: Install build tools (Windows)
41+
if: runner.os == 'Windows'
42+
run: |
43+
python -m pip install --upgrade pip
44+
python -m pip install cibuildwheel build
45+
46+
- name: Set up MSYS2 (Windows gfortran)
47+
if: runner.os == 'Windows'
48+
uses: msys2/setup-msys2@v2
49+
with:
50+
update: true
51+
install: >-
52+
mingw-w64-x86_64-gcc-fortran
53+
mingw-w64-x86_64-cmake
54+
mingw-w64-x86_64-ninja
55+
56+
- name: Build wheels
57+
env:
58+
CIBW_BUILD: "cp311-* cp312-* cp313-*"
59+
CIBW_SKIP: "*-musllinux_*"
60+
CIBW_ARCHS_LINUX: "x86_64"
61+
CIBW_ARCHS_MACOS: "x86_64 arm64"
62+
CIBW_ARCHS_WINDOWS: "AMD64"
63+
CIBW_BEFORE_ALL_LINUX: "yum -y install gcc-gfortran"
64+
CIBW_BEFORE_ALL_MACOS: "brew install gcc"
65+
CIBW_ENVIRONMENT_WINDOWS: "PATH=C:\\\\msys64\\\\mingw64\\\\bin;${PATH} FC=gfortran CC=gcc CXX=g++"
66+
CMAKE_ARGS: "-DCEA_BUILD_TESTING=OFF"
67+
run: |
68+
cibuildwheel --output-dir dist
69+
70+
- name: Build sdist
71+
if: runner.os == 'Linux'
72+
run: |
73+
python -m build --sdist --outdir dist
74+
75+
- name: Upload artifacts
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: dist-${{ matrix.os }}
79+
path: dist/*
80+
81+
publish:
82+
name: Publish to PyPI
83+
needs: build-wheels
84+
runs-on: ubuntu-22.04
85+
if: startsWith(github.ref, 'refs/tags/v')
86+
steps:
87+
- name: Download artifacts
88+
uses: actions/download-artifact@v4
89+
with:
90+
path: dist
91+
merge-multiple: true
92+
93+
- name: Publish to PyPI
94+
uses: pypa/gh-action-pypi-publish@release/v1
95+
with:
96+
packages-dir: dist
97+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
build*
2+
dist*
3+
docs/_build/
4+
docs/doctrees/
5+
docs/doxygen/
6+
docs/html/
7+
docs/source/_build/
8+
docs/*.aux
9+
docs/*.log
10+
extern/gfe
11+
extern/install
12+
*.swp
13+
*.DS_Store
14+
*.egg-info/
15+
*CMakeCache.txt
16+
*.out
17+
*.csv
18+
*.xlsx
19+
*.bat
20+
!sampleThe/*.inp
21+
!test/main_interface/*.inp
22+
!test/main_interface/reference_output/*.out
23+
__pycache__/
24+
*.py[cod]
25+
*$py.class
26+
source/bind/excel/*.dylib
27+
source/bind/excel/*.so
28+
source/bind/excel/*.dll
29+
source/bind/excel/~$*.xlsm
30+
source/bind/excel/*.lib
31+
source/bind/python/samples

AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# AGENTS
2+
3+
This repository is a scientific computing library (CEA). Follow these rules:
4+
5+
- Do NOT modify `thermo.inp` or `trans.inp` unless explicitly instructed.
6+
- Numerical correctness is paramount; preserve bitwise results and scientific behavior.
7+
- Avoid algorithmic changes unless explicitly requested.
8+
- Prefer clarity over cleverness or micro-optimizations.
9+
- Keep changes small and focused; avoid drive-by formatting or whitespace churn.
10+
- Maintain backward compatibility for the legacy user base.
11+
- If numerical behavior might change, call it out and add validation or tests when possible.
12+
- Respect layer boundaries: Fortran core in `source/`, C bindings in `source/bind/c/`,
13+
Python bindings in `source/bind/python/`.

CMakeLists.txt

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
cmake_minimum_required(VERSION 3.19)
2+
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
3+
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
4+
project(CEA
5+
VERSION 3.0.0
6+
LANGUAGES Fortran
7+
)
8+
9+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
10+
11+
include(GNUInstallDirs)
12+
include(cea_utilities)
13+
14+
15+
#-----------------------------------------------------------------------
16+
# Configuration
17+
#-----------------------------------------------------------------------
18+
19+
# Establish if we are part of a bigger project
20+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
21+
set(PROJECT_IS_TOP_LEVEL TRUE)
22+
else()
23+
set(PROJECT_IS_TOP_LEVEL FALSE)
24+
endif()
25+
26+
if(PROJECT_IS_TOP_LEVEL)
27+
28+
# Default Install Path: Local install in current build dir
29+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
30+
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install"
31+
CACHE PATH "CEA installation directory"
32+
FORCE)
33+
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
34+
message(STATUS "Setting install path to '${CMAKE_INSTALL_PREFIX}' since none specified.")
35+
endif()
36+
37+
# Default Build Type: Standard release build
38+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
39+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
40+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
41+
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
42+
message(STATUS "Setting build type to 'Release' since none specified.")
43+
endif()
44+
45+
endif()
46+
47+
# Testing
48+
option(CEA_BUILD_TESTING "Build test harness for CEA" ${PROJECT_IS_TOP_LEVEL})
49+
if(CEA_BUILD_TESTING)
50+
find_package(PFUNIT REQUIRED)
51+
include(CTest)
52+
endif()
53+
54+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
55+
56+
# change some build systems on windows
57+
if(WIN32)
58+
# find and alternative to 'ar' archive utility
59+
find_program(AR_EXECUTABLE NAMES ar)
60+
if(AR_EXECUTABLE)
61+
message(STATUS "Found archive utility: ${AR_EXECUTABLE}")
62+
set(CMAKE_AR ${AR_EXECUTABLE} CACHE FILEPATH "Path to a program." FORCE)
63+
else()
64+
find_program(AR_EXECUTABLE NAMES gcc-ar)
65+
if(AR_EXECUTABLE)
66+
message(STATUS "Found archive utility: ${AR_EXECUTABLE}")
67+
set(CMAKE_AR ${AR_EXECUTABLE} CACHE FILEPATH "Path to a program." FORCE)
68+
else()
69+
message(WARNING "Archive utility not found.")
70+
endif()
71+
endif()
72+
endif()
73+
74+
75+
#-----------------------------------------------------------------------
76+
# Targets
77+
#-----------------------------------------------------------------------
78+
add_subdirectory(extern/fbasics)
79+
add_subdirectory(source)
80+
81+
# Build the thermodynamic properties database
82+
#configure_file(src/thermo.inp thermo.inp COPYONLY)
83+
#add_custom_target(thermo.lib ALL
84+
# COMMAND cea thermo >/dev/null
85+
# BYPRODUCTS thermo.lib thermo.out
86+
# DEPENDS cea
87+
#)
88+
89+
# Build the transport properties database
90+
#configure_file(src/trans.inp trans.inp COPYONLY)
91+
#add_custom_target(trans.lib ALL
92+
# COMMAND cea trans >/dev/null
93+
# BYPRODUCTS trans.lib trans.out
94+
# DEPENDS cea
95+
#)
96+
97+
98+
#-----------------------------------------------------------------------
99+
# Installation
100+
#-----------------------------------------------------------------------
101+
install(
102+
FILES data/thermo.lib data/trans.lib
103+
DESTINATION ${CMAKE_INSTALL_PREFIX}/data
104+
)
105+
install(EXPORT cea-config
106+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cea
107+
NAMESPACE cea::
108+
)

CMakePresets.json

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"version": 1,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 19,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "dev",
11+
"inherits": "gnu",
12+
"displayName": "Sofware Development Config (GNU)",
13+
"description": "Default configuration for software development with gfortran.",
14+
"binaryDir": "build-dev",
15+
"cacheVariables": {
16+
"CMAKE_BUILD_TYPE": "Debug",
17+
"CEA_ENABLE_BIND_C": "TRUE",
18+
"CEA_ENABLE_BIND_PYTHON": "TRUE",
19+
"CEA_ENABLE_BIND_MATLAB": "TRUE",
20+
"CMAKE_Fortran_FLAGS_DEBUG": "-g -fno_underscoring -O0 -Wall -Wextra -Wpedantic -Wcharacter-truncation -Wno-maybe-uninitialized -Werror=conversion -fcheck=all -fbacktrace"
21+
}
22+
},
23+
{
24+
"name": "dev-intel",
25+
"inherits": "intel",
26+
"displayName": "Sofware Development Config (Intel)",
27+
"description": "Default configuration for software development with ifort.",
28+
"binaryDir": "build-dev-intel",
29+
"cacheVariables": {
30+
"CMAKE_BUILD_TYPE": "Debug",
31+
"CEA_ENABLE_BIND_C": "TRUE",
32+
"CEA_ENABLE_BIND_PYTHON": "TRUE",
33+
"CMAKE_Fortran_FLAGS_DEBUG": "-g -O0 -warn all -check all -traceback -fpe0"
34+
}
35+
},
36+
{
37+
"name": "core",
38+
"inherits": "gnu",
39+
"displayName": "Core (Fortran only)",
40+
"description": "Minimal Fortran-only build without Python bindings.",
41+
"binaryDir": "build-core",
42+
"cacheVariables": {
43+
"CMAKE_BUILD_TYPE": "Release",
44+
"CEA_ENABLE_BIND_C": "FALSE",
45+
"CEA_ENABLE_BIND_CXX": "FALSE",
46+
"CEA_ENABLE_BIND_PYTHON": "FALSE",
47+
"CEA_ENABLE_BIND_MATLAB": "FALSE",
48+
"CEA_ENABLE_BIND_EXCEL": "FALSE"
49+
}
50+
},
51+
{
52+
"name": "core-c",
53+
"inherits": "gnu",
54+
"displayName": "Core (Fortran + C)",
55+
"description": "Minimal Fortran + C build without Python bindings.",
56+
"binaryDir": "build-core-c",
57+
"cacheVariables": {
58+
"CMAKE_BUILD_TYPE": "Release",
59+
"CEA_ENABLE_BIND_C": "TRUE",
60+
"CEA_ENABLE_BIND_CXX": "FALSE",
61+
"CEA_ENABLE_BIND_PYTHON": "FALSE",
62+
"CEA_ENABLE_BIND_MATLAB": "FALSE",
63+
"CEA_ENABLE_BIND_EXCEL": "FALSE"
64+
}
65+
},
66+
{
67+
"name": "gnu",
68+
"displayName": "Baseline GNU/GFortran Config",
69+
"description": "Default configuration for GNU-like compiliers.",
70+
"binaryDir": "build-gnu",
71+
"generator": "Unix Makefiles",
72+
"cacheVariables": {
73+
"CMAKE_C_COMPILER": "gcc",
74+
"CMAKE_CXX_COMPILER": "g++",
75+
"CMAKE_Fortran_COMPILER": "gfortran",
76+
"CMAKE_Fortran_FLAGS": "-std=f2008 -fno_underscoring -fimplicit-none -ffree-line-length-none"
77+
}
78+
},
79+
{
80+
"name": "intel",
81+
"displayName": "Baseline Intel/ifort Config",
82+
"description": "Default configuration for the ifort compilier.",
83+
"binaryDir": "build-intel",
84+
"generator": "Unix Makefiles",
85+
"cacheVariables": {
86+
"CMAKE_C_COMPILER": "icc",
87+
"CMAKE_CXX_COMPILER": "icpc",
88+
"CMAKE_Fortran_COMPILER": "ifort",
89+
"CMAKE_Fortran_FLAGS": "-std08"
90+
}
91+
}
92+
]
93+
}

0 commit comments

Comments
 (0)