Implemented interface to FieldsIO in core problem class and respective hook #542
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added three functions to the core problem class, which I hope cover most cases:
setUpFieldsIO: Mostly for setting up space decomposition. Here, you can call all the class methods ofFieldsIOand derived classesgetOutputFile: This function is supposed to instantiate aFieldsIOobject fully set up, only taking a file name as an argument. This needs to be done individually for the problem classes to set the header and data structure correctlyprocessSolutionForOutput: Do stuff to the solution before writing to the file. For instance, when using spectral methods, you may want to transform from spectral space to real space and throw away the imaginary part to save disc space.Once these functions are set up for the problem class you want, you can simply add the hook
LogToFile(I renamed the previous hook of this name toLogToPickleFile).You configure this class via class attributes for file name, simulation time increment between writes and whether or not you allow overwriting of previous files.
This hook also supports restarting runs. If the path to the file exists and you are starting from a time greater than zero, it will append the file with the new solutions.
I added the setup of
FieldsIOforgeneric_spectralandTestEquation0Dclasses. I have used this to run the 3D RBC examples that I will merge at some point.Finally, I wrote a bunch of tests for this. Note that I am using
pytest-isolate-mpias discussed in #539 here.This PR works on #534. It is addressing functionality parts rather than documentation, which should be added later as well.