From ff5f1eb6eddfa74f96386b769508be3a924d03fe Mon Sep 17 00:00:00 2001 From: Noe Brucy Date: Tue, 5 Jan 2021 16:35:48 +0100 Subject: [PATCH] [comparator] [log extractor] distintiguish ramses_ism and old ramses --- comparator.py | 14 ++++++++------ pp_params.yml | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/comparator.py b/comparator.py index 405a61f..d2da32b 100644 --- a/comparator.py +++ b/comparator.py @@ -253,8 +253,8 @@ class Comparator(Aggregator, HDF5Container): return series def _extract_cons_from_log(self, series, log_filename, run): - mhd = self.pp_params.input.mhd - nlines = 2 + int(mhd) # Number of useful lines + rism = self.pp_params.input.ramses_ism + nlines = 2 + int(rism) # Number of useful lines cmd_grep = "grep 'Main step' {} -A {}".format(log_filename, nlines - 1) content = os.popen(cmd_grep).readlines() for i in range(0, len(content), nlines + 1): @@ -266,12 +266,14 @@ class Comparator(Aggregator, HDF5Container): series["econs"][run].append(np.float(content[i].split("=")[3].split()[0])) series["epot"][run].append(np.float(content[i].split("=")[4].split()[0])) series["ekin"][run].append(np.float(content[i].split("=")[5].split()[0])) - series["eint"][run].append(np.float(content[i].split("=")[6].split()[0])) - if mhd: + if rism: + eint = np.float(content[i].split("=")[6].split()[0]) emag = np.float(content[i + 1].split("=")[1].split()[0]) - series["emag"][run].append(emag) else: - series["emag"][run].append(0.0) + eint = 0.0 + emag = 0.0 + series["eint"][run].append(eint) + series["emag"][run].append(emag) return series def _extract_rms_from_log(self, series, log_filename, run): diff --git a/pp_params.yml b/pp_params.yml index 3e6c2fb..903c1c7 100644 --- a/pp_params.yml +++ b/pp_params.yml @@ -67,7 +67,7 @@ input: # Parameters on how to look for input files (= output from Ramses) log_prefix : "run.log" # Prefix of the log file label_filename : "label.txt" # Name of the label file nml_filename : "run.nml" # name of the namelist file - mhd : True # Is MHD activated + ramses_ism : True # If ramses-ism is used out: # Parameters for post processing tag : "" # Tag for the image