Loading dakota_driver.py 0 → 100644 +88 −0 Original line number Diff line number Diff line #!/usr/bin/env python # Dakota will execute this script as # generic_driver.py params.in results.out # The command line arguments will be extracted by dakota.interfacing automatically. # necessary python modules import os import sys import json sys.path.insert(0, "/home/lpswile/Workbench-Linux/wasppy") sys.path.insert(0, "/projects/dakota/install/cts/intel/dakota-6.11.0.Linux.x86_64/share/dakota/Python/dakota") # dakota_install/share/dakota/Python/dakota import waspdrive # Workbench Analysis Sequence Processor driver module from interfacing import interfacing as di # Dakota's interface module # ---------------------------- # Parse Dakota parameters file # ---------------------------- params, results = di.read_parameters_file() #dump params to external params.json file for future use by the template engine params_for_template_engine_file_path = "params.json" with open(params_for_template_engine_file_path, 'w') as outfile: f=json.dump(params._variables, outfile, default=lambda o: o.__dict__) #note that in object params, _variables is an OrderedDict #params.descriptors will output this ordered _variables # ------------------------------- # Pre-processing # Convert and send to application # Or copy parameters into template to generate input file # ------------------------------- # Set up the data structures continuous_vars = [params[k] for k in params.descriptors] #continuous_vars are defined in dakota .in file as cdv_descriptor active_set_vector = 0 # Alternatively, the ASV can be accessed by index in # function, gradient, hessian order #for i, bit in enumerate(results["obj_fn"].asv): # if bit: # active_set_vector += 1 << i # Obtain the drive module's input # This file contains the application information and extraction logic import glob driver_inputs = glob.glob("*.drive") if len(driver_inputs) == 0: raise ValueError("Unable to find drive file in "+os.getcwd()+"; did you forget to copy or link the file?") driver_document = waspdrive.process_drive_input(driver_inputs[0]) rtncode=waspdrive.run_external_app(driver_document, params_for_template_engine_file_path) #follow the logic in ddi file to extract required responses res_output=waspdrive.extract_results(driver_document) retval = dict([]) retval['fns']=res_output # ---------------------------- # Return the results to Dakota # ---------------------------- # Insert extracted values into results # Results iterator provides an index, response name, and response try: for i, n, r in results: if r.asv.function: try: r.function = retval['fns'][i] except: pass # Catch Dakota 6.9 exception where results interface has changed # ValueError: too many values to unpack except ValueError: i = 0 for n, r in results.items(): r.function = retval['fns'][i] i+=1 results.write() #dump to external results.json file with open('results.json', 'w') as outfile: rst=json.dump(results, outfile, default=lambda o: o.__dict__) expPoints.txt 0 → 100644 +43 −0 Original line number Diff line number Diff line 42 0.001906324 0.0 3.0 0.017365762 0.0 3.0 0.032831077 0.0 3.0 0.048290515 0.0 3.0 0.07148555 0.0 3.0 0.094680584 0.0 3.0 0.125605338 0.0 3.0 0.156530091 0.0 3.0 0.187454844 0.0 3.0 0.218379598 0.0 3.0 0.249304351 0.0 3.0 0.280229105 0.0 3.0 0.311153858 0.0 3.0 0.337664148 0.0 3.0 0.360430081 0.0 3.0 0.379980685 0.0 3.0 0.396780333 0.0 3.0 0.411199344 0.0 3.0 0.423584529 0.0 3.0 0.434223914 0.0 3.0 0.443352623 0.0 3.0 0.451194026 0.0 3.0 0.457935046 0.0 3.0 0.463717346 0.0 3.0 0.468683176 0.0 3.0 0.472957153 0.0 3.0 0.476618629 0.0 3.0 0.479761656 0.0 3.0 0.482464413 0.0 3.0 0.484789794 0.0 3.0 0.486785414 0.0 3.0 0.488482425 0.0 3.0 0.489943724 0.0 3.0 0.491201052 0.0 3.0 0.492269693 0.0 3.0 0.493196672 0.0 3.0 0.493998446 0.0 3.0 0.4946739 0.0 3.0 0.495255246 0.0 3.0 0.495742365 0.0 3.0 0.496166706 0.0 3.0 0.496512339 0.0 3.0 longPipeRe31k.txt 0 → 100644 +45 −0 Original line number Diff line number Diff line non dimensional non-dimensional test velocity wall distance 0.368060173 0.003487661 0.388975193 0.003833294 0.420099889 0.004257635 0.451364665 0.004744754 0.477144771 0.0053261 0.510769356 0.006001554 0.544695652 0.006803328 0.577021804 0.007730307 0.613711986 0.008798948 0.642266753 0.010056276 0.664679551 0.011517575 0.689678441 0.013214586 0.714731209 0.015210206 0.736012592 0.017535587 0.762735544 0.020238344 0.783801419 0.023381371 0.800233879 0.027042847 0.81962957 0.031316824 0.831590246 0.036282654 0.851955722 0.042064954 0.875122797 0.048805974 0.891878519 0.056647377 0.905293872 0.065776086 0.927922178 0.076415471 0.960194452 0.088800656 0.976519159 0.103219667 1.001464172 0.120019315 1.01811214 0.139569919 1.051839092 0.162335852 1.074467398 0.188846142 1.100974842 0.219770895 1.127428409 0.250695649 1.149679577 0.281620402 1.170853206 0.312545156 1.191218681 0.343469909 1.208459296 0.374394662 1.221874648 0.405319416 1.230387202 0.42851445 1.237552832 0.451709485 1.241324216 0.467168923 1.240623816 0.482634238 1.241324216 0.498093676 No newline at end of file multidim_parameter_study.in 0 → 100644 +51 −0 Original line number Diff line number Diff line # DAKOTA INPUT FILE: multidimensional parameter study environment tabular_graphics_data tabular_graphics_file = 'multidim_param_study_tabular_output' method multidim_parameter_study partition 2 5 2 variables active all discrete_uncertain_set integer 2 num_set_values 3 6 set_values 5 10 15 4 6 8 10 12 14 descriptor 'filterWeight' 'lx1' real 1 num_set_values 3 set_values 0.1 0.5 0.9 descriptor 'filterCutoffRatio' interface analysis_drivers = 'python dakota_driver.py' fork work_directory named 'pipe_workdir' directory_tag directory_save copy_files = "pipe_3840.re2" "pipe_3840.tmpl" "pipe_3840_31000.fld" "dakota_driver.py" "pipe_3840.drive" "pipe_3840.txt" "test.py" "expPoints.txt" "longPipeRe31k.txt" "script-postprocess.py" replace parameters_file = 'params.in' results_file = 'results.out' file_save file_tag asynchronous evaluation_concurrency = 4 responses response_functions = 2 descriptors = 'L2_error_norm' 'Friction_velocity' no_gradients no_hessians multidim_parameter_study_tabular_output 0 → 100644 +55 −0 Original line number Diff line number Diff line %eval_id interface filterWeight lx1 filterCutoffRatio L2_error_norm Friction_velocity 1 NO_ID 5 4 0.1 7.69141E-01 5.30724E-02 2 NO_ID 10 4 0.1 7.93254E-01 5.43443E-02 3 NO_ID 15 4 0.1 8.03741E-01 5.48011E-02 4 NO_ID 5 6 0.1 8.96994E-01 3.70148E-02 5 NO_ID 10 6 0.1 1.21345E+00 3.21973E-02 6 NO_ID 15 6 0.1 1.37012E+00 2.96943E-02 7 NO_ID 5 8 0.1 6.68936E-01 4.13587E-02 8 NO_ID 10 8 0.1 7.64389E-01 4.02307E-02 9 NO_ID 15 8 0.1 7.37930E-01 4.00737E-02 10 NO_ID 5 10 0.1 6.58417E-01 4.57216E-02 11 NO_ID 10 10 0.1 9.07838E-01 4.23209E-02 12 NO_ID 15 10 0.1 1.32545E+00 3.96272E-02 13 NO_ID 5 12 0.1 3.54392E-01 5.00135E-02 14 NO_ID 10 12 0.1 5.06743E-01 4.80353E-02 15 NO_ID 15 12 0.1 4.80349E-01 4.66883E-02 16 NO_ID 5 14 0.1 2.31134E-01 5.46385E-02 17 NO_ID 10 14 0.1 2.11848E-01 5.42959E-02 18 NO_ID 15 14 0.1 2.34419E-01 5.43871E-02 19 NO_ID 5 4 0.5 4.77275E-01 4.79850E-02 20 NO_ID 10 4 0.5 6.34830E-01 4.69166E-02 21 NO_ID 15 4 0.5 7.59374E-01 4.66617E-02 22 NO_ID 5 6 0.5 1.71939E-01 5.35463E-02 23 NO_ID 10 6 0.5 1.90348E-01 5.35463E-02 24 NO_ID 15 6 0.5 2.79961E-01 5.10808E-02 25 NO_ID 5 8 0.5 7.37100E-02 5.71283E-02 26 NO_ID 10 8 0.5 1.05316E-01 5.72736E-02 27 NO_ID 15 8 0.5 1.51721E-01 5.77325E-02 28 NO_ID 5 10 0.5 4.24788E-01 4.86497E-02 29 NO_ID 10 10 0.5 6.04053E-01 4.75098E-02 30 NO_ID 15 10 0.5 7.04380E-01 4.77568E-02 31 NO_ID 5 12 0.5 1.81086E-01 5.32386E-02 32 NO_ID 10 12 0.5 1.87085E-01 5.21777E-02 33 NO_ID 15 12 0.5 2.12426E-01 5.17184E-02 34 NO_ID 5 14 0.5 1.34090E-01 5.53040E-02 35 NO_ID 10 14 0.5 8.16510E-02 5.51992E-02 36 NO_ID 15 14 0.5 1.41064E-01 5.54050E-02 37 NO_ID 5 4 0.9 3.62988E-01 4.95526E-02 38 NO_ID 10 4 0.9 4.92948E-01 4.77818E-02 39 NO_ID 15 4 0.9 5.88040E-01 4.75678E-02 40 NO_ID 5 6 0.9 1.75682E-01 5.35020E-02 41 NO_ID 10 6 0.9 1.96688E-01 5.28538E-02 42 NO_ID 15 6 0.9 2.04472E-01 5.24993E-02 43 NO_ID 5 8 0.9 1.82511E-01 5.46056E-02 44 NO_ID 10 8 0.9 1.16198E-01 5.44259E-02 45 NO_ID 15 8 0.9 2.14883E-01 5.44587E-02 46 NO_ID 5 10 0.9 2.99194E-01 5.03820E-02 47 NO_ID 10 10 0.9 4.90367E-01 4.83177E-02 48 NO_ID 15 10 0.9 5.05702E-01 4.76392E-02 49 NO_ID 5 12 0.9 1.72010E-01 5.41159E-02 50 NO_ID 10 12 0.9 1.75616E-01 5.37207E-02 51 NO_ID 15 12 0.9 1.55308E-01 5.33594E-02 52 NO_ID 5 14 0.9 1.65381E-01 5.50859E-02 53 NO_ID 10 14 0.9 1.92710E-01 5.47444E-02 54 NO_ID 15 14 0.9 1.50911E-01 5.47608E-02 Loading
dakota_driver.py 0 → 100644 +88 −0 Original line number Diff line number Diff line #!/usr/bin/env python # Dakota will execute this script as # generic_driver.py params.in results.out # The command line arguments will be extracted by dakota.interfacing automatically. # necessary python modules import os import sys import json sys.path.insert(0, "/home/lpswile/Workbench-Linux/wasppy") sys.path.insert(0, "/projects/dakota/install/cts/intel/dakota-6.11.0.Linux.x86_64/share/dakota/Python/dakota") # dakota_install/share/dakota/Python/dakota import waspdrive # Workbench Analysis Sequence Processor driver module from interfacing import interfacing as di # Dakota's interface module # ---------------------------- # Parse Dakota parameters file # ---------------------------- params, results = di.read_parameters_file() #dump params to external params.json file for future use by the template engine params_for_template_engine_file_path = "params.json" with open(params_for_template_engine_file_path, 'w') as outfile: f=json.dump(params._variables, outfile, default=lambda o: o.__dict__) #note that in object params, _variables is an OrderedDict #params.descriptors will output this ordered _variables # ------------------------------- # Pre-processing # Convert and send to application # Or copy parameters into template to generate input file # ------------------------------- # Set up the data structures continuous_vars = [params[k] for k in params.descriptors] #continuous_vars are defined in dakota .in file as cdv_descriptor active_set_vector = 0 # Alternatively, the ASV can be accessed by index in # function, gradient, hessian order #for i, bit in enumerate(results["obj_fn"].asv): # if bit: # active_set_vector += 1 << i # Obtain the drive module's input # This file contains the application information and extraction logic import glob driver_inputs = glob.glob("*.drive") if len(driver_inputs) == 0: raise ValueError("Unable to find drive file in "+os.getcwd()+"; did you forget to copy or link the file?") driver_document = waspdrive.process_drive_input(driver_inputs[0]) rtncode=waspdrive.run_external_app(driver_document, params_for_template_engine_file_path) #follow the logic in ddi file to extract required responses res_output=waspdrive.extract_results(driver_document) retval = dict([]) retval['fns']=res_output # ---------------------------- # Return the results to Dakota # ---------------------------- # Insert extracted values into results # Results iterator provides an index, response name, and response try: for i, n, r in results: if r.asv.function: try: r.function = retval['fns'][i] except: pass # Catch Dakota 6.9 exception where results interface has changed # ValueError: too many values to unpack except ValueError: i = 0 for n, r in results.items(): r.function = retval['fns'][i] i+=1 results.write() #dump to external results.json file with open('results.json', 'w') as outfile: rst=json.dump(results, outfile, default=lambda o: o.__dict__)
expPoints.txt 0 → 100644 +43 −0 Original line number Diff line number Diff line 42 0.001906324 0.0 3.0 0.017365762 0.0 3.0 0.032831077 0.0 3.0 0.048290515 0.0 3.0 0.07148555 0.0 3.0 0.094680584 0.0 3.0 0.125605338 0.0 3.0 0.156530091 0.0 3.0 0.187454844 0.0 3.0 0.218379598 0.0 3.0 0.249304351 0.0 3.0 0.280229105 0.0 3.0 0.311153858 0.0 3.0 0.337664148 0.0 3.0 0.360430081 0.0 3.0 0.379980685 0.0 3.0 0.396780333 0.0 3.0 0.411199344 0.0 3.0 0.423584529 0.0 3.0 0.434223914 0.0 3.0 0.443352623 0.0 3.0 0.451194026 0.0 3.0 0.457935046 0.0 3.0 0.463717346 0.0 3.0 0.468683176 0.0 3.0 0.472957153 0.0 3.0 0.476618629 0.0 3.0 0.479761656 0.0 3.0 0.482464413 0.0 3.0 0.484789794 0.0 3.0 0.486785414 0.0 3.0 0.488482425 0.0 3.0 0.489943724 0.0 3.0 0.491201052 0.0 3.0 0.492269693 0.0 3.0 0.493196672 0.0 3.0 0.493998446 0.0 3.0 0.4946739 0.0 3.0 0.495255246 0.0 3.0 0.495742365 0.0 3.0 0.496166706 0.0 3.0 0.496512339 0.0 3.0
longPipeRe31k.txt 0 → 100644 +45 −0 Original line number Diff line number Diff line non dimensional non-dimensional test velocity wall distance 0.368060173 0.003487661 0.388975193 0.003833294 0.420099889 0.004257635 0.451364665 0.004744754 0.477144771 0.0053261 0.510769356 0.006001554 0.544695652 0.006803328 0.577021804 0.007730307 0.613711986 0.008798948 0.642266753 0.010056276 0.664679551 0.011517575 0.689678441 0.013214586 0.714731209 0.015210206 0.736012592 0.017535587 0.762735544 0.020238344 0.783801419 0.023381371 0.800233879 0.027042847 0.81962957 0.031316824 0.831590246 0.036282654 0.851955722 0.042064954 0.875122797 0.048805974 0.891878519 0.056647377 0.905293872 0.065776086 0.927922178 0.076415471 0.960194452 0.088800656 0.976519159 0.103219667 1.001464172 0.120019315 1.01811214 0.139569919 1.051839092 0.162335852 1.074467398 0.188846142 1.100974842 0.219770895 1.127428409 0.250695649 1.149679577 0.281620402 1.170853206 0.312545156 1.191218681 0.343469909 1.208459296 0.374394662 1.221874648 0.405319416 1.230387202 0.42851445 1.237552832 0.451709485 1.241324216 0.467168923 1.240623816 0.482634238 1.241324216 0.498093676 No newline at end of file
multidim_parameter_study.in 0 → 100644 +51 −0 Original line number Diff line number Diff line # DAKOTA INPUT FILE: multidimensional parameter study environment tabular_graphics_data tabular_graphics_file = 'multidim_param_study_tabular_output' method multidim_parameter_study partition 2 5 2 variables active all discrete_uncertain_set integer 2 num_set_values 3 6 set_values 5 10 15 4 6 8 10 12 14 descriptor 'filterWeight' 'lx1' real 1 num_set_values 3 set_values 0.1 0.5 0.9 descriptor 'filterCutoffRatio' interface analysis_drivers = 'python dakota_driver.py' fork work_directory named 'pipe_workdir' directory_tag directory_save copy_files = "pipe_3840.re2" "pipe_3840.tmpl" "pipe_3840_31000.fld" "dakota_driver.py" "pipe_3840.drive" "pipe_3840.txt" "test.py" "expPoints.txt" "longPipeRe31k.txt" "script-postprocess.py" replace parameters_file = 'params.in' results_file = 'results.out' file_save file_tag asynchronous evaluation_concurrency = 4 responses response_functions = 2 descriptors = 'L2_error_norm' 'Friction_velocity' no_gradients no_hessians
multidim_parameter_study_tabular_output 0 → 100644 +55 −0 Original line number Diff line number Diff line %eval_id interface filterWeight lx1 filterCutoffRatio L2_error_norm Friction_velocity 1 NO_ID 5 4 0.1 7.69141E-01 5.30724E-02 2 NO_ID 10 4 0.1 7.93254E-01 5.43443E-02 3 NO_ID 15 4 0.1 8.03741E-01 5.48011E-02 4 NO_ID 5 6 0.1 8.96994E-01 3.70148E-02 5 NO_ID 10 6 0.1 1.21345E+00 3.21973E-02 6 NO_ID 15 6 0.1 1.37012E+00 2.96943E-02 7 NO_ID 5 8 0.1 6.68936E-01 4.13587E-02 8 NO_ID 10 8 0.1 7.64389E-01 4.02307E-02 9 NO_ID 15 8 0.1 7.37930E-01 4.00737E-02 10 NO_ID 5 10 0.1 6.58417E-01 4.57216E-02 11 NO_ID 10 10 0.1 9.07838E-01 4.23209E-02 12 NO_ID 15 10 0.1 1.32545E+00 3.96272E-02 13 NO_ID 5 12 0.1 3.54392E-01 5.00135E-02 14 NO_ID 10 12 0.1 5.06743E-01 4.80353E-02 15 NO_ID 15 12 0.1 4.80349E-01 4.66883E-02 16 NO_ID 5 14 0.1 2.31134E-01 5.46385E-02 17 NO_ID 10 14 0.1 2.11848E-01 5.42959E-02 18 NO_ID 15 14 0.1 2.34419E-01 5.43871E-02 19 NO_ID 5 4 0.5 4.77275E-01 4.79850E-02 20 NO_ID 10 4 0.5 6.34830E-01 4.69166E-02 21 NO_ID 15 4 0.5 7.59374E-01 4.66617E-02 22 NO_ID 5 6 0.5 1.71939E-01 5.35463E-02 23 NO_ID 10 6 0.5 1.90348E-01 5.35463E-02 24 NO_ID 15 6 0.5 2.79961E-01 5.10808E-02 25 NO_ID 5 8 0.5 7.37100E-02 5.71283E-02 26 NO_ID 10 8 0.5 1.05316E-01 5.72736E-02 27 NO_ID 15 8 0.5 1.51721E-01 5.77325E-02 28 NO_ID 5 10 0.5 4.24788E-01 4.86497E-02 29 NO_ID 10 10 0.5 6.04053E-01 4.75098E-02 30 NO_ID 15 10 0.5 7.04380E-01 4.77568E-02 31 NO_ID 5 12 0.5 1.81086E-01 5.32386E-02 32 NO_ID 10 12 0.5 1.87085E-01 5.21777E-02 33 NO_ID 15 12 0.5 2.12426E-01 5.17184E-02 34 NO_ID 5 14 0.5 1.34090E-01 5.53040E-02 35 NO_ID 10 14 0.5 8.16510E-02 5.51992E-02 36 NO_ID 15 14 0.5 1.41064E-01 5.54050E-02 37 NO_ID 5 4 0.9 3.62988E-01 4.95526E-02 38 NO_ID 10 4 0.9 4.92948E-01 4.77818E-02 39 NO_ID 15 4 0.9 5.88040E-01 4.75678E-02 40 NO_ID 5 6 0.9 1.75682E-01 5.35020E-02 41 NO_ID 10 6 0.9 1.96688E-01 5.28538E-02 42 NO_ID 15 6 0.9 2.04472E-01 5.24993E-02 43 NO_ID 5 8 0.9 1.82511E-01 5.46056E-02 44 NO_ID 10 8 0.9 1.16198E-01 5.44259E-02 45 NO_ID 15 8 0.9 2.14883E-01 5.44587E-02 46 NO_ID 5 10 0.9 2.99194E-01 5.03820E-02 47 NO_ID 10 10 0.9 4.90367E-01 4.83177E-02 48 NO_ID 15 10 0.9 5.05702E-01 4.76392E-02 49 NO_ID 5 12 0.9 1.72010E-01 5.41159E-02 50 NO_ID 10 12 0.9 1.75616E-01 5.37207E-02 51 NO_ID 15 12 0.9 1.55308E-01 5.33594E-02 52 NO_ID 5 14 0.9 1.65381E-01 5.50859E-02 53 NO_ID 10 14 0.9 1.92710E-01 5.47444E-02 54 NO_ID 15 14 0.9 1.50911E-01 5.47608E-02