Moved snappyhexmesh to module, fixed blockmesh

This commit is contained in:
Edgar P. Burkhart 2022-01-26 18:12:15 +01:00
parent 2d9ac27812
commit 79b58cbaf0
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 7 additions and 20 deletions

View file

@ -16,6 +16,7 @@ import urllib.error
from .grafana import Silencer
from .stl import copy_stl
from .blockmesh import blockmesh
from .snappyhexmesh import snappyhexmesh
_t0 = time()
@ -75,24 +76,15 @@ if config.getboolean('stl', 'copy', fallback=False):
if config.getboolean('blockMesh', 'enable', fallback=False):
log.info('Running blockMesh')
blockmesh(case_dir)
code = blockmesh(case_dir)
if code != 0:
log.error('blockMesh failed')
sys.exit(code)
log.info(f'blockMesh finished successfully')
if config.getboolean('snappyHexMesh', 'enable', fallback=False):
log.info('Running snappyHexMesh')
snappy_log = logging.getLogger('snappyHexMesh')
proc = sp.Popen(
('snappyHexMesh', '-overwrite'),
cwd=case_dir,
stdout=sp.PIPE,
stderr=sp.PIPE,
text=True,
)
for line in proc.stdout:
snappy_log.info(line[:-1])
for line in proc.stderr:
snappy_log.error(line[:-1])
code = proc.wait()
code = snappyhexmesh(case_dir)
if code != 0:
log.error('snappyHexMesh failed')
sys.exit(code)

View file

@ -14,9 +14,4 @@ def blockmesh(case_dir):
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)
return proc.wait()