fix error
This commit is contained in:
@@ -88,21 +88,20 @@ classdef EDFMAppController < handle
|
||||
drawnow;
|
||||
|
||||
try
|
||||
logText = evalc('[r, Times, OutputRs, Wellpara, trun] = run_case(obj.Config);');
|
||||
progress_callback = @(message, meta) obj.onRunProgress(message, meta);
|
||||
[r, Times, OutputRs, Wellpara, trun] = run_case(obj.Config, progress_callback);
|
||||
obj.Results = struct( ...
|
||||
'r', r, ...
|
||||
'Times', Times, ...
|
||||
'OutputRs', {OutputRs}, ...
|
||||
'Wellpara', {Wellpara}, ...
|
||||
'trun', trun, ...
|
||||
'captured_log', logText);
|
||||
if ~isempty(strtrim(logText))
|
||||
obj.appendLog(logText);
|
||||
end
|
||||
'captured_log', '');
|
||||
obj.refreshResults();
|
||||
if strlength(obj.CurrentPlotAction) ~= 0
|
||||
obj.refreshCasePlotControls(obj.CurrentPlotAction);
|
||||
end
|
||||
obj.appendLog('Run completed.');
|
||||
obj.setRunProgress('Completed');
|
||||
obj.setStatus('Run completed');
|
||||
catch ME
|
||||
@@ -690,6 +689,35 @@ classdef EDFMAppController < handle
|
||||
drawnow limitrate;
|
||||
end
|
||||
|
||||
function onRunProgress(obj, message, meta)
|
||||
if nargin < 3 || ~isstruct(meta)
|
||||
meta = struct();
|
||||
end
|
||||
|
||||
if nargin >= 2 && strlength(strtrim(string(message))) ~= 0
|
||||
obj.appendLog(message);
|
||||
end
|
||||
|
||||
if isfield(meta, 'status') && ~isempty(meta.status)
|
||||
obj.setRunProgress(meta.status);
|
||||
end
|
||||
|
||||
if isfield(meta, 'step') || isfield(meta, 'time') || isfield(meta, 'dt')
|
||||
stageText = obj.getMetaText(meta, 'step', '-');
|
||||
timeText = obj.getMetaText(meta, 'time', '-');
|
||||
dtText = obj.getMetaText(meta, 'dt', '-');
|
||||
obj.setRunHeader(stageText, timeText, dtText);
|
||||
end
|
||||
end
|
||||
|
||||
function textValue = getMetaText(obj, meta, fieldName, fallback)
|
||||
if isfield(meta, fieldName) && ~isempty(meta.(fieldName))
|
||||
textValue = obj.valueToShortText(meta.(fieldName));
|
||||
else
|
||||
textValue = fallback;
|
||||
end
|
||||
end
|
||||
|
||||
function setRunProgress(obj, textValue)
|
||||
if isprop(obj.App, 'RunProgressLabel')
|
||||
obj.App.RunProgressLabel.Text = ['RunProgress: ', char(string(textValue))];
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ arguments
|
||||
end
|
||||
|
||||
action_id = lower(string(action_id));
|
||||
cla(ax);
|
||||
reset_plot_axes(ax);
|
||||
|
||||
switch action_id
|
||||
case "plot_well_response"
|
||||
@@ -35,6 +35,7 @@ wellpara = results.Wellpara;
|
||||
well_index = get_option(options, 'well_index', 1);
|
||||
metric = upper(string(get_option(options, 'metric', "BHP")));
|
||||
|
||||
view(ax, 2);
|
||||
set(ax, 'XScale', 'linear', 'YScale', 'linear');
|
||||
|
||||
if isempty(wellpara)
|
||||
@@ -122,6 +123,7 @@ for i = 1:nx * ny
|
||||
end
|
||||
|
||||
fill(ax, x, y, dis, 'EdgeColor', 'interp');
|
||||
view(ax, 2);
|
||||
axis(ax, 'equal');
|
||||
axis(ax, 'tight');
|
||||
colormap(ax, jet);
|
||||
@@ -201,6 +203,7 @@ for i = 1:nx * ny
|
||||
end
|
||||
|
||||
fill(ax, x, y, dis, 'EdgeColor', 'interp');
|
||||
view(ax, 2);
|
||||
axis(ax, 'equal');
|
||||
axis(ax, 'tight');
|
||||
colormap(ax, jet);
|
||||
@@ -259,3 +262,26 @@ else
|
||||
value = fallback;
|
||||
end
|
||||
end
|
||||
|
||||
function reset_plot_axes(ax)
|
||||
cla(ax);
|
||||
hold(ax, 'off');
|
||||
grid(ax, 'off');
|
||||
view(ax, 2);
|
||||
colorbar(ax, 'off');
|
||||
|
||||
set(ax, ...
|
||||
'XScale', 'linear', ...
|
||||
'YScale', 'linear', ...
|
||||
'ZScale', 'linear', ...
|
||||
'XLimMode', 'auto', ...
|
||||
'YLimMode', 'auto', ...
|
||||
'ZLimMode', 'auto', ...
|
||||
'CLimMode', 'auto', ...
|
||||
'DataAspectRatioMode', 'auto', ...
|
||||
'PlotBoxAspectRatioMode', 'auto', ...
|
||||
'CameraPositionMode', 'auto', ...
|
||||
'CameraTargetMode', 'auto', ...
|
||||
'CameraUpVectorMode', 'auto', ...
|
||||
'CameraViewAngleMode', 'auto');
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function [r, Times, OutputRs, Wellpara, trun] = run_case(config)
|
||||
function [r, Times, OutputRs, Wellpara, trun] = run_case(config, progress_callback)
|
||||
%RUN_CASE Execute a simulation from unified config.
|
||||
%
|
||||
% This is the first migration step from hard-coded main1.m scripts toward a
|
||||
@@ -8,6 +8,7 @@ function [r, Times, OutputRs, Wellpara, trun] = run_case(config)
|
||||
|
||||
arguments
|
||||
config (1,1) struct
|
||||
progress_callback = []
|
||||
end
|
||||
|
||||
project_root = fileparts(fileparts(fileparts(mfilename('fullpath'))));
|
||||
@@ -81,7 +82,8 @@ Wellc = handle_well1_well2(well1, well2, welloc, r);
|
||||
config.schedule.dtmax, ...
|
||||
Wellc, ...
|
||||
config.schedule.time, ...
|
||||
config.schedule.well_schedules);
|
||||
config.schedule.well_schedules, ...
|
||||
progress_callback);
|
||||
|
||||
trun.run_time = toc(overall_tic);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user