edoddridge / aronnax

An idealised isopycnal model that can be run either with n+1/2 layers, or with n layers and variable bathymetry.
http://aronnax.readthedocs.io/en/latest/
MIT License
24 stars 6 forks source link

Check that bathymetry file and layer thicknesses are consistent with each other #14

Closed axch closed 7 years ago

axch commented 7 years ago

The in-source todo comment at https://github.com/edoddridge/MIM/blob/9adaded177146e50a9cea68b64bd5080cf13939b/MIM.f90#L219 deserves to be an issue.

@edoddridge What, exactly does this mean? How much work is involved?

edoddridge commented 7 years ago

This means that the model should check that the user specified fields are self-consistent.

I think it would be helpful for the model to throw an error if the sum of the layer thicknesses isn't equal to the depth. This is the sort of error that it is very easy for the user to make. It shouldn't be much work - we just need to check that the sum of the initial layer thicknesses equals the depth, to within some acceptable tolerance.

axch commented 7 years ago

Sounds like that tolerance wants to be a configurable relative error with a reasonable default. What default cap is reasonable? 2%? 5%? 10%?

edoddridge commented 7 years ago

At the moment it throws a warning for anything greater than 1%. This seems to be a good value, but it could probably be tightened. I tried starting the model with some horrible initial conditions and it ran, periodically throwing this warning until it settled down. Under normal conditions it doesn't throw a warning unless the model is on it's way to blowing up.

I like the idea of putting it in as a user configurable threshold.

edoddridge commented 7 years ago

@axch any reason why we shouldn't close this?

The model now has a user configurable tolerance for discrepancies between bathymetry and layer thicknesses, and automatically checks the inputs for consistency.

axch commented 7 years ago

Sounds good to me. I was just translating the in-code todo comment into a trackable ticket; if you are satisfied that this is done, by all means, please close the ticket. (And delete the comment, or edit it to imply that the code does the thing, rather than that it should.)