Updated config
This commit is contained in:
parent
6ea7db1c34
commit
f1d61d0a4c
3 changed files with 15 additions and 12 deletions
|
@ -5,12 +5,13 @@ parser = argparse.ArgumentParser(
|
|||
)
|
||||
parser.add_argument('var', type=str,
|
||||
help='OpenFoam variable to display')
|
||||
parser.add_argument('-c', '--config', type=str,
|
||||
default='config.ini',
|
||||
help='Configuration file (default config.ini)')
|
||||
parser.add_argument('-c', '--config', type=Path, default='config.ini',
|
||||
help='configuration file (default config.ini)')
|
||||
parser.add_argument('-l', '--log-level', default='info', type=str,
|
||||
help='log level')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.var == 'alpha.water':
|
||||
import alpha_water
|
||||
alpha_water.animate(args.config)
|
||||
alpha_water.animate(args.config, args.log_level)
|
||||
|
|
|
@ -19,19 +19,21 @@ import pandas as pd
|
|||
mpl.use('agg')
|
||||
|
||||
import fluidfoam
|
||||
#import stl
|
||||
|
||||
def animate(config_path):
|
||||
def animate(config_path, log_level):
|
||||
tt0 = time()
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(config_path)
|
||||
|
||||
logging.basicConfig(
|
||||
filename=config.get('main', 'log_file', fallback=None),
|
||||
level=log_level
|
||||
)
|
||||
log = logging.getLogger('alpha_water')
|
||||
logging.basicConfig(encoding='utf-8', level=config['main']['logging'])
|
||||
log.info('Starting')
|
||||
|
||||
root = Path(config['main']['root']).expanduser()
|
||||
root = Path(config.get('main', 'root')).expanduser()
|
||||
|
||||
t = []
|
||||
|
||||
|
@ -61,13 +63,13 @@ def animate(config_path):
|
|||
alpha_water['y'] = mesh[2]
|
||||
|
||||
with pd.HDFStore(
|
||||
config['data']['path'],
|
||||
config.get('data', 'path'),
|
||||
mode='r',
|
||||
) as hdf:
|
||||
bathy = hdf.get('bathy')
|
||||
rubble = hdf.get('rubble')
|
||||
blocs = {}
|
||||
for bloc in config['data']['blocs'].split(','):
|
||||
for bloc in config.get('data', 'blocs', fallback='').split(','):
|
||||
blocs[bloc] = hdf.get(bloc)
|
||||
|
||||
log.info('Starting plot')
|
||||
|
@ -132,6 +134,6 @@ def animate(config_path):
|
|||
blit=True,
|
||||
repeat=True
|
||||
)
|
||||
ani.save(config['main']['out'])
|
||||
ani.save(config.get('main', 'out'))
|
||||
|
||||
log.info('Program ended successfully')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[main]
|
||||
logging = INFO
|
||||
root = /home/masterccce/OpenFOAM/work/artha
|
||||
out = out/anim.mp4
|
||||
#log_file = openfoam.log
|
||||
|
||||
[data]
|
||||
path = ../bathymetry/3_pd/data.hdf
|
||||
|
|
Reference in a new issue