Conversation
This commits adds the option `inner_maxmode`, which can be used in combination with `inner_ort` to distribute the points on the inner boundary more smoothly. Unlike `maxmode_inner`, this does not sets a maximum ratio, but ensures that the points are distributed locally smoothly, by removing high frequency modes in the distrbution. This is not enabled by default, as the value of inner_maxmode depends on the the specific mesh. But it seems that for simple cases, low values around 5 seem to be good.
Also remove some debugging code.
This is needed if additional worktrees are checked out for building the package.
This allows to gradually write a file. This can reduce memory consumptions and allows to continue if it fails while running. It also fixes the calculation of the parallel slices.
servers are sometimes busy
This reverts commit 8102f0b. This caused the package build to miss some files.
For large grids that fail to converge, the current upper bound of iterations can be extremly time consuming. This new, lower bound seems to also work for strongly shaped grids, if it is converging at all.
Mostly churn, zoidberg had a real bug
This class wraps a fieldlinetracer, and returns a previous result, if the same x, z and y coordinates are given. If other parameters change, like magnetic field, the user has to change the field name to avoid returning the wrong result.
Do only trace once in forward and backward direction, not once per target. For myg=2 this should reduce tracing cost by about 33%.
Ensures that dy has no jump to negative values where the periodic boundary is crossed.
This is a memory efficient version, that can be conviniently called on the MapWriter
zoidberg/field.py
Outdated
| """ | ||
| Parameters | ||
| ---------- | ||
| m: torodial mode number |
There was a problem hiding this comment.
This 'm' and 'n' choice seems to be opposite to the usual convention: 'n' is usually used for toroidal mode number, 'm' for poloidal.
There was a problem hiding this comment.
@bendudson Should we change the order or n and m? It might break any code that passes m= - but it might be broken now and that fixes it ...
I did not use the code, just fixed it as ruff was complaining, so I have no strong opinion either way ...
There was a problem hiding this comment.
+1 for m: poloidal, n: toroidal, this is a pretty strong convention
# Conflicts: # zoidberg/examples/screwpinch.py
GHA sets it to a value that is not valid in the container
less indention, as the short branch comes first
n is for toroidal and m for poloidal
|
I think I have addressed all concerns. I have stayed with asserts, but added a (hopefully) helpful error message to them. I find that cleaner. |
| for k in "RZ": | ||
| n = parallel_slice_field_name(k, offset) | ||
| keep[n] = maps[n] | ||
| del maps |
There was a problem hiding this comment.
This doesn't do anything, it just deletes the local reference which will be deleted when it goes out of scope anyway
There was a problem hiding this comment.
_write_par_metric may use a lot of memory, so it is good to free up before what we can easily.
| del R | ||
| del Z |
There was a problem hiding this comment.
But they're going to go out of scope at the end of this function, can we really not call _write_metric if these haven't been GC'd? There's no guarantee that it will run before then anyway
| if update: | ||
| oldattrs = f.list_file_attributes() | ||
| for k in list(attrs.keys()): | ||
| if k in oldattrs: | ||
| oldattr = f"old_{k}" | ||
| j = 0 | ||
| while oldattr in oldattrs: | ||
| oldattr = f"old{j}_{k}" | ||
| j += 1 | ||
| attrs[oldattr] = f.read_file_attribute(k) |
There was a problem hiding this comment.
Not sure I see the point in updating a grid file -- why not just keep the old one?
There was a problem hiding this comment.
The old grid file may not have parallel metrics or other thinks.
Sometimes it is easier to update a grid then to start from scratch.
zoidberg/zoidberg.py
Outdated
| self, | ||
| gridfile="fci.grid.nc", | ||
| new_names=False, | ||
| format="NETCDF4", |
There was a problem hiding this comment.
Let's just drop this. I'm not sure there are any other sensible choices!
|
Leftover |
|
Not in the MMS tests, but in |
This commits adds the option
inner_maxmode, which can be used in combination withinner_ortto distribute the points on the inner boundary more smoothly. Unlikemaxmode_inner, this does not sets a maximum ratio, but ensures that the points are distributed locally smoothly, by removing high frequency modes in the distrbution.This is not enabled by default, as the value of inner_maxmode depends on the the specific mesh. But it seems that for simple cases, low values around 5 seem to be good.