1 # Need: dprepro, python on path 2 3 # For debugging 4 #Set-PSDebug -Trace 1 5 6 # $1 and $2 are special variables in bash that contain the 1st and 2nd 7 # command line arguments to the script, which are the names of the 8 # Dakota parameters and results files, respectively. 9 10 $params=$args[0] 11 $results=$args[1] 12 13 ############################################################################### 14 ## 15 ## Pre-processing Phase -- Generate/configure an input file for your simulation 16 ## by substiting in parameter values from the Dakota paramters file. 17 ## 18 ############################################################################### 19 20 $pyprepro_py = (get-command "pyprepro").Path 21 python $pyprepro_py -I $params cantilever.template cantilever.i 22 23 ############################################################################### 24 ## 25 ## Execution Phase -- Run your simulation 26 ## 27 ############################################################################### 28 29 30 python ./cantilever cantilever.i > cantilever.log 31 32 ############################################################################### 33 ## 34 ## Post-processing Phase -- Extract (or calculate) quantities of interest 35 ## from your simulation's output and write them to a properly-formatted 36 ## Dakota results file. 37 ## 38 ############################################################################### 39 40 $mass = (type cantilever.log | select -Last 15 | select -First 1).Trim().Split(" ")[0] 41 $stress = (type cantilever.log | select -Last 11 | select -First 1).Trim().Split(" ")[0] 42 $displacement = (type cantilever.log | select -Last 7 | select -First 1).Trim().Split(" ")[0] 43 44 echo "$mass mass" | out-file -encoding ASCII $results 45 echo "$stress stress" | out-file -encoding ASCII -Append $results 46 echo "$displacement displacement" | out-file -encoding ASCII -Append $results 47