anisotropy/openfoam/meshManipulation.py
L-Nafaryus 3d4e7abb66 Massive improvement
New: few control args
Mod: struct to dict conversion
New: configuration for flow
Fix: missed logs from openfoam package (checkMesh, etc)
2021-06-07 17:09:32 +05:00

39 lines
1.0 KiB
Python

from .application import application
import re
def createPatch(dictfile: str = None, case: str = None):
args = ["-overwrite"]
if dictfile:
args.extend(["-dict", dictfile])
application("createPatch", *args, case = case, stderr = True)
def transformPoints(scale, case: str = None):
_scale = f"({ scale[0] } { scale[1] } { scale[2] })"
application("transformPoints", "-scale", _scale, case = case, stderr = True)
def checkMesh(case: str = None) -> str:
application("checkMesh", "-allGeometry", "-allTopology", case = case, stderr = True)
out = ""
with open("checkMesh.log", "r") as io:
warnings = []
for line in io:
if re.search("\*\*\*", line):
warnings.append(line.replace("***", "").strip())
if warnings:
out = "checkMesh:\n\t{}".format("\n\t".join(warnings))
return out
def renumberMesh(case: str = None):
application("renumberMesh", "-parallel", "-overwrite", useMPI = True, case = case, stderr = True)