-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gaussian Probe optimization #28872
base: next
Are you sure you want to change the base?
Gaussian Probe optimization #28872
Conversation
Job Documentation, step Docs: sync website on 8aa6266 wanted to post the following: View the site here This comment will be updated on new commits. |
6628c4d
to
c5bc150
Compare
Job Coverage, step Generate coverage on 8aa6266 wanted to post the following: Framework coverage
Modules coverageOptimization
Full coverage reportsReports
This comment will be updated on new commits. |
Job Precheck, step Clang format on b1fad52 wanted to post the following: Your code requires style changes. A patch was auto generated and copied here
Alternatively, with your repository up to date and in the top level of your repository:
|
f01337f
to
f07deef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of ternaries, very clever!
|
||
!syntax description /Materials/ReporterOffsetFunctionMaterial | ||
|
||
This can be used to create a material that is the sum of a function that is shifted by a set of points. This can be useful for creating a field of laser heat sources. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be used to create a material that is the sum of a function that is shifted by a set of points. This can be useful for creating a field of laser heat sources. | |
This can be used to create a material that is the sum of a function that is shifted by a set of points. This can be useful for creating a field containing multiple sources, see Figure??. |
|
||
/// x coordinate | ||
const std::vector<Real> & _coordx; | ||
/// y coordinate | ||
const std::vector<Real> & _coordy; | ||
///z coordinate | ||
const std::vector<Real> & _coordz; | ||
///xyz point | ||
const std::vector<Point> & _points; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// x coordinate | |
const std::vector<Real> & _coordx; | |
/// y coordinate | |
const std::vector<Real> & _coordy; | |
///z coordinate | |
const std::vector<Real> & _coordz; | |
///xyz point | |
const std::vector<Point> & _points; | |
/** | |
* Reporter offset locations for function | |
*/ | |
// @{ | |
/// x coordinate | |
const std::vector<Real> & _coordx; | |
/// y coordinate | |
const std::vector<Real> & _coordy; | |
///z coordinate | |
const std::vector<Real> & _coordz; | |
///xyz point | |
const std::vector<Point> & _points; | |
// @} |
/// The function being used for evaluation | ||
const Function & _func; | ||
/** | ||
* Calculates the value of the offset function at the given point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Calculates the value of the offset function at the given point. | |
* Calculates the value of the function at the given offset point. |
|
||
private: | ||
/// convenience vectors (these are not const because reporters can change their size) | ||
std::vector<Real> _ones_vec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need this one.
|
||
private: | ||
/// convenience vectors (these are not const because reporters can change their size) | ||
std::vector<Real> _ones_vec; | ||
std::vector<Real> _zeros_vec; | ||
std::vector<Point> _zeros_pts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private: | |
/// convenience vectors (these are not const because reporters can change their size) | |
std::vector<Real> _ones_vec; | |
std::vector<Real> _zeros_vec; | |
std::vector<Point> _zeros_pts; |
"Computes the misfit and misfit gradient materials for inverse optimizations problems."); | ||
|
||
params.addRequiredCoupledVar("sim_variable", | ||
"Variable that is being for the simulation variable."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Variable that is being for the simulation variable."); | |
"Variable that is being used for the simulation variable."); |
type = SideIntegralMaterialProperty | ||
boundary = top | ||
property = obj_misfit | ||
execute_on = 'ADJOINT_TIMESTEP_END TIMESTEP_END' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need ADJOINT_TIMESTEP_END
## THESE OPTIONS ARE FOR TESTING THE ADJOINT GRADIENT | ||
# petsc_options_iname = '-tao_max_it -tao_fd_test -tao_test_gradient -tao_fd_gradient -tao_fd_delta -tao_gatol' | ||
# petsc_options_value = '1 true true false 1e-3 1e-5' | ||
# petsc_options = '-tao_test_gradient_view' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## THESE OPTIONS ARE FOR TESTING THE ADJOINT GRADIENT | |
# petsc_options_iname = '-tao_max_it -tao_fd_test -tao_test_gradient -tao_fd_gradient -tao_fd_delta -tao_gatol' | |
# petsc_options_value = '1 true true false 1e-3 1e-5' | |
# petsc_options = '-tao_test_gradient_view' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't put these in these commented out tao options for the fd gradient in new input files. I do find them helpful.
abs_zero = 1e-4 | ||
# steady solve | ||
recover = false | ||
detail = 'for side only measurements.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detail = 'for side only measurements.' | |
detail = 'for side only measurements and fewer measurements than controllable parameters.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trying to point out this problem is under constrained.
num_values = '3' | ||
[] | ||
|
||
[Reporters] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this reporter on the sub-app so that you don't have to transfer it.
- Measurement values $\mathbf{u}_m = \{u_{m,1}, u_{m,2}, \ldots, u_{m,n}\}$ | ||
- Measurement Locations: $\mathbf{p}_m = \{\mathbf{p}_{m,1}, \mathbf{p}_{m,2}, \ldots, \mathbf{p}_{m,n}\}$, where $\mathbf{p}_{m,i} = (x_{m,i}, y_{m,i}, z_{m,i})$ for 3D data | ||
|
||
- Simulation variable: $u(\mathbf{x})$ | ||
- Gaussian beam width: $w$ | ||
- Simulation point: $\mathbf{x}$ | ||
|
||
The `misfit` at a given simulation point $\mathbf{x}$ is calculated as: | ||
|
||
$m(\mathbf{x}) = \sum_{i=1}^{n} \left( u_{m,i} g(\mathbf{p}_{m,i}, \mathbf{x}) - u(\mathbf{x}) g(\mathbf{p}_{m,i}, \mathbf{x}) \right)^2,$ | ||
|
||
where: | ||
|
||
- $g(\mathbf{p}_{m,i}, \mathbf{x})$ is the Gaussian weighting function, defined as: | ||
|
||
$g(\mathbf{p}_{m,i}, \mathbf{x}) = \exp\left( -\frac{2 \|\mathbf{p}_{m,i} - \mathbf{x}\|^2}{w^2} \right),$ | ||
|
||
and the `misfit gradient` with respect to the simulation variable $u(\mathbf{x})$ is: | ||
|
||
$\frac{\partial m(\mathbf{x})}{\partial u(\mathbf{x})} = -2 \sum_{i=1}^{n} g(\mathbf{p}_{m,i}, \mathbf{x}) \left( u_{m,i} g(\mathbf{p}_{m,i}, \mathbf{x}) - u(\mathbf{x}) g(\mathbf{p}_{m,i}, \mathbf{x}) \right).$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THis needs to be corrected for a general function and not just a gaussian. You can keep the gaussian as an example but its not really relevant anymore. Maybe reference the input file function:
!listing test/tests/optimizationreporter/function_misfit/forward_and_adjoint.i block=Functions
/// Simulation variable | ||
const GenericVariableValue<is_ad> & _sim_var; | ||
|
||
/// Gradient of misfit with respect to material properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrt simulation variable
closes #28871