From 4618edb14169551a33c33bb887e1a1cb284f57bd Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Fri, 3 May 2024 13:15:14 +0000 Subject: [PATCH] Krook sink mask plottting for sheath See merge request gysela-developpers/gyselalibxx!457 -------------------------------------------- --- .../geometryXVx/sheath/plot_krook_sink_mask | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 post-process/PythonScripts/geometryXVx/sheath/plot_krook_sink_mask diff --git a/post-process/PythonScripts/geometryXVx/sheath/plot_krook_sink_mask b/post-process/PythonScripts/geometryXVx/sheath/plot_krook_sink_mask new file mode 100755 index 000000000..76080c3a4 --- /dev/null +++ b/post-process/PythonScripts/geometryXVx/sheath/plot_krook_sink_mask @@ -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)