Moved fluidfoam to olaflow file
This commit is contained in:
parent
62af6a03ed
commit
4869c982bb
2 changed files with 20 additions and 5 deletions
|
@ -1,10 +1,15 @@
|
|||
import re
|
||||
|
||||
from fluidfoam import readof
|
||||
|
||||
|
||||
class OFModel:
|
||||
def __init__(self, root):
|
||||
self._root = root
|
||||
|
||||
def read_mesh(self):
|
||||
self._x, self._y, self._z = readof.readmesh(str(self._root))
|
||||
|
||||
def write_field(self, field, values):
|
||||
with open(self._root.joinpath("0", field), "r") as aw_file:
|
||||
aw_raw = aw_file.read()
|
||||
|
@ -19,3 +24,15 @@ class OFModel:
|
|||
flags=re.S,
|
||||
)
|
||||
)
|
||||
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
@property
|
||||
def y(self):
|
||||
return self._y
|
||||
|
||||
@property
|
||||
def z(self):
|
||||
return self._z
|
||||
|
|
|
@ -6,7 +6,6 @@ import re
|
|||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from fluidfoam import readof
|
||||
from scipy import interpolate
|
||||
|
||||
from .olaflow import OFModel
|
||||
|
@ -30,11 +29,10 @@ sws = np.load(sws_out.joinpath("sws.npz"))
|
|||
x, t = sws["x"], sws["t"]
|
||||
|
||||
olaflow_root = pathlib.Path(config.get("olaflow", "root"))
|
||||
of_x, of_y, of_z = mesh = readof.readmesh(str(olaflow_root))
|
||||
model = OFModel(olaflow_root)
|
||||
model.read_mesh()
|
||||
|
||||
watl = interpolate.interp1d(x, sws["watl"][680])
|
||||
alpha_water = np.where(model.z < watl(model.x), 1, 0)
|
||||
|
||||
alpha_water = np.where(of_z < watl(of_x), 1, 0)
|
||||
|
||||
model = OFModel(olaflow_root)
|
||||
model.write_field("alpha.water", alpha_water)
|
||||
|
|
Loading…
Reference in a new issue