This commit is contained in:
Edgar P. Burkhart 2022-03-28 10:15:36 +02:00
parent 71049d49ea
commit ba675fb763
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
68 changed files with 5727 additions and 204 deletions

View file

@ -1,3 +1,38 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2ec88dc3c20627b5f6d383e748ac7876415cacd4aff2cce3cb39bfdeb713b858
size 857
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()
with open(self._root.joinpath("0", field), "w") as aw_file:
aw_file.write(
re.sub(
r"(?<=\(\n).*?(?=\n\))",
"\n".join(values.astype(str)),
aw_raw,
count=1,
flags=re.S,
)
)
@property
def x(self):
return self._x
@property
def y(self):
return self._y
@property
def z(self):
return self._z