forked from idaholab/moose
-
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.
PEST version of bimaterial example added (idaholab#22220)
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 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,27 @@ | ||
pcf | ||
* control data | ||
restart estimation | ||
2 4 1 0 1 | ||
1 1 single point 1 0 0 | ||
10.0 2.0 0.3 0.03 10 | ||
5.0 5.0 0.001 | ||
0.1 | ||
100 0.01 4 3 0.01 3 | ||
0 0 0 | ||
* parameter groups | ||
p relative 0.01 0.0 switch 2.0 parabolic | ||
* parameter data | ||
ppktop none factor 2.0 0.1 20 p 1 0 1 | ||
ppkbot none factor 2.0 0.1 20 p 1 0 1 | ||
* observation groups | ||
obsgroup | ||
* observation data | ||
TTOPMID 0.138 1.0 obsgroup | ||
TBOTMID 0.040 1.0 obsgroup | ||
TBOTLEF 0.022 1.0 obsgroup | ||
TBOTRIG 0.022 1.0 obsgroup | ||
* model command line | ||
./run_model.py | ||
* model input/output | ||
pest_params.tpl pest_params.csv | ||
pest_instruction.ins pest_to_read.txt |
6 changes: 6 additions & 0 deletions
6
modules/optimization/examples/bimaterial/pest_instruction.ins
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,6 @@ | ||
pif @ | ||
@Data@ | ||
l1 [TTOPMID]1:25 | ||
l1 [TBOTMID]1:25 | ||
l1 [TBOTLEF]1:25 | ||
l1 [TBOTRIG]1:25 |
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,4 @@ | ||
ptf @ | ||
# This file was written by PEST | ||
# The following numbers are top diffisivity and bottom diffusivity | ||
@ppktop @,@ppkbot @ |
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,24 @@ | ||
#!/usr/bin/python3 | ||
import subprocess | ||
|
||
# because PEST operates on files, we have to get the diffusivities from the PEST file pest_params.csv | ||
with open("pest_params.csv", "r") as f: | ||
ktop, kbot = f.readlines()[-1].strip().split(",") | ||
|
||
# then feed them to model.i | ||
subprocess.call(['../../isopod-opt', '-i', 'model.i', 'Outputs/csv=true', 'Materials/mat_top/prop_values=' + ktop, 'Materials/mat_bottom/prop_values=' + kbot]) | ||
|
||
# Now format the output as required by pest_instruction.ins | ||
with open("model_out.csv", "r") as f: | ||
tme, T_bottom_left, T_bottom_mid, T_bottom_right, T_top, d_bot, d_top = f.readlines()[-1].strip().split(",") | ||
with open("pest_to_read.txt", "w") as f: | ||
f.write("Data\n") | ||
f.write(" " + T_top + " \n") | ||
f.write(" " + T_bottom_mid + " \n") | ||
f.write(" " + T_bottom_left + " \n") | ||
f.write(" " + T_bottom_right + " \n") | ||
|
||
|
||
|
||
|
||
|