23 lines
494 B
Python
23 lines
494 B
Python
|
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)
|
||
|
|
||
|
|