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
|
The `bathymetry` directory contains the raw data and a tool that allows to
|
||||||
generate the stl files necessary for the OpenFoam model.
|
generate the stl files necessary for the OpenFoam model.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
python -m generate
|
||||||
|
```
|
||||||
|
|
||||||
### OpenFoam
|
### OpenFoam
|
||||||
The `openfoam` directory contains the OpenFoam configuration files and a
|
The `openfoam` directory contains the OpenFoam configuration files and a
|
||||||
utility that copies the configuration and runs the `olaFlow` model.
|
utility that copies the configuration and runs the `olaFlow` model.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
python -m run
|
||||||
|
```
|
||||||
|
|
||||||
### Post-process
|
### Post-process
|
||||||
The `post_process` directory provides a utility for plotting an animation of
|
The `post_process` directory provides a utility for plotting an animation of
|
||||||
the simulation.
|
the simulation.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
python -m animate alpha.water
|
||||||
|
```
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
The required Python packages are listed in the `requirements.txt` file.
|
The required Python packages are listed in the `requirements.txt` file.
|
||||||
Run `pip install -r requirements.txt` to install all the required packages.
|
Run `pip install -r requirements.txt` to install all the required packages.
|
||||||
|
|
|
@ -16,10 +16,11 @@ from .run import run
|
||||||
|
|
||||||
_t0 = time()
|
_t0 = time()
|
||||||
parser = argparse.ArgumentParser(
|
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,
|
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,
|
parser.add_argument('-l', '--log-level', default='INFO', type=str,
|
||||||
help='Log level')
|
help='Log level')
|
||||||
|
|
||||||
|
@ -37,16 +38,6 @@ log = logging.getLogger('openfoam')
|
||||||
log.info('Starting program')
|
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):
|
if config.getboolean('grafana', 'pause', fallback=False):
|
||||||
log.info('Silencing Grafana alert')
|
log.info('Silencing Grafana alert')
|
||||||
grafana = Silencer(
|
grafana = Silencer(
|
||||||
|
@ -71,6 +62,17 @@ if case_dir.exists():
|
||||||
log.info(f'Copying case ({input_dir} -> {case_dir})')
|
log.info(f'Copying case ({input_dir} -> {case_dir})')
|
||||||
shutil.copytree(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):
|
if config.getboolean('stl', 'copy', fallback=False):
|
||||||
stl_in = Path(config.get('stl', 'from')).expanduser()
|
stl_in = Path(config.get('stl', 'from')).expanduser()
|
||||||
if not stl_in.exists():
|
if not stl_in.exists():
|
||||||
|
|
Reference in a new issue