Conversation
* Removed all imports of old_div, replacing with the correct divisions * Sympy import is now in a try...except block, so if missing the slab and VMEC field classes can still be used.
Given two periodic lines for the inner and outer boundary, divides up the distance along them, and uses this to grid the domain. Seems to work for weak shaping, but fails for strongly shaped (e.g. bean) configurations. Some units tests for pytest included in test_poloidal_grid.py
Uses weighted distance to inner and outer surfaces and follows from inner boundary to closest point on outer boundary
Creates boundary shapes with elongation, triangularity and indentation
Creates a grid between two arbitrarily shaped boundaries by solving a nonlinear elliptic equation $ python poloidal_grid.py
Starts with a coarse grid to get a starting guess then refines. This will typically result in multiple levels of resolution. Seems to significantly speed up solution for large(ish) grids (100x100 or so)
* Split RZLine code into separate rzline.py file * Added PoloidalGrid class in poloidal_grid.py which uses scipy.spatial.cKDTree to find nearest coordinates to given locations. Still under development
Now have RectangularPoloidalMesh and StructuredPoloidalMesh Both have getCoordinate() methods, which get (R,Z) from (x,y) index and findIndex() which gets (x,y) from (R,Z) In the case of StructuredPoloidalGrid, findIndex uses a combination of cKDTree from SciPy with Newton iteration.
Represents a collection of poloidal grids, and provides ways to iterate through them.
Replaces Grid class with new implementation. Requires changes in several places, not all done yet.
Modifying MagneticField (field.py) classes so they don't depend on a grid. Relative imports for Python3. Is this going to break Python2? Brackets in print() statements
* Derived classes override functions rather than passing to __init__ * The major radius is determined by MagneticField class rather than grid * A grid is no longer needed to construct MagneticField * The VMEC class now derives from MagneticField rather than containing a magnetic_field member
* R,Z, forward_R,Z and backward_R,Z give real-space coordinates of intersection points. These will also be used to record locations of boundary intersections * Added example to examples/zoidberg/
Reconstructs an RZline (periodic line) from a set of points using the nearest neighbour algorithm
Creates grids for a straight stellarator, with a flux surface for the inner boundary. Fixed bug in elliptic grid generator to do with y periodicity
Needs to be able to handle points outside the domain e.g. points which hit the boundary. At the moment StructuredPoloidalGrid throws an exception for points outside the domain
Rather than printing an error message when Sympy can't be imported, this now defines a StraightStellarator class which raises an ImportError if it is ever used. This means a useful error message is printed at the point where the error occurs.
examples/zoidberg/straight-stellarator-curvilinear.py Added handling of boundary points to StructuredPoloidalGrid along with some tests. Points outside the domain are caught and marked.
The standard FieldTracer seems to work well on some SciPy versions, but not so well on others. A possible cause is that the time integrator is not reversible in y. When integrating over many periods, this can lead to a gradual drift. FieldTracerReversible uses an implicit trapezoidal (Crank-Nicholson) algorithm, which is symmetric in y. This means that if run backwards it should reproduce the same points. Added an example which makes a Poincare plot
half-finished, not working yet
Removed requirement for a grid, and added starting locations instead.
Replaced grid input with starting x,z positions
* Changed PoloidalGrids from (x,y) to (x,z) notation to reduce confusion * PoloidalGrids and Grid now calculate metric tensor * write_maps runs, produces output grid file
* Bugfixes to VMEC reader: forgot to add self argument * Poincare plotting fails in cases where 3D field line plotting works. A solution seems to be to request more outputs at shorter intervals, then throw away the unneeded values
This calculates a Poincare map, and is used in plot_poincare and can also be used to find flux surfaces for grid generation
Option "new_names" to write_maps outputs metrics as "g_yy" etc rather than "g_22"
When interpolating from low resolution starting solutions, the boundary points were also interpolated. This meant that the inner and outer boundaries were sampled on only a few points. The fix is to re-impose the boundary conditions from the inner and outer RZline inputs after interpolating the solution
new_names causes write_maps to output "g_xx", "g_yy" etc. rather than "g_11", "g_22" etc. metric2d reduces the 3D metrics to 2D, by taking only the Z=0 part and dz(0,0,0). This is to allow it to write grids compatible with the current BOUT-dev. No checks are currently performed that this is ok, and it should only be done for rectangular grids.
* Field lines which hit the inner X boundary still have xind = -1 * Those which hit the outer boundary have xind = nx Previously both inner and outer boundaries had index -1 This change should allow different boundaries to be applied to the two cases.
Both RectangularPoloidalGrid and StructuredPoloidalGrid now inherit from PoloidalGrid. This provides a plot() method
Start of a manual in user_docs, and some docstrings
Same as the test for the standard field tracer
ny-1 rather than ny put grid points in slightly wrong positions in cases where the y domain was non-periodic. Now fixed and added unit test.
Starting from simplest working example and building from there, rather than explaining each step in detail one by one.
Plots the line marking the original points and showing the spline interpolation. Useful for quickly diagnosing issues.
This method returns a new line with points which are equally spaced around the original line.
Adding Zoidberg to table of contents
Member
|
Should this be for v4.1? |
ZedThree
approved these changes
Aug 15, 2017
Merged
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.
Zoidberg can now create 3D FCI grids using more general grids, in particular grids for the simulation of the edge of stellarators.