Info
この質問は閉じられています。 編集または回答するには再度開いてください。
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
Non existent field for T (temperature)
1 回表示 (過去 30 日間)
古いコメントを表示
Dear all i new user using mathlab, i got some coding that related with my study but need to modified, some code had i changed, i am very wonder this code was trouble, i try to add some parameter but still problem anyone help me to understanding what they want?
please find the following errors
Reference to non-existent field 'T'. Error in PhysicalModel/getProp (line 686) p = state.(fn)(:, index);
Error in PhysicalModel>@(x)model.getProp(state,x) (line 711) varargout = cellfun(@(x) model.getProp(state, x), ..
12 件のコメント
vaya putra
2018 年 1 月 21 日
編集済み: Torsten
2018 年 1 月 22 日
function [problem, state] = equationsWaterThermal(state0, state, model, dt, drivingForces, varargin)
opt = struct('Verbose', mrstVerbose, ...
'reverseMode', false,...
'resOnly', false,...
'iteration', -1); % Compatibility only
opt = merge_options(opt, varargin{:});
% W = drivingForces.W;
%assert(isempty(drivingForces.bc) && isempty(drivingForces.src))
assert(isempty(drivingForces.src))
s = model.operators;
G = model.G;
f = model.fluid;
[p, T, wellSol] = model.getProps(state, 'pressure','temperature', 'wellsol');
[p0 , T0, wellSol0] = model.getProps(state0, 'pressure','temperature','wellsol');
[wellVars, wellVarNames, wellMap] = model.FacilityModel.getAllPrimaryVariables(wellSol);
if ~opt.resOnly,
if ~opt.reverseMode,
% define primary varible x and initialize
[p, T, wellVars{:}] = initVariablesADI(p, T, wellVars{:});
else
wellVars0 = model.FacilityModel.getAllPrimaryVariables(wellSol0);
[p0, T0, wellVars0{:}] = initVariablesADI(p0, T0, wellVars0{:}); %#ok
end
end
gdz = s.Grad(G.cells.centroids) * model.gravity';
%--------------------
%check for p-dependent tran mult:
trMult = 1;
if isfield(f, 'tranMultR'), trMult = f.tranMultR(p); end
%check for p-dependent porv mult:
pvMult = 1; pvMult0 = 1;
if isfield(f, 'pvMultR')
pvMult = f.pvMultR(p);
pvMult0 = f.pvMultR(p0);
end
transMult=1;
if isfield(f, 'transMult')
transMult=f.transMult(p);
end
trans=s.T.*transMult;
bW = f.bW(p, T);bW0 = f.bW(p0,T0);
rhoW = bW.*f.rhoWS;
% rhoW on face, avarge of neighboring cells (E100, not E300)
rhoWf = s.faceAvg(rhoW);
mobW = trMult./f.muW(p,T);
dpW = s.Grad(p) - rhoWf.*gdz;
% water upstream-index
upcw = (double(dpW)<=0);
vW = - s.faceUpstr(upcw, mobW).*trans.*dpW;
bWvW = s.faceUpstr(upcw, bW).*vW;
% get themal propeties
uR = T.*model.rock.cR.*model.rock.rhoR;uR0 = T0.*model.rock.cR.*model.rock.rhoR;
uW = f.uW(p,T);uW0 = f.uW(p0,T0);
hW = f.hW(p,T);
if model.outputFluxes
state = model.storeFluxes(state, vW, [], []);
end
if model.extraStateOutput
state = model.storebfactors(state, bW, [], []);
state = model.storeMobilities(state, mobW, [], []);
state = model.storeUpstreamIndices(state, upcw, [], []);
end
% water:
primaryVars = {'pressure', 'T', wellVarNames{:}};
eqs{1} = (s.pv/dt).*( pvMult.*bW - pvMult0.*bW0 ) + s.Div(bWvW);
vol=model.G.cells.volumes;
vQ = -s.T_r .* s.Grad(T);
eqs{2} = (1./dt).*((vol-pvMult.*s.pv).*uR-(vol-pvMult0.*s.pv).*uR0) + s.Div( vQ);
% accumulation of energy and advection of enthalpy in fluid, conduction of
% heat is neglected
eqs{2} = eqs{2} + ((s.pv/dt).*( pvMult.*uW.*f.rhoWS.*bW - pvMult0.*uW0.*f.rhoWS.*bW0 )...
+ s.Div( s.faceUpstr(bWvW>0, f.rhoWS.*hW) .* bWvW));
names = {'water', 'temperature'};
types = {'cell', 'cell'};
sW = ones(model.G.cells.num, 1);
[eqs, state, src] = addBoundaryConditionsAndSources(model, eqs, names, types, state, ...
{p}, {sW}, {mobW}, {rhoW}, ...
{}, {}, ...
drivingForces);
% [eqs, qBC, qRes, BCtocellMap, qSRC, srcCells, bcCells] = addFluxesFromSourcesAndBC(model, eqs, ...
% {p},...
% {rhoW},...
% {mobW}, ...
% {ones(G.cells.num,1)}, ...
% drivingForces);
% accumulation of energy and conduction of heat in rock
% add energy from pressure boundaries assume outside has sime enthapy as
%
% if(~isempty(bcCells))
% qBC=qBC{1};
% hWbc=hW(bcCells);%.*BCtocellMap;
% hWbc(qBC>0)=drivingForces.bc.hW(qBC>0);
% eqs{2} = eqs{2} - BCtocellMap*(hWbc.*f.rhoWS.*qBC);
% end
bcCells = src.bc.sourceCells;
if(~isempty(bcCells))
qBC=src.bc.phaseMass{1};
hWbc=hW(bcCells);%.*BCtocellMap;
hWbc(qBC>0)=drivingForces.bc.hW(qBC>0);
qtbc = src.bc.mapping*(hWbc.*qBC);
if isempty(src.bc.mapping)
qtbc = src.bc.mapping*qtbc;
end
eqs{2}(bcCells) = eqs{2}(bcCells) - qtbc;
end
srcCells = src.src.sourceCells;
if(~isempty(srcCells))
qSRC=src.bc.phaseMass{1};
hWsrc=hW(srcCells);
hWsrc(srcCells(qSRC>0))=drivingForces.src.hW;
eqs{2}(srcCells) = eqs{2}(srcCells) - qSRC.*hWsrc;
end
% add energy from conduction from boundary
if(~isempty(drivingForces.bcT))
assert(all(strcmp(drivingForces.bcT.type,'temperature')));
bc_t=strcmp(drivingForces.bcT.type,'temperature');
if(any(bc_t))
%assert(isempty(drivingForces.bc),'can only have temprature boundary with nowflow');
bc=drivingForces.bcT;
[bQqQbc,bcT_cell] = temperatureBCContrib(G,s,T,bc);
eqs{2}(bcT_cell) = eqs{2}(bcT_cell) + bQqQbc;
end
end
% well equations
%sat = {sW, sO, sG};
components = {};
[eqs, names, types, state.wellSol] = model.insertWellEquations(eqs, names, types, wellSol0, wellSol, wellVars, wellMap,...
p, {mobW}, {rhoW}, hW, components, dt, opt);
problem = LinearizedProblem(eqs, types, names, primaryVars, state, dt);
end
function [bQqQbc,bc_cell] = temperatureBCContrib(G,s,T,bc)
assert(all(strcmp(bc.type,'temperature')),'only pressure bc allowed');
Tr_bc=s.T_r_all(bc.face);
assert(all(sum(G.faces.neighbors(bc.face,:)>0,2)==1),'bc on internal boundary');
bc_cell=sum(G.faces.neighbors(bc.face,:),2);
Tbc=T(bc_cell);
dTbc=bc.value-Tbc;
bQqQbc = -Tr_bc.*(dTbc);
end
Walter Roberson
2018 年 1 月 22 日
Please post the complete error message showing which line is producing the error.
I can see a few possibilities at the moment. One of them is that the input model that you pass in does not have a field or property named T . The reason why it does not have a field or property named T would depend upon how it was created, which is not something we can tell from what you posted.
vaya putra
2018 年 1 月 22 日
編集済み: Stephen23
2018 年 1 月 22 日
i am sorry for late respons, this the complete error i tried to know what is with my simulation
Reference to non-existent field 'T'.
Error in PhysicalModel/getProp (line 686)
p = state.(fn)(:, index);
Error in PhysicalModel>@(x)model.getProp(state,x) (line 711)
varargout = cellfun(@(x) model.getProp(state, x), ...
Error in PhysicalModel/getProps (line 711)
varargout = cellfun(@(x) model.getProp(state, x), ...
Error in equationsWaterThermal (line 21)
[p, T, wellSol] = model.getProps(state, 'pressure','temperature', 'wellsol');
Error in WaterThermalModel/getEquations (line 32)
[problem, state] = equationsWaterThermal(state0, state, model,...
Error in PhysicalModel/stepFunction (line 436)
[problem, state] = model.getEquations(state0, state, dt, drivingForces, ...
Error in NonLinearSolver/solveMinistep (line 351)
model.stepFunction(state, state0, dt, drivingForces, ...
Error in NonLinearSolver/solveTimestep (line 220)
solveMinistep(solver, model, state, state0_inner, dt, drivingForces);
Error in simulateScheduleAD (line 235)
[state, report] = solver.solveTimestep(state0, dt(i), model,...
Error in initial_step3 (line 151)
[ws,wellSols,state0] = simulateScheduleAD(state0, wModel, schedule);
Walter Roberson
2018 年 1 月 22 日
I do not appear to find waterModel as a MATLAB routine, or as anything from the File Exchange.
Walter Roberson
2018 年 1 月 22 日
The point is that we do not have access to the code that creates that variable, so that we cannot tell you why the variable does not have the T field. wModel is being created without a T field and you need to go back to the code that creates it to figure out why it has no T.
この質問は閉じられています。
回答 (0 件)
この質問は閉じられています。
参考
タグ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)