The number of fields in the concatenated structure array does not match

113 views
Skip to first unread message

Maeluy Meng

unread,
Nov 18, 2021, 3:28:29 AM11/18/21
to MRST-users: The Matlab Reservoir Simulation Toolbox User Group
Dear scientists, when I tried to use Lorentz coefficient to optimize well location, I encountered a problem. My model is a simple model of four production wells and one injection well.My structure array cannot be concatenated

mrstModule add agglom coarsegrid spe10 mimetic incomp diagnostics ad-core ad-blackoil ad-eor ad-props deckformat mrst-gui blackoil-sequential diagnostics streamlines mimetic incomp coarsegrid ad-core diagnostics
current_dir = fileparts(mfilename('fullpath'));
fn    = fullfile(current_dir,'LXMX_E100.DATA');
[state0,  model, schedule, nls]=initEclipseProblemAD(fn);
G=model.G;
rock=model.rock;

state129=load (['D:\mrst-2021b\output\pm1\GenericSurfactantPolymerModel\state129.mat']);
dig129=load(['D:\mrst-2021b\output\pm1\GenericSurfactantPolymerModel\mrst_diagnostics\pm1_diagn0129.mat']);
pv  = poreVolume(G, rock);
WP  = dig129.diagnostics.WP;
W=schedule.control.W;
D=dig129.diagnostics.D;
fluid = initSimpleADIFluid('mu', [1,1,1].*centi*poise, 'n', [1,1,1]);

%优化井位  
optimizeSubsteps = true;      
optimizePlacement = true;      
wradius = 5;
inRate  = sum(pv)/(10*year);                     
minRate = inRate/4; 
% Objective function
objective = getObjectiveDiagnostics(G, rock, 'minlorenz');
% Build discrete operators
ops = setupOperatorsTPFA(G, rock);
T = computeTrans(G, rock);
targets = 1;    

% Handle for pressure solver
solvePressure = @(W, varargin) ...
   solveStationaryPressure(G, state0, ops, W, fluid, pv, T, ...
   'objective', objective, varargin{:});

% Solve pressure and display objective value
[state, D1, grad0] = solvePressure(W); grad0.objective.val

% Optimize
if optimizePlacement
    [W_opt, wellHistory, optHistory] = ...
        optimizeWellPlacementDiagnostics(G, W, rock, objective, targets, ...
               D1, minRate, state0, fluid, pv,T, ops, ...
               'optimizesubsteps', optimizeSubsteps, ...
               'searchRadius', wradius, 'wellSteps', 1, ...
               'plotProgress', true);
    [state_o, D_best, grad] = ...
        solvePressure(W_opt, 'linsolve', @mldivide);
else
    [D_best, W_best, history] = ...
        optimizeTOF(G, W, fluid_ad, pv, T, ops,state0, minRate, ...
               objective, 'targets', targets, 'plotProgress', true); %#ok<UNRCH>
    wellHistory = [];
end


error using vertcat
The number of fields in the concatenated structure array does not match. Concatenation of structure arrays requires that these arrays contain the same set of fields.

error in optimizeWellPlacementDiagnostics>optimizeGhost (第 267 行)
        W_all = vertcat(W_static, W_target, W_ghost);

error in optimizeWellPlacementDiagnostics (第 158 行)
                   optimizeGhost(G, rock, state0, W, ijk, tw, ...

error in Untitled111 (第 50 行)
        optimizeWellPlacementDiagnostics(G, W, rock, objective, targets, ...
Reply all
Reply to author
Forward
0 new messages