anisotropy/openfoam/solvers.py
L-Nafaryus 4c18dc1b33 Working version
New: openfoam as package
Mod: logging
Fix: checking environment
New: virtual environment for python
2021-05-31 17:12:31 +05:00

20 lines
542 B
Python

from .application import application
import re
def potentialFoam(case: str = None):
application("potentialFoam", "-parallel", useMPI = True, case = case, stderr = True)
def simpleFoam(case: str = None):
_, returncode = application("simpleFoam", "-parallel", useMPI = True, case = case, stderr = True)
out = ""
with open("simpleFoam.log", "r") as io:
for line in io:
if re.search("solution converged", line):
out = "simpleFoam:\n\t{}".format(line.strip())
return returncode, out