Merged
Conversation
Adds function call to BoutMesh::load which creates Regions for the X and Y boundaries. Currently called RGN_UPPER_Y RGN_LOWER_Y RGN_INNER_X RGN_OUTER_X RGN_LOWER_INNER_Y RGN_LOWER_OUTER_Y RGN_UPPER_INNER_Y RGN_UPPER_OUTER_Y In Solver the size of the regions is used to work out the number of points which are evolving. To get this a `size` member function and templated function are added. Code in solver now considerably shorter, since just iterates over region names.
Added a constructor Ind3D(SpecificInd) to allow indexing of a Field3D by Ind2D + int (z index offset). New region "RGN_ALL_BOUNDARIES" which contains a unique set of points in the boundaries. Solver class changed to use RGN_NO_BNDRY and RGN_ALL_BOUNDARIES to loop over points. This should make it possible to turn off time evolution in parts of the grid, for example in odd-shaped domains.
Previously passing in an invalid range of indices, where xend+1 <= ystart, for example, would throw. This has some benefits, and could potentially catch code errors. Unfortunately it also prevents empty regions being created, and would complicate the code to create boundary regions. Changed so that invalid index ranges are just empty.
Thanks to @d7919. The implicit conversion of Ind2D to Ind3D is fixed and replaced by an explicit calculation.
Rather than throwing an exception, the code now returns an empty region.
Less descriptive, but more consistent with RGN_NOBNDRY.
Region construction still throws if given invalid ny or nz sizes.
Replacing RangeIterator with Region, using the same order as the Solver class to iterate over elements.
Member
|
Once #934 is merged (just waiting for tests), this can use those 2D <-> 3D conversion functions. Also, we should add unit tests for these. I realise these are a bit more complicated as there's lots of possible combinations, but I'll have a stab at them tomorrow. |
* next: (629 commits) Fix typo in collect Fix exit status of quiet script Apply fix for MXG!=1 to LaplaceSPT and LaplaceSerialBand Revert change to INVERT_BNDRY_ONE cases Allow number of x-boundary points to change in FFT Laplace solvers Fix order of arguments in call to tridagMatrix in LaplaceSPT Fix for updated breathe on readthedocs Zoidberg fixes for ny=1 Show inheritance in boutarray module to see it inherits from numpy Removing matplotlib/numpy/scipy mock modules from sphix conf Add todo about removing numpy.random.normal import Add numpydocs-style docstring for datafile Don't reimport sys in sphinx conf.py Add numpydocs-style docstring for options Replace 8 spaces with 4 Fix formatting with list in argument description Fix formatting for *args, **kwargs Use more consistent formatting of list of types Finish the numpdocs for zoidberg Move Python doc TODOs into own sections ...
ZedThree
reviewed
Jun 7, 2018
src/solver/solver.cxx
Outdated
| if(bndry && !f.evolve_bndry) | ||
| continue; | ||
| (*f.var)(jx, jy, jz) = udata[p]; | ||
| (*f.var)[Ind3D(i2d.ind*nz + jz)] = udata[p]; |
Member
There was a problem hiding this comment.
I've finally got around to updating this, but it ends up looking like:
(*f.var)[f.var->getMesh()->ind2Dto3D(i2d, jz)] = udata[p];Given that we're already looping over mesh->LocalNz, I'm not 100% sure this is any better. I suspect that solver probably assumes all the fields it's evolving are on the same mesh anyway...
ZedThree
approved these changes
Jun 14, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Much of the remaining use of RangeIterator requires index offsets, for example when setting boundary conditions.