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

Feature/cmake build #8

Merged
merged 3 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.14)

project(ecoslim LANGUAGES Fortran)

find_package(OpenMP)

if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(DEBUG_FLAGS "-ffpe-trap=zero,overflow,underflow -fbacktrace -fbounds-check")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
set(DEBUG_FLAGS "-check bounds")
endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
set(DEBUG_FLAGS "-C")
endif()

set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DEBUG_FLAGS}")

set(SOURCE ran1.mod.f90 EcoSLIM.f90 pfb_read.f90 vtk_write.f90 vtk_write_points.f90)

add_executable(EcoSLIM.exe ${SOURCE})

if(OpenMP_Fortran_FOUND)
target_link_libraries(EcoSLIM.exe PUBLIC OpenMP::OpenMP_Fortran)
endif()
File renamed without changes.
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,21 @@ For more details on the model and if you use EcoSLIM in published work please ci

Building and Running
--------------------
To build *EcoSLIM* simply type `make` in the directory with the main directory where `EcoSLIM.f90` sits.
To build *EcoSLIM* first use CMake to configure the build. EcoSLIM will build with OpenMP if it is found by CMake.

```
mkdir build
cd build
cmake ..
```

The next step is to build *EcoSLIM*

```
make
```

If this is successful there should be an `EcoSLIM.exe` executable in the build directory.

To set the number of parallel threads use either
`export OMP_NUM_THREADS=16` for bash or
Expand All @@ -23,9 +37,9 @@ To set the number of parallel threads use either
To run you will need to have a completed *ParFlow* simulation and an
*EcoSLIM* input file that must be named `slimin.txt` and follow the
format described below. Note that the slim input file does not need to be co-located
with the ParFlow simulation.
with the ParFlow simulation.

To run simply execute `EcoSLIM.exe` from the directory that contains the
To run simply execute the `EcoSLIM.exe` binary in the directory that contains the
`slimin.txt` input file.

Refer to the *Examples* directory described below for example workflows
Expand Down Expand Up @@ -216,3 +230,22 @@ is provided here. For more details on how to run the examples refer to the
readme files in that directory. Note that the *testing* folder contains tests that were used for development purposes and which are not necessarily maintained with updated versions. User should refer only to the *Examples* folder.
1. **ParFlow_SteadyFlux**: A hillslope domain with constant recharge and ET applied at the top and bottom of the hill respectively. Example is setup to run *EcoSLIM* on transient *ParFlow* outputs without *CLM*. The documentation for this example includes all the steps for running *ParFlow* and *EcoSLIM*
2. **Hillslope_Simulations/paper_cases**:Hillslope Cases Run in [Maxwell et al. Ecohydrology](https://doi.org/10.1002/eco.2042), see readme file for more details


FAQ
---------------

If you wish to build *EcoSLIM* with debugging enabled, use the
standard method of setting the CMake build type to debug:

```
cmake -DCMAKE_BUILD_TYPE=debug ..
```

Explicitly controlling the Fortran compiler used is done by setting
the FC environment variable for the CMake configure, here we use the
Intel Fortran compiler:

```
FC=ifort cmake ..
```