Skip to content

Commit

Permalink
Refactor Harp (#105)
Browse files Browse the repository at this point in the history
This is a large haul-over of refactoring RT. 
- Absorber moved to opacity module
- Use factory classes
- Remove custom Absorber enroll routines
- Build Python wrapper APIs
  • Loading branch information
chengcli authored Nov 5, 2023
1 parent d92b8f9 commit ac51d80
Show file tree
Hide file tree
Showing 130 changed files with 2,676 additions and 2,536 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,24 +292,18 @@ jobs:
- name: create build directory
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -DTASK=ktable_test -DACCOUNT=${{env.ACCOUNT}} -DTOKEN=${{secrets.ACCESS_TOKEN}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -B ${{github.workspace}}/build-netcdf
run: cmake -DTASK=ktable_earth -DACCOUNT=${{env.ACCOUNT}} -DTOKEN=${{secrets.ACCESS_TOKEN}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -B ${{github.workspace}}/build-netcdf

- name: build
# Build your program with the given configuration
run: |
cmake --build ${{github.workspace}}/build-netcdf --config ${{env.BUILD_TYPE}} -- -j2
- name: test generating ktable
working-directory: ${{github.workspace}}/build-netcdf
working-directory: ${{github.workspace}}/build-netcdf/bin
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
cp ./bin/example_giants_ir.yaml .
python ./bin/run_ktable.py -i ./bin/example_giants_ir.inp
- name: test jupiter heating/cooling
working-directory: ${{github.workspace}}/build-netcdf
run: echo "Cheers!"
run: python ./run_ktable_simple.py

straka-2d:
if: github.event.pull_request.draft == false
Expand Down
3 changes: 0 additions & 3 deletions cmake/ktable_test.cmake → cmake/ktable_earth.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ set_if_empty(NVAPOR 0)
set_if_empty(NCLOUD 0)
set_if_empty(NTRACER 2)

# canoe task set(TASKLIST InversionTasks)

# canoe configure
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/opt/")
set(USER_MODS ${CMAKE_SOURCE_DIR}/examples/giants_add_absorber)
set(HYDROSTATIC ON)
set(RFM ON)
set(NETCDF ON)
Expand Down
8 changes: 8 additions & 0 deletions doc/README-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ git reset <file>
```
git restore <file>
```
- undo a "git rebase"
```
git reset --hard ORIG_HEAD
```
- hard reset to remote
```
git reset --hard origin/main
```
- aliasing a git command
```
git config --global alias.co checkout
Expand Down
30 changes: 6 additions & 24 deletions examples/2018-Li-harp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,15 @@
# =============================================
# Examples published in Li et al. (2018), JQSRT
# =============================================

string(TOLOWER ${CMAKE_BUILD_TYPE} buildl)
string(TOUPPER ${CMAKE_BUILD_TYPE} buildu)

# 1. Compile giants_re.cpp

set(namel giants_re)

add_executable(${namel}.${buildl} ${namel}_pgen.cpp ${namel}_mods.cpp
${CMAKE_BINARY_DIR}/main_${TASK}.cpp)

set_target_properties(
${namel}.${buildl}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
COMPILE_FLAGS ${CMAKE_CXX_FLAGS_${buildu}}
)

target_link_libraries(${namel}.${buildl}
${CANOE_LIBRARY_${buildu}}
)

target_include_directories(${namel}.${buildl}
PRIVATE
${CMAKE_BINARY_DIR}
${CANOE_INCLUDE_DIR}
${EIGEN3_INCLUDE_DIR}
)

# 1. Copy input file to run directory
setup_problem(giants_re)

# 2. Copy input file to run directory
file(GLOB inputs *.inp *.toml *.yaml)
foreach(input ${inputs})
file(COPY ${input} DESTINATION ${CMAKE_BINARY_DIR}/bin)
Expand Down
3 changes: 1 addition & 2 deletions examples/2018-Li-harp/giants_ir.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
category: infrared

opacity-sources:
- name: H2-H2-CIA
long-name: "Hydrogen-Hydrogen collisional absorption"
Expand Down Expand Up @@ -28,6 +26,7 @@ opacity-sources:
bands: [B1, B2, B3, B4, B5, B6, B7, B8, B9, B10]

B1:
grid-type: regular
rt-solver: Disort
unit: cm-1
wavenumber-range: [10., 200.]
Expand Down
File renamed without changes.
101 changes: 0 additions & 101 deletions examples/2018-Li-harp/giants_re_mods.cpp

This file was deleted.

39 changes: 6 additions & 33 deletions examples/2020-Li-polar-vortex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
string(TOLOWER ${CMAKE_BUILD_TYPE} buildl)
string(TOUPPER ${CMAKE_BUILD_TYPE} buildu)

# 1. Compile straka.cpp

#set(namel straka)

foreach(namel shallow_xy polar_vortex)
find_package(Boost REQUIRED)

add_executable(${namel}.${buildl} ${namel}.cpp
${CMAKE_BINARY_DIR}/main_${TASK}.cpp)

set_target_properties(
${namel}.${buildl}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
COMPILE_FLAGS ${CMAKE_CXX_FLAGS_${buildu}}
)

target_link_libraries(${namel}.${buildl}
${CANOE_LIBRARY_${buildu}}
)

target_include_directories(${namel}.${buildl}
PRIVATE
${CMAKE_BINARY_DIR}
${CANOE_INCLUDE_DIR}
${MPI_CXX_INCLUDE_PATH}
${NETCDF_INCLUDES}
${PNETCDF_INCLUDE_DIR}
)
endforeach()
# ============================================
# Examples published in Li et al. (2022), PNAS
# ============================================

# 1. Compile shallow_xy and polar_vortex
setup_problem(shallow_xy)
setup_problem(polar_vortex)

# 1. Copy input file to run directory

Expand Down
38 changes: 5 additions & 33 deletions examples/2023-Chen-exo3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,11 @@
string(TOLOWER ${CMAKE_BUILD_TYPE} buildl)
string(TOUPPER ${CMAKE_BUILD_TYPE} buildu)
# ===============================================
# Examples published in Cheng et al. (2023), ApJS
# ===============================================

# 1. Compile dam_break.cpp
setup_problem(dam_break)

foreach(namel dam_break)
add_executable(${namel}.${buildl} ${namel}.cpp
${CMAKE_BINARY_DIR}/main_${TASK}.cpp)

set_target_properties(
${namel}.${buildl}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
COMPILE_FLAGS ${CMAKE_CXX_FLAGS_${buildu}}
)

target_link_libraries(${namel}.${buildl}
${CANOE_LIBRARY_${buildu}}
${NETCDF_LIBRARIES}
${PNETCDF_LIBRARY}
${MPI_CXX_LIBRARIES}
)

target_include_directories(${namel}.${buildl}
PRIVATE
${CMAKE_BINARY_DIR}
${CANOE_INCLUDE_DIR}
${MPI_CXX_INCLUDE_PATH}
${NETCDF_INCLUDES}
${PNETCDF_INCLUDE_DIR}
)
endforeach()


# 1. Copy input file to run directory

# 2. Copy input file to run directory
file(GLOB inputs *.inp *.dat)
foreach(input ${inputs})
file(COPY ${input} DESTINATION ${CMAKE_BINARY_DIR}/bin)
Expand Down
38 changes: 6 additions & 32 deletions examples/2023-Li-saturn-vla/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
string(TOLOWER ${CMAKE_BUILD_TYPE} buildl)
string(TOUPPER ${CMAKE_BUILD_TYPE} buildu)
# ========================================================
# Examples published in Li et al. (2019), Science Advances
# ========================================================

# 1. Compile juno.cpp

set(namel saturn_radio)

add_executable(${namel}.${buildl} ${namel}.cpp
${CMAKE_BINARY_DIR}/main_${TASK}.cpp)

set_target_properties(
${namel}.${buildl}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
COMPILE_FLAGS ${CMAKE_CXX_FLAGS_${buildu}}
)

target_link_libraries(${namel}.${buildl}
${ATHENAPP_LIBRARY_${buildu}}
${CANOE_LIBRARY_${buildu}}
${NETCDF_LIBRARIES}
${CPPDISORT_LIBRARY_${buildu}}
)

target_include_directories(${namel}.${buildl}
PRIVATE
${CMAKE_BINARY_DIR}
${CANOE_INCLUDE_DIR}
${EIGEN3_INCLUDE_DIR}
${MPI_CXX_INCLUDE_PATH}
)

# 1. Copy input file to run directory
# 1. Compile saturn_radio.cpp
setup_problem(saturn_radio)

# 2. Copy input file to run directory
file(GLOB inputs *.inp *.yaml)
foreach(input ${inputs})
file(COPY ${input} DESTINATION ${CMAKE_BINARY_DIR}/bin)
Expand Down
Loading

0 comments on commit ac51d80

Please sign in to comment.