summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hoffmann <volker@cheleb.net>2013-08-18 12:00:52 +0200
committerVolker Hoffmann <volker@cheleb.net>2013-08-18 12:00:52 +0200
commit4a7be90a59a7a79a605e8f0b22e5f1224139c432 (patch)
tree279a0d23f13bb4c70f27901c28a68d89231613fa
parentb96b58a2e8039536a40dfa346834c7a5f5091af9 (diff)
read/save/load boundary conditions from sims
-rw-r--r--DiskXYZ.py31
1 files changed, 29 insertions, 2 deletions
diff --git a/DiskXYZ.py b/DiskXYZ.py
index 8b171d6..e2f070f 100644
--- a/DiskXYZ.py
+++ b/DiskXYZ.py
@@ -12,7 +12,7 @@ Plots Reduced F(X,Y), F(R) Data.
@todo - Save plots.
Volker Hoffmann <volker@cheleb.net>
-17 August 2013
+18 August 2013
"""
from pymses import RamsesOutput
@@ -92,6 +92,12 @@ class DiskBase():
self.ReM_mid_r = None
self.ReM_mid_r_max = None; self.ReM_mid_r_min = None
+ # Boundary Conditions
+ self.r_accrete = None
+ self.rho0 = None
+ self.rho0_frac_reset = None
+ self.rho0_frac_floor = None
+
# Output
self.iout = iout
# Sampling Volume, Options
@@ -190,6 +196,7 @@ class DiskIo(DiskBase):
self.init_rbins()
self.convert_velocities()
self.load_stats()
+ self.load_boundary_conditions()
def load_npz(self):
"""Load **Reduced** Data.."""
@@ -236,6 +243,22 @@ class DiskIo(DiskBase):
self.xe_mid_r = npz["xe_mid_r"]
self.n_mid_r = npz["n_mid_r"]
self.ReM_mid_r = npz["ReM_mid_r"]
+ self.r_accrete = npz["r_accrete"]
+ self.rho0 = npz["rho0"]
+ self.rho0_frac_reset = npz["rho0_frac_reset"]
+ self.rho0_frac_floor = npz["rho0_frac_floor"]
+
+ def load_boundary_conditions(self):
+ """Load Boundary Conditions."""
+ fpath = "output_%05d" % self.iout
+ fmydisk = "mydisk_%05d.txt" % self.iout
+ ff = "./%s/%s" % ( fpath, fmydisk )
+ with open(ff, 'r') as f:
+ lines = f.readlines()
+ self.r_accrete = float(lines[13].strip().split(" | ")[1])
+ self.rho0 = float(lines[14].strip().split(" | ")[1])
+ self.rho0_frac_reset = float(lines[15].strip().split(" | ")[1])
+ self.rho0_frac_floor = float(lines[16].strip().split(" | ")[1])
def load_stats(self):
"""Load Stats."""
@@ -363,7 +386,11 @@ class DiskIo(DiskBase):
n_mid_r = self.n_mid_r, \
n_mid_r_max = self.n_mid_r_max, n_mid_r_min = self.n_mid_r_min, \
ReM_mid_r = self.ReM_mid_r, \
- ReM_mid_r_max = self.ReM_mid_r_max, ReM_mid_r_min = self.ReM_mid_r_min \
+ ReM_mid_r_max = self.ReM_mid_r_max, ReM_mid_r_min = self.ReM_mid_r_min, \
+ r_accrete = self.r_accrete, \
+ rho0 = self.rho0, \
+ rho0_frac_reset = self.rho0_frac_reset, \
+ rho0_frac_floor = self.rho0_frac_floor \
)
class DiskReduceBase(DiskIo):