This repository has been archived on 2022-02-01. You can view files and clone it, but cannot push or open issues or pull requests.
openfoam_project/openfoam/run/blockmesh.py

23 lines
494 B
Python
Raw Normal View History

2022-01-26 18:08:17 +01:00
import subprocess as sp
import logging
def blockmesh(case_dir):
blockmesh_log = logging.getLogger('blockMesh')
proc = sp.Popen(
('blockMesh'),
cwd=case_dir,
stdout=sp.PIPE,
stderr=sp.PIPE,
text=True,
)
for line in proc.stdout:
blockmesh_log.info(line[:-1])
for line in proc.stderr:
blockmesh_log.error(line[:-1])
code = proc.wait()
if code != 0:
log.error('blockMesh failed')
sys.exit(code)