tAdded cons. of mass test and run function - ns2dfd - 2D finite difference Navi… | |
git clone git://src.adamsgaard.dk/ns2dfd | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 8dde47c85ef90b41df4d605fb96f55bce13628be | |
parent fb42d1dbafff951cfe8ca1a4dc6798e31b59b62b | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 4 Mar 2014 10:41:25 +0100 | |
Added cons. of mass test and run function | |
Diffstat: | |
A cons_of_mass.py | 7 +++++++ | |
M ns2dfd.py | 8 ++++++++ | |
2 files changed, 15 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/cons_of_mass.py b/cons_of_mass.py | |
t@@ -0,0 +1,7 @@ | |
+#!/usr/bin/env python | |
+import ns2dfd | |
+ | |
+sim = ns2dfd.fluid() | |
+sim.run() | |
+sim.read(sim.sim_id + '00004.dat') | |
+print(sim.P) | |
diff --git a/ns2dfd.py b/ns2dfd.py | |
t@@ -1,6 +1,7 @@ | |
#!/usr/bin/env python | |
import numpy | |
+import subprocess | |
class fluid: | |
t@@ -256,3 +257,10 @@ class fluid: | |
finally: | |
if fh is not None: | |
fh.close() | |
+ | |
+ def run(self): | |
+ ''' | |
+ Run the simulation using the C program. | |
+ ''' | |
+ self.write() | |
+ subprocess.call('./ns2dfd ' + self.sim_id + '.dat', shell=True) |