Skip to content

Commit

Permalink
Resolve "Diagnostic for growth rate does not support LandauXYVxVy"
Browse files Browse the repository at this point in the history
Closes #231

See merge request gysela-developpers/gyselalibxx!499

--------------------------------------------
  • Loading branch information
EmilyBourne committed Jun 12, 2024
1 parent 92aa139 commit 72b12c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions post-process/PythonScripts/diag_growthrate
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,28 @@ if __name__ == '__main__':
help='end time index')
args = parser.parse_args()

data_structure_name = 'data_structure_XVx.yaml'
multid = False
data_structure_name = ''
geo = ''
if 'XVx' in str(args.data_dir):
data_structure_name = 'data_structure_XVx.yaml'
geo = 'XVx'

if 'XYVxVy' in str(args.data_dir):
elif 'XYVxVy' in str(args.data_dir):
data_structure_name='data_structure_XYVxVy.yaml'
multid = True
geo= 'XYVxVy'

else:
raise NotImplementedError(f"Geometry {args.data_dir} is not handled")

# Load data
ds = DiskStore(args.data_dir,data_structure=Path(data_structure_name))
if not multid:
# Separate treatement depending on number of dimensions
if geo=='XVx':
epot = ds['electrostatic_potential']
epot = epot.isel(x=int(epot.sizes["x"] / 2))
epot = epot.integrate('x')
if geo=='XYVxVy':
two_dim_epot = ds['electrostatic_potential']
epot = two_dim_epot.integrate('x').integrate('y')

epot = epot.isel(time=slice(args.start, args.end))

Expand Down
2 changes: 1 addition & 1 deletion tests/check_growthrate_freq_2d_cart.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# Compute and plot the growth (or damping) rate
(fitted_values, fit,growthrate_computed, valid_growthrate) = Ediag.compute_growthrate(mean_pot,args.growthrate)
growthrate_outfile = Path(f'growthrate_t{epot.coords["time"].values[0]}'f'to{epot.coords["time"].values[-1]}.png')
Ediag.plot_growthrate(growthrate_outfile,mean_pot, fitted_values, fit,
Ediag.plot_growthrate(growthrate_outfile,abs(mean_pot), fitted_values, fit,
growthrate_computed, args.growthrate)

# Compute and plot the frequency
Expand Down

0 comments on commit 72b12c4

Please sign in to comment.