@@ -26,7 +26,7 @@ function createdata(; params, seed, outdir, backend)
2626 @info " Creating data for" nles Φ seed
2727
2828 data = NS. create_les_data_projected (
29- nchunks = 500 ;
29+ nchunks = 8000 ;
3030 params... ,
3131 rng = Xoshiro (seed),
3232 backend = backend,
@@ -44,6 +44,22 @@ function getpriorfile(outdir, closure_name, nles, filter)
4444 )
4545end
4646
47+ function reusepriorfile (reuse, outdir, closure_name)
48+ reusepath = joinpath (outdir, " priortraining" , reuse)
49+ targetpath = joinpath (outdir, " priortraining" , closure_name)
50+ # If the reuse path exists, copy it to the target path
51+ if ispath (reusepath)
52+ @info " Reusing prior training from $(reusepath) to $(targetpath) "
53+ ispath (targetpath) || mkpath (targetpath)
54+ for file in readdir (reusepath, join = true )
55+ @info " Copying prior training file $(file) to $(targetpath) "
56+ cp (file, joinpath (targetpath, basename (file)); force = true )
57+ end
58+ else
59+ @warn " Reuse path $(reusepath) does not exist. Not reusing prior training."
60+ end
61+ end
62+
4763" Load a-priori training results from correct file names."
4864loadprior (outdir, closure_name, nles, filters) = map (
4965 splat ((nles, Φ) -> load_object (getpriorfile (outdir, closure_name, nles, Φ))),
@@ -104,7 +120,6 @@ function trainprior(;
104120 # Read the data in the format expected by the CoupledNODE
105121 data_train = load_data_set (outdir, nles, Φ, dns_seeds_train)
106122 data_valid = load_data_set (outdir, nles, Φ, dns_seeds_valid)
107-
108123 @assert length (nles) == 1 " Only one nles for a-priori training"
109124 io_train = NS. create_io_arrays_priori (data_train, setup[1 ], device)
110125 io_valid = NS. create_io_arrays_priori (data_valid, setup[1 ], device)
0 commit comments