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!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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 (한국어)