Skip to content

Commit

Permalink
Krook sink mask plottting for sheath
Browse files Browse the repository at this point in the history
See merge request gysela-developpers/gyselalibxx!457

--------------------------------------------
  • Loading branch information
EmilyBourne committed May 3, 2024
1 parent 9ed158a commit 4618edb
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions post-process/PythonScripts/geometryXVx/sheath/plot_krook_sink_mask
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)

0 comments on commit 4618edb

Please sign in to comment.