anisotropy/openfoam/solvers.py

20 lines
542 B
Python
Raw Normal View History

from .application import application
2021-05-26 22:02:44 +05:00
import re
2021-05-26 17:18:39 +05:00
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)
2021-05-26 22:02:44 +05:00
out = ""
2021-05-26 17:18:39 +05:00
with open("simpleFoam.log", "r") as io:
for line in io:
if re.search("solution converged", line):
2021-05-26 22:02:44 +05:00
out = "simpleFoam:\n\t{}".format(line.strip())
2021-05-26 17:18:39 +05:00
2021-05-26 22:02:44 +05:00
return returncode, out
2021-05-26 17:18:39 +05:00