Skip to content

Commit

Permalink
Merge branch 'main' into gpu_in_hpc
Browse files Browse the repository at this point in the history
  • Loading branch information
luisaforozco committed Dec 3, 2024
2 parents 37e92b7 + 69869a4 commit 9ee43d9
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ jobs:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
docs:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ Manifest.toml
/docs/build/

# Ignore large data files
simulations/*/*/*.jld2
simulations/*/*/*.jld2
test/test_data/*.jld2
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ LuxCore = "bb33d45b-7691-41d6-9220-0943567d0623"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

[![Build Status](https://github.com/DEEPDIP-project/CoupledNODE.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/DEEPDIP-project/CoupledNODE.jl/actions/workflows/CI.yml)
[![Documentation Status](https://readthedocs.org/projects/gemdat/badge/?version=latest)](https://deepdip-project.github.io/CoupledNODE.jl/stable/)
[![DOI](https://zenodo.org/badge/760462639.svg)](https://doi.org/10.5281/zenodo.14197271)

## Installation

Expand Down
3 changes: 1 addition & 2 deletions simulations/NavierStokes_2D/scripts/generate_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ T = Float64
rng = Random.Xoshiro(123)

using Pkg
Pkg.add(url = "[email protected]:DEEPDIP-project/NeuralClosure.jl.git")

Pkg.add(url = "https://github.com/DEEPDIP-project/NeuralClosure.jl.git")
using NeuralClosure: NeuralClosure as NC

# Number of simulations to generate for each grid
Expand Down
49 changes: 49 additions & 0 deletions test/generate_test_data.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using IncompressibleNavierStokes: IncompressibleNavierStokes as INS
using JLD2: jldsave
using Random: Random

T = Float32
rng = Random.Xoshiro(123)

# Generate the data using NeuralClosure
# Add NeuralClosure from the git repo, until it is added to the public repo
using Pkg
Pkg.add(url = "https://github.com/DEEPDIP-project/NeuralClosure.jl.git")
using NeuralClosure: NeuralClosure as NC

# Number of simulations to generate for each grid
Nsim_train = 3
Nsim_test = 2

# Parameters
params = (;
D = 2,
Re = T(1e3),
lims = (T(0.0), T(1.0)),
nles = [16, 32],
ndns = 64,
filters = (NC.FaceAverage(),),
tburn = T(5e-2),
tsim = T(0.5),
savefreq = 1,
Δt = T(5e-3), create_psolver = INS.psolver_spectral,
icfunc = (setup, psolver, rng) -> INS.random_field(
setup, zero(eltype(setup.grid.x[1])); kp = 20, psolver, rng),
rng
)

data_train = [NC.create_les_data(; params...) for _ in 1:Nsim_train];
data_test = [NC.create_les_data(; params...) for _ in 1:Nsim_test];

@test data_train isa Array
@test data_test isa Array
@test params isa NamedTuple

#save data
jldsave("test_data/data_train.jld2"; data_train)
jldsave("test_data/data_test.jld2"; data_test)
jldsave("test_data/params_data.jld2"; params)

@test isfile("test_data/data_train.jld2")
@test isfile("test_data/data_test.jld2")
@test isfile("test_data/params_data.jld2")
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using CoupledNODE
using Test

# Needs to be run before tests
@testset "generate test data" begin
include("generate_test_data.jl")
end

#=
Don't add your tests to runtests.jl. Instead, create files named
Expand Down
Empty file added test/test_data/.gitkeep
Empty file.
Binary file removed test/test_data/data.jld2
Binary file not shown.
Binary file removed test/test_data/data_test.jld2
Binary file not shown.
Binary file removed test/test_data/data_train.jld2
Binary file not shown.
Binary file removed test/test_data/data_val.jld2
Binary file not shown.
Binary file removed test/test_data/params_data.jld2
Binary file not shown.

0 comments on commit 9ee43d9

Please sign in to comment.