Skip to content

Commit

Permalink
Merge pull request #44 from zmoon/nu
Browse files Browse the repository at this point in the history
Initial NUOPC cap
  • Loading branch information
zmoon authored Jun 14, 2024
2 parents e153072 + 7a00371 commit 888a46d
Show file tree
Hide file tree
Showing 11 changed files with 3,597 additions and 3,942 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode/
*.mod

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# check environment
# Check environment
cmake_minimum_required(VERSION 3.5)

# set the project name and version
# Set the project name and version
project(NEXUS
VERSION 0.1.0
VERSION 0.2.0
LANGUAGES Fortran)

# include local macros
# Include local macros
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

# control where the static and shared libraries are built so that on windows
# we don't need to tinker with the path to run the executable
# Control where the static and shared libraries are built
# so that on Windows we don't need to tinker with the path to run the executable
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")

# do not build HEMCO standalone
# Do not build HEMCO standalone executable
set(HEMCO_EXTERNAL_CONFIG TRUE)
set(GCCLASSIC_WRAPPER TRUE)

Expand All @@ -42,6 +42,6 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
string(APPEND CMAKE_Fortran_FLAGS " -diag-disable=10448")
endif()

# add project's subdirectories
# Add project's subdirectories
add_subdirectory(HEMCO)
add_subdirectory(src)
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ or
```
git clone -b develop --recurse-submodules [email protected]:noaa-oar-arl/NEXUS.git
```
(Replace `noaa-oar-arl` with your fork if desired.)
(Replace `noaa-oar-arl/NEXUS` with your fork if desired.)

To install the pre-commit hooks, first [install `pre-commit`](https://pre-commit.com/#install),
e.g. to your Conda environment.
Expand Down Expand Up @@ -41,12 +41,8 @@ Input data:

#### GMU Hopper

##### hpc-stack feat. GCC v10 ([somewhat WIP](https://github.com/noaa-oar-arl/ufs-srweather-app/pull/6))

```
module reset
module load hpc-stack/1.2.0
module load netcdf-fortran/4.5.3-4p
. /groups/ESS3/zmoon/nexus/env5
```

Input data:
Expand Down
51 changes: 1 addition & 50 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,50 +1 @@
add_executable(nexus
nexus_driver.F90
)

add_library(NEXUS_Shared STATIC EXCLUDE_FROM_ALL
nexus_error_mod.F90
nexus_methods_mod.F90
)

target_include_directories(NEXUS_Shared
INTERFACE ${HEMCO_BINARY_DIR}/mod
)

# find external libraries
find_package(MPI REQUIRED)
find_package(ESMF REQUIRED)
find_package(NetCDF REQUIRED COMPONENTS Fortran)

target_link_libraries(NEXUS_Shared
PUBLIC HCOI_Shared
PUBLIC esmf
)

target_link_libraries(nexus
PUBLIC NEXUS_Shared
PUBLIC esmf
PUBLIC NetCDF::NetCDF_Fortran
)

set_target_properties(nexus PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

# HEMCO sets a lot of flags already, and since they are set as INTERFACE options
# they are applied to NEXUS as well.
# https://github.com/geoschem/HEMCO/blob/main/CMakeLists.txt
# But we can add a few more flags.
if(UPPER_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
# Note HEMCO only support GNU and Intel
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
# Note `-Wpedantic` causes fatal warnings in HEMCO build
set(EXTRA_FLAGS_NEXUS -Wconversion-extra -Wcharacter-truncation -Wpedantic)
endif()
target_compile_options(NEXUS_Shared PRIVATE ${EXTRA_FLAGS_NEXUS})
target_compile_options(nexus PRIVATE ${EXTRA_FLAGS_NEXUS})
endif()

install(TARGETS nexus
RUNTIME DESTINATION ${RUNDIR}
)
add_subdirectory(nuopc)
162 changes: 0 additions & 162 deletions src/nexus_driver.F90

This file was deleted.

34 changes: 0 additions & 34 deletions src/nexus_error_mod.F90

This file was deleted.

Loading

0 comments on commit 888a46d

Please sign in to comment.