-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
force parameter inversion using piecewiseMultilinearFromReporter func…
…tions with parameterGradient method. Gridded data requires 9 parameters to be defined instead of 4 even though only four cells of data are being optimized. So the problems areally only dependent on 4 parameters, not 9.. closes #56
- Loading branch information
1 parent
6a8fd89
commit 219c98e
Showing
13 changed files
with
443 additions
and
7 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,112 @@ | ||
[Mesh] | ||
[gmg] | ||
type = GeneratedMeshGenerator | ||
dim = 2 | ||
nx = 20 | ||
ny = 25 | ||
xmin = -1 | ||
xmax = 1 | ||
ymin = -1 | ||
ymax = 1.5 | ||
[] | ||
[] | ||
|
||
[Problem] | ||
extra_tag_vectors = 'ref' | ||
[] | ||
|
||
[AuxVariables] | ||
[residual_src] | ||
[] | ||
[] | ||
|
||
[AuxKernels] | ||
[residual_src] | ||
type = TagVectorAux | ||
vector_tag = 'ref' | ||
v = 'u' | ||
variable = 'residual_src' | ||
[] | ||
[] | ||
|
||
|
||
[Variables] | ||
[u] | ||
[] | ||
[] | ||
|
||
[Kernels] | ||
[diff] | ||
type = Diffusion | ||
variable = u | ||
[] | ||
[] | ||
|
||
[BCs] | ||
[dirichlet] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 'left right top bottom' | ||
value = 0 | ||
[] | ||
[] | ||
|
||
[Reporters] | ||
[measured_data] | ||
type = OptimizationData | ||
measurement_file = syntheticLineData.csv | ||
file_xcoord = x | ||
file_ycoord = y | ||
file_zcoord = z | ||
file_value = u | ||
[] | ||
[gridData] | ||
type = GriddedDataReporter | ||
data_file = 'gridded_source_params.txt' | ||
outputs = none | ||
[] | ||
[] | ||
|
||
[DiracKernels] | ||
[misfit] | ||
type = VectorPointSource | ||
variable = u | ||
value = measured_data/misfit_values | ||
coord_x = measured_data/measurement_xcoord | ||
coord_y = measured_data/measurement_ycoord | ||
coord_z = measured_data/measurement_zcoord | ||
extra_vector_tags = 'ref' | ||
[] | ||
[] | ||
|
||
[Functions] | ||
[source] | ||
type = PiecewiseMulticonstantFromReporter | ||
direction = 'right right' | ||
values_name = 'gridData/parameter' | ||
grid_name = 'gridData/grid' | ||
axes_name = 'gridData/axes' | ||
step_name = 'gridData/step' | ||
dim_name = 'gridData/dim' | ||
[] | ||
[] | ||
|
||
[VectorPostprocessors] | ||
[adjoint] | ||
type = ElementOptimizationSourceFunctionInnerProduct | ||
variable = u | ||
function = source | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
solve_type = NEWTON | ||
line_search=none | ||
petsc_options_iname = '-pc_type' | ||
petsc_options_value = 'lu' | ||
[] | ||
|
||
[Outputs] | ||
console = false | ||
[] |
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,123 @@ | ||
[Mesh] | ||
[gmg] | ||
type = GeneratedMeshGenerator | ||
dim = 2 | ||
nx = 20 | ||
ny = 25 | ||
xmin = -1 | ||
xmax = 1 | ||
ymin = -1 | ||
ymax = 1.5 | ||
[] | ||
[] | ||
|
||
[Problem] | ||
extra_tag_vectors = 'ref' | ||
[] | ||
|
||
[AuxVariables] | ||
[residual_src] | ||
[] | ||
[] | ||
|
||
[AuxKernels] | ||
[residual_src] | ||
type = TagVectorAux | ||
vector_tag = 'ref' | ||
v = 'u' | ||
variable = 'residual_src' | ||
[] | ||
[] | ||
|
||
[Variables] | ||
[u] | ||
[] | ||
[] | ||
|
||
[Kernels] | ||
[diff] | ||
type = Diffusion | ||
variable = u | ||
[] | ||
[src] | ||
type = BodyForce | ||
variable = u | ||
function = source | ||
extra_vector_tags = 'ref' | ||
[] | ||
[] | ||
|
||
[BCs] | ||
[dirichlet] | ||
type = DirichletBC | ||
variable = u | ||
boundary = 'left right top bottom' | ||
value = 0 | ||
[] | ||
[] | ||
|
||
[Functions] | ||
[source] | ||
type = PiecewiseMulticonstantFromReporter | ||
direction = 'right right' | ||
values_name = 'gridData/parameter' | ||
grid_name = 'gridData/grid' | ||
axes_name = 'gridData/axes' | ||
step_name = 'gridData/step' | ||
dim_name = 'gridData/dim' | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Steady | ||
solve_type = NEWTON | ||
line_search=none | ||
petsc_options_iname = '-pc_type' | ||
petsc_options_value = 'lu' | ||
[] | ||
|
||
[Reporters] | ||
[measured_data] | ||
type = OptimizationData | ||
measurement_file = syntheticLineData.csv | ||
file_xcoord = x | ||
file_ycoord = y | ||
file_zcoord = z | ||
file_value = u | ||
variable = u | ||
execute_on = timestep_end | ||
[] | ||
[gridData] | ||
type = GriddedDataReporter | ||
data_file = 'gridded_source_params.txt' | ||
outputs = none | ||
[] | ||
|
||
[] | ||
|
||
# [VectorPostprocessors] | ||
# #----- BEGIN: VPP produce synthetic data | ||
# [line1] | ||
# type = LineValueSampler | ||
# start_point = '0.5 -0.9 0' | ||
# end_point = '0.5 1.4 0' | ||
# num_points = 5 | ||
# sort_by = id | ||
# variable = u | ||
# [] | ||
# [line2] | ||
# type = LineValueSampler | ||
# start_point = '-0.5 -0.9 0' | ||
# end_point = '-0.5 1.4 0' | ||
# num_points = 5 | ||
# sort_by = id | ||
# variable = u | ||
# [] | ||
# #----- END: VPP produce synthetic data | ||
# [] | ||
|
||
|
||
[Outputs] | ||
exodus = true | ||
console = false | ||
[] |
11 changes: 11 additions & 0 deletions
11
examples/simpleSteadyGriddedData/gold/main_out_OptimizationReporter_0001.csv
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,11 @@ | ||
adjoint,measurement_time,measurement_values,measurement_xcoord,measurement_ycoord,measurement_zcoord,misfit_values,simulation_values,source | ||
-5.6932299065827e-08,0,0.27190806915307,0,0,0,-0.00023093742114083,0.27167713173193,0.059200955143418 | ||
-2.3353378339574e-06,0,1.422869221989,0,0,0,9.2157139069737e-05,1.4229613791281,2.0065620496073 | ||
1.4945777329175e-06,0,2.0199932599511,0,0,0,-5.7914555886551e-05,2.0199353453952,3.0329065052613 | ||
-1.2177308330006e-07,0,1.8054788955459,0,0,0,-0.00069916591684449,1.8047797296291,0.32239684667143 | ||
1.6991598417615e-07,0,0.43110581591218,0,0,0,0.0024918322414382,0.43359764815362,5.2718828038361 | ||
-1.0673511670347e-07,0,0.30650555116343,0,0,0,0.00016691532740482,0.30667246649083,5.9443682684479 | ||
-1.1049160318137e-06,0,1.5406226895462,0,0,0,-0.00018892079768085,1.5404337687485,0.5006243918104 | ||
5.7022462781001e-08,0,2.1495379252665,0,0,0,0.00047192581371913,2.1500098510802,8.457752716524 | ||
7.0891581460651e-10,0,1.9232323631031,0,0,0,-7.544766325962e-05,1.9231569154398,8.9254267118343 | ||
0,0,0.46570329792254,0,0,0,-0.00085994315671861,0.46484335476582,0 |
15 changes: 15 additions & 0 deletions
15
examples/simpleSteadyGriddedData/gridded_source_params.txt
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,15 @@ | ||
# This is from source_params.csv | ||
AXIS X | ||
-0.8 0 0.8 | ||
AXIS Y | ||
-0.8 0 1.3 | ||
DATA | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | ||
9 |
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,99 @@ | ||
[StochasticTools] | ||
[] | ||
|
||
[OptimizationReporter] | ||
type = ObjectiveGradientMinimize | ||
|
||
parameter_names = 'source' | ||
num_values = '9' | ||
[] | ||
|
||
[Executioner] | ||
type = Optimize | ||
# tao_solver = taolmvm | ||
# petsc_options_iname='-tao_gatol' | ||
# petsc_options_value='1e-3' | ||
|
||
tao_solver = taonls | ||
petsc_options_iname = '-tao_gttol -tao_nls_pc_type -tao_nls_ksp_type' | ||
petsc_options_value = '1e-5 none cg' | ||
|
||
verbose = true | ||
[] | ||
|
||
[MultiApps] | ||
[forward] | ||
type = OptimizeFullSolveMultiApp | ||
input_files = forward.i | ||
execute_on = FORWARD | ||
[] | ||
[adjoint] | ||
type = OptimizeFullSolveMultiApp | ||
input_files = adjoint.i | ||
execute_on = ADJOINT | ||
[] | ||
[homogeneous_forward] | ||
type = OptimizeFullSolveMultiApp | ||
input_files = forward.i | ||
execute_on = "HOMOGENEOUS_FORWARD" | ||
[] | ||
[] | ||
|
||
[Transfers] | ||
[to_forward] | ||
type = MultiAppReporterTransfer | ||
to_multi_app = forward | ||
from_reporters = 'OptimizationReporter/source' | ||
to_reporters = 'gridData/parameter' | ||
[] | ||
[from_forward] | ||
type = MultiAppReporterTransfer | ||
from_multi_app = forward | ||
from_reporters = 'measured_data/misfit_values | ||
measured_data/simulation_values | ||
measured_data/measurement_values | ||
measured_data/measurement_time' | ||
to_reporters = 'OptimizationReporter/misfit_values | ||
OptimizationReporter/simulation_values | ||
OptimizationReporter/measurement_values | ||
OptimizationReporter/measurement_time' | ||
[] | ||
|
||
[to_adjoint] | ||
type = MultiAppReporterTransfer | ||
to_multi_app = adjoint | ||
from_reporters = 'OptimizationReporter/source OptimizationReporter/misfit_values' | ||
to_reporters = 'gridData/parameter measured_data/misfit_values' | ||
[] | ||
[from_adjoint] | ||
type = MultiAppReporterTransfer | ||
from_multi_app = adjoint | ||
from_reporters = 'adjoint/inner_product' | ||
to_reporters = 'OptimizationReporter/adjoint' | ||
[] | ||
|
||
[to_homogeneous_forward] | ||
type = MultiAppReporterTransfer | ||
to_multi_app = homogeneous_forward | ||
from_reporters = 'OptimizationReporter/source' | ||
to_reporters = 'gridData/parameter' | ||
[] | ||
|
||
[from_homogeneous_forward] | ||
type = MultiAppReporterTransfer | ||
from_multi_app = homogeneous_forward | ||
from_reporters = 'measured_data/misfit_values | ||
measured_data/simulation_values | ||
measured_data/measurement_values | ||
measured_data/measurement_time' | ||
to_reporters = 'OptimizationReporter/misfit_values | ||
OptimizationReporter/simulation_values | ||
OptimizationReporter/measurement_values | ||
OptimizationReporter/measurement_time' | ||
[] | ||
|
||
[] | ||
|
||
[Outputs] | ||
csv=true | ||
[] |
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,11 @@ | ||
id,u,x,y,z | ||
0,0.27190806915307,-0.5,-0.9,0 | ||
0.575,1.422869221989,-0.5,-0.325,0 | ||
1.15,2.0199932599511,-0.5,0.25,0 | ||
1.725,1.8054788955459,-0.5,0.825,0 | ||
2.3,0.43110581591218,-0.5,1.4,0 | ||
0,0.30650555116343,0.5,-0.9,0 | ||
0.575,1.5406226895462,0.5,-0.325,0 | ||
1.15,2.1495379252665,0.5,0.25,0 | ||
1.725,1.9232323631031,0.5,0.825,0 | ||
2.3,0.46570329792254,0.5,1.4,0 |
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,16 @@ | ||
[Tests] | ||
[Steady] | ||
design = 'VectorNearestPointFunction.md' | ||
issues = '#52' | ||
[hessian] | ||
type = CSVDiff | ||
input = main.i | ||
csvdiff = main_out_OptimizationReporter_0001.csv | ||
rel_err = 0.01 | ||
max_threads = 1 | ||
# steady solve | ||
recover = false | ||
requirement = 'The system shall be able to perform hessian based steady state force-inversion optimization for a body force described by the VectorNearestPointFunction' | ||
[] | ||
[] | ||
[] |
Oops, something went wrong.