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

Restart file giving spurious simulation runs #2838

Open
davedavemckay opened this issue Jan 16, 2024 · 2 comments
Open

Restart file giving spurious simulation runs #2838

davedavemckay opened this issue Jan 16, 2024 · 2 comments

Comments

@davedavemckay
Copy link

Hello,
BOUT_restarts.zip

I am attempting to run BOUT simulations using the Hasegawa-Wakatani example with data taken from a previous fine-grained simulation and then resized to a coarser grid. I have attached a zip file containing "old_BOUT.restart.0.nc" and "new_BOUT.restart.0.nc" and an example BOUT.inp file. The old_* file was resized using boutdata.resize and the new_* file using our own scripts built on xarray and boutdata. The reason for doing this is our scripts simply using array slicing to resize the data and calculate the correct guard cell values, rather than using interpolation, making the resizing a little faster.

We then wish to run coarse-grained simulations on this data. However, with the new_* file as input the simulation gives spurious results after a single step. I wondered if someone could take a look at the two NetCDF files - the most obvious difference is there is an 'x2' dimension in the old_* file that retains the shape of the fine-grained simulation, and some variables that are copied over from the fine data depend on 'x2' (1028), rather than 'x' (260). The new data conforms to the intended dimensions of the coarse-grained simulation with dimensions x=260,y=1,z=256. It is then confusing that BOUT handles the old data as expected (running the coarse-grained simulation) but does not handle the new data as expected.

My question is: what is BOUT doing when it reads in the NetCDF file? It seems it is possibly ignoring variables that are larger than the xyz dimensions and fixing or ignoring guard cell values in the old data. But perhaps there is some metadata value(s) in the new data that cause the simulation to break?

Any ideas much appreciated!
Dave

@ZedThree
Copy link
Member

Hi @davedavemckay, sorry for the slow response!

You're actually specifying the mesh in the input file:

[mesh]

nx = 260  # Note 4 guard cells in X
ny = 1
nz = 256  # Periodic, so no guard cells in Z

dx = 0.1
dy = 1.0
dz = 0.1

so none of the grid variables are read from the file, and these happen to be the ones on the old x2 coordinates. You could safely drop all of those variables.

It looks like there's differences in n on the order of 10% between those two files. I would guess that's the source of your issues

@davedavemckay
Copy link
Author

davedavemckay commented Jan 18, 2024

Thanks @ZedThree. I'll have a look at how 'n' is handled in our two coarsening scripts.
Good to know BOUT doesn't read variables from the data files if they are specified in the BOUT.inp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants