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

Restructure Repository #72

Merged
merged 10 commits into from
Sep 18, 2024
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
7 changes: 7 additions & 0 deletions CAM_interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require revisions to these files in future.
In addition to the files in `[/NN_Module](/NN_Module)` containing the parameterisation,
the additional files here are required:

- `nn_interface_CAM.F90` - The interface for performing conversion from CAM variables and grid into the variables/grid expected by the YOG parameterisation.
- `yog_intr.F90` - The interface between the CAM model and the YOG parameterisation.

Changes also have to be made to:
Expand All @@ -27,3 +28,9 @@ Changes also have to be made to:
- `/src/physics/cam/physpkg.F90` - To call the new parameteristion routines detailed in `yog_intr.F90`.

Full details of these can be seen in the specific implementation in CAM linked above.


## Tests

There are test routines associated with this code in `/tests/test_CAM_interface/`.
Guidance on running these can be found in the main README.
File renamed without changes.
47 changes: 0 additions & 47 deletions NN_module/Makefile

This file was deleted.

202 changes: 0 additions & 202 deletions NN_module/nn_interface_SAM.f90

This file was deleted.

49 changes: 38 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,58 @@ Long term developments of this project will seek to re-deploy more complex ML pa
## Repository structure

```
├── NN_module
├── YOG_convection
│   └── ...
├── torch_nets
│ └── ...
└── CAM_interface
├── CAM_interface
│ └── ...
└── tests
└── ...
```


```

### Contents

### `NN_module/`
This folder contains the fortran neural net extracted from the [code referenced above](https://github.com/yaniyuval/Neural_nework_parameterization/tree/v.1.0.3), along with any dependencies, that may be compiled as a standalone fortran module.

Currently there is code that can be built on CSD3 using the included shell script.
This now needs cleaning up, testing, and a proper makefile creating (see open issues #9 and #10).
### `YOG_convection/`
This directory contains the fortran code for the YOG convection parameterisation, along with any dependencies.
It can be included as a standalone fortran module in a larger model.

### ``torch_nets/``
The directory contains the PyTorch versions of the neural networks we are interested in.
This directory contains the PyTorch versions of the neural networks used in the YOG convection parameterisation.

### ``CAM_interface/``
The directory contains the additional files or details to interface the code with the CAM atmospheric model
The directory contains the additional files or details to interface the YOG code with the CAM atmospheric model
as part of the CESM model suite. It also includes a link to an implementation in a fork of CAM.

### ``tests/``

There are some tests for the NN_module and interface code in the `test/`
subdirectory.
These require a Fortran compiler, `netcdf` and
`netcdf-fortran` libraries, and CMake to build.

They can be built and run with CMake using the following commands:
```
cd tests
mkdir build
cd build
cmake ..
cmake --build .
```
This will create executables in the `build/` subdirectory which can be
run to execute the tests using:
```
./test_YOG_convection
./test_CAM_interface
```
with output printed to the console.

Note: To build only a specific subset of tests instead of all of them use:
```
cmake --build . --target <name_of_test_executable>
```


## Contributing

Expand Down
11 changes: 3 additions & 8 deletions NN_module/README.md → YOG_convection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Files:

- `nn_cf_net.f90` - The core neural net routines
- `nn_convection_flux.f90` - wrapper around the neural net routines to perform physics-based operations
- `nn_interface_SAM.f90` - wrapper around the parameterisation routines to interface with the SAM model
- `test.f90` - simple smoke tests for parameterisation routines
- `NN_weights_YOG_convection.nc` - NetCDF file with weights for the neural net
- Makefile - Makefile to compile these files
Expand All @@ -26,11 +25,7 @@ python sounding_to_netcdf.py
deactivate
```

## Running tests
## Tests

To run the tests (requires `ifort` or `gfortran` compiler and and `netcdf` and
`netcdf-fortran` libraries) edit `Makefile` to select the appropriate compiler
(`ifort` or `gfortran`), set flags, and select files, and then build with:
```
make
```
There are test routines associated with this code in `/tests/test_NN_module/`.
Guidance on running these can be found in the main README.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading