Minor tweaks
This commit is contained in:
parent
e90f8518c0
commit
6c00ca117e
2 changed files with 29 additions and 12 deletions
15
README.md
15
README.md
|
@ -8,14 +8,29 @@ in 2017.
|
|||
The `bathymetry` directory contains the raw data and a tool that allows to
|
||||
generate the stl files necessary for the OpenFoam model.
|
||||
|
||||
Usage:
|
||||
```
|
||||
python -m generate
|
||||
```
|
||||
|
||||
### OpenFoam
|
||||
The `openfoam` directory contains the OpenFoam configuration files and a
|
||||
utility that copies the configuration and runs the `olaFlow` model.
|
||||
|
||||
Usage:
|
||||
```
|
||||
python -m run
|
||||
```
|
||||
|
||||
### Post-process
|
||||
The `post_process` directory provides a utility for plotting an animation of
|
||||
the simulation.
|
||||
|
||||
Usage:
|
||||
```
|
||||
python -m animate alpha.water
|
||||
```
|
||||
|
||||
## Requirements
|
||||
The required Python packages are listed in the `requirements.txt` file.
|
||||
Run `pip install -r requirements.txt` to install all the required packages.
|
||||
|
|
|
@ -16,10 +16,11 @@ from .run import run
|
|||
|
||||
_t0 = time()
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Run the OpenFoam simulation'
|
||||
prog='run',
|
||||
description='Run the OpenFoam simulation',
|
||||
)
|
||||
parser.add_argument('-c', '--config', default='config.ini', type=Path,
|
||||
help='Configuration file (default config.ini)')
|
||||
help='Configuration file')
|
||||
parser.add_argument('-l', '--log-level', default='INFO', type=str,
|
||||
help='Log level')
|
||||
|
||||
|
@ -37,16 +38,6 @@ log = logging.getLogger('openfoam')
|
|||
log.info('Starting program')
|
||||
|
||||
|
||||
def step(command, alias=None):
|
||||
if alias == None: alias = command
|
||||
log.info(f'Running {alias}')
|
||||
code = run(command, case_dir, alias)
|
||||
if code != 0:
|
||||
log.error(f'{alias} failed')
|
||||
sys.exit(code)
|
||||
log.info(f'{alias} finished successfully')
|
||||
|
||||
|
||||
if config.getboolean('grafana', 'pause', fallback=False):
|
||||
log.info('Silencing Grafana alert')
|
||||
grafana = Silencer(
|
||||
|
@ -71,6 +62,17 @@ if case_dir.exists():
|
|||
log.info(f'Copying case ({input_dir} -> {case_dir})')
|
||||
shutil.copytree(input_dir, case_dir)
|
||||
|
||||
|
||||
def step(command, alias=None):
|
||||
if alias == None: alias = command
|
||||
log.info(f'Running {alias}')
|
||||
code = run(command, case_dir, alias)
|
||||
if code != 0:
|
||||
log.error(f'{alias} failed')
|
||||
sys.exit(code)
|
||||
log.info(f'{alias} finished successfully')
|
||||
|
||||
|
||||
if config.getboolean('stl', 'copy', fallback=False):
|
||||
stl_in = Path(config.get('stl', 'from')).expanduser()
|
||||
if not stl_in.exists():
|
||||
|
|
Reference in a new issue