Skip to content

Commit

Permalink
Setup scalar perturbation
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjohansson committed Jan 28, 2024
1 parent 37fc840 commit 524347d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Examples/Optimisation/runOptimisation.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

p = getScaledParameterVector(simulatorSetup, parameters);
[vad, gad] = evalObjectiveBattmo(p, objmatch, simulatorSetup, parameters, 'GradientMethod', 'AdjointAD', options{:});
perturbationSize = {1e-10, 1e-5};
perturbationSize = 1e-10;
[vnum, gnum] = evalObjectiveBattmo(p, objmatch, simulatorSetup, parameters, ...
'GradientMethod', 'PerturbationADNUM' , ...
'PerturbationSize', perturbationSize , ...
Expand Down
2 changes: 2 additions & 0 deletions Utilities/Adjoint/evalObjectiveBattmo.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ This file is part of The MATLAB Reservoir Simulation Toolbox (MRST).
pertsize = opt.PerturbationSize;
if isempty(pertsize)
pertsize = repmat({1e-7}, numel(parameters), 1);
elseif ~iscell(pertsize) && numel(pertsize) == 1 % scalar value
pertsize = repmat({pertsize}, numel(parameters), 1);
end

scaledGradient = cell(numel(parameters), 1);
Expand Down

0 comments on commit 524347d

Please sign in to comment.