1
Fork 0

Remove useless python run_ola

This commit is contained in:
Edgar P. Burkhart 2022-04-11 16:07:28 +02:00
parent 02c8586672
commit 61b22a326f
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
1 changed files with 0 additions and 47 deletions

View File

@ -1,47 +0,0 @@
import argparse
import configparser
import logging
import os
import pathlib
import shutil
from subprocess import run, STDOUT
parser = argparse.ArgumentParser(description="Run olaFlow model")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-c", "--config", default="config.ini")
args = parser.parse_args()
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
log = logging.getLogger("sws_ola")
log.info("Starting olaFlow model")
config = configparser.ConfigParser()
config.read(args.config)
root = pathlib.Path(config.get("olaflow", "root"))
out = pathlib.Path(config.get("olaflow", "out"))
logs = out.joinpath("log")
shutil.copytree(root, out)
logs.mkdir()
path = config.get("olaflow", "path")
env = {"PATH": f"{path}:{os.environ['PATH']}"}
def ola_run(cmd):
with logs.joinpath(f"{cmd[0]}.log").open("wt") as logfile:
run(
cmd,
cwd=out,
env=env,
stdout=logfile,
stderr=STDOUT,
).check_returncode()
ola_run(("blockMesh",))
ola_run(("snappyHexMesh", "-overwrite"))
shutil.copytree(root.joinpath("0.org"), root.joinpath("0"))
ola_run(("setFields",))
ola_run(("decomposePar",))
ola_run(("mpirun", "-np", "4", "olaFlow", "-parallel"))
ola_run(("reconstructPar",))