-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65080ec
commit fc1cbf8
Showing
3 changed files
with
74 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
In this directory, you will find several different example files for different purposes. | ||
|
||
- create_model_condfiguration.py: this example, create a configuration file, you can edit this configuration and then use it for the actual simulation such as in the run_simulation.py | ||
|
||
- run_simulation.py: this example uses a configuration file to run a simulation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import sys | ||
from pathlib import Path | ||
from os.path import realpath | ||
import argparse | ||
import logging | ||
for handler in logging.root.handlers[:]: | ||
logging.root.removeHandler(handler) | ||
|
||
logging.basicConfig(format='%(asctime)s %(message)s') | ||
logging.warning('is the time Pyflowline simulation started.') | ||
|
||
from pyflowline.pyflowline_generate_template_configuration_json_file import pyflowline_generate_template_configuration_json_file | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--sMesh_type", help = "sMesh_type", type = str) | ||
parser.add_argument("--iCase_index", help = "iCase_index", type = int) | ||
parser.add_argument("--dResolution_meter", help = "dResolution_meter", type = float) | ||
parser.add_argument("--sDate", help = "sDate", type = str) | ||
|
||
#example | ||
#python notebook.py --sMesh_type hexagon --iCase_index 1 --dResolution_meter 50000 --sDate 20220201 | ||
pArgs = parser.parse_args() | ||
if len(sys.argv) == 1: | ||
sMesh_type = 'mpas' | ||
iCase_index = 1 | ||
dResolution_meter=5000 | ||
sDate='20220308' | ||
else: | ||
if len(sys.argv)> 1: | ||
sMesh_type = pArgs.sMesh_type | ||
iCase_index = pArgs.iCase_index | ||
dResolution_meter=pArgs.dResolution_meter | ||
sDate = pArgs.sDate | ||
print(sMesh_type, iCase_index, dResolution_meter, sDate) | ||
else: | ||
print(len(sys.argv), 'Missing arguments') | ||
pass | ||
|
||
sPath = str( Path().resolve() ) | ||
iFlag_option = 1 | ||
sWorkspace_data = realpath( sPath + '/data/susquehanna' ) | ||
sWorkspace_input = str(Path(sWorkspace_data) / 'input') | ||
sWorkspace_output= str(Path(sWorkspace_data) / 'output') | ||
|
||
sFilename_configuration_in = realpath( sPath + '/tests/configurations/template.json' ) | ||
|
||
oPyflowline = pyflowline_generate_template_configuration_json_file(sFilename_configuration_in,\ | ||
sWorkspace_input, sWorkspace_output, iFlag_use_mesh_dem_in = 1,sMesh_type_in=sMesh_type, iCase_index_in = iCase_index, sDate_in = sDate) | ||
|
||
print(oPyflowline.tojson()) | ||
|
||
print('Finished') | ||
|
||
logging.basicConfig(format='%(asctime)s %(message)s') | ||
logging.warning('is the time Pyflowline simulation finished.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters