-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Krook sink mask plottting for sheath
See merge request gysela-developpers/gyselalibxx!457 --------------------------------------------
- Loading branch information
1 parent
9ed158a
commit 4618edb
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
post-process/PythonScripts/geometryXVx/sheath/plot_krook_sink_mask
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# SPDX-License-Identifier: MIT | ||
"""Plots the mask M(x), constant or adaptive, of the Krook operator | ||
""" | ||
import os | ||
|
||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
|
||
from gysdata import DiskStore | ||
from plot_utils import plot_field1d | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = ArgumentParser( | ||
description='Plots the krook adaptive or constant sink mask') | ||
parser.add_argument('data_dir', | ||
action='store', | ||
nargs='?', | ||
default=Path.cwd(), | ||
type=Path, | ||
help='location of the results') | ||
parser.add_argument('--itime', | ||
action='store', | ||
default=-1, | ||
type=int, | ||
help='time index') | ||
|
||
args = parser.parse_args() | ||
|
||
# Load data | ||
# Load the DiskStore (to access the made calculations) | ||
path_data_structure = Path('data_structure_sheath.yaml') | ||
ds = DiskStore(args.data_dir, data_structure=path_data_structure) | ||
try: | ||
mask = ds['krook_sink_adaptive_mask'] | ||
mask_type = "adaptive" | ||
output_filename = os.path.join(Path.cwd(), f'{mask_type}_krook_sink_mask.png') | ||
plot_field1d({f'{mask_type}_krook_sink_mask': mask}, f'{mask_type}_krook_sink_mask', output_filename) | ||
except KeyError as e: | ||
print('Info: no adaptive krook sink in simulation:', e) | ||
try: | ||
mask = ds['krook_sink_constant_mask'] | ||
mask_type = "constant" | ||
output_filename = os.path.join(Path.cwd(), f'{mask_type}_krook_sink_mask.png') | ||
plot_field1d({f'{mask_type}_krook_sink_mask': mask}, f'{mask_type}_krook_sink_mask', output_filename) | ||
except KeyError as e: | ||
print('Info: no constant krook sink in simulation:', e) |