Matlab just says there is an error, but I don't see one. How do I know more about the error

Error in GetSteamZoneParameters (line 7) [ tcD ] = FindtcD( fhv );

I do not get any more description.

The GetSteamZoneParameters function works fine when I call it through the command window. But when I call this function through SAGD.m I get the error.

This code is a part of a simulator for steam injection in oil fields.

enter code here
function [ Cw, fhv, Mw, Mo, Mr, s,tD , tcD, WOR, OSR ] = SAGD(fPD, qo,length1, cumTime, cum_oil_tot,cum_wat_tot, cum_steam_tot, cycle, Ts,Ti, Xinj, API, Swi, phi, alpha,... 
                                                                reservoirThickness, Ms, Qi, rl, soakTime, pi, absolutePerm, convFactor,g, Pwf,... 
                                                                Sorw, WIP, rinj, injTime, qwcum, qw, timeStep, prodTime )
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here

cum_wat(cycle) = 0.0;
cum_oil(cycle) = 0.0;

if(cycle>1) 
Qi(cycle) = Qi(cycle) + Q(cycle-1);
end
%Start cycle calculations
time=0.0;
while time <= injTime(cycle)+soakTime(cycle)+prodTime(cycle)


    if time <= injTime(cycle) 
    cum_steam_tot = cum_steam_tot + 5.615*rinj(cycle)*timeStep;
    Tavg = Ts;
    end

    if(time == 0.0) 
    [ ~, fhv, ~, ~, ~, ~, ~] = GetVolumetricHeatCapacities( Ts,Ti,Tavg, Xinj, API, Swi, phi, alpha, time, reservoirThickness, Ms);
    [ tcD ] = FindtcD( fhv );
    end

[Cw, fhv, Mw, Mo, Mr, s, tD]  = GetVolumetricHeatCapacities( Ts,Ti,Tavg, Xinj, API, Swi, phi, alpha, time, reservoirThickness, Ms);
[Qi, angleOfInclination, steamZoneRadius, steamZoneVolume ] = GetSteamZoneParameters( Qi,fhv, tD, cycle, rinj, Xinj, time, injTime, Tavg, Ti, Mr, Ts, reservoirThickness, length1);
[ fVD, fHD ] = GetfVDfHD( time, injTime, cycle, alpha, reservoirThickness, steamZoneRadius );
[ fPD] = GetfPD( fPD, Qi, Mo,Mw, cycle, steamZoneVolume,steamZoneRadius, Mr, length1, rl ,Ts, Ti, soakTime, pi, alpha , Tavg, absolutePerm, convFactor, API,reservoirThickness,g, angleOfInclination, Pwf,Sorw, WIP, rinj, injTime, cum_wat, qwcum, qw, timeStep, Swi );
[ Tavg ] = GetTemperatures( cycle, time, Ts, injTime, timeStep, soakTime, Ti, fHD, fVD,fPD);

    if time > injTime(cycle) + soakTime(cycle) 
    [ qo ] = GetInstantaneousOilRate( absolutePerm, convFactor, API,reservoirThickness,g, Tavg, angleOfInclination, pi, Pwf,Sorw, WIP, cycle, rinj, injTime, cum_wat, qwcum, qw, timeStep, Swi );
    [ qw ] = GetInstantaneousWaterRate( WIP ,cycle ,Tavg, Sorw, angleOfInclination, rinj, injTime, cum_wat, qwcum, pi, timeStep, Swi, Pwf, g, reservoirThickness, convFactor, absolutePerm, qw, krw );
    cum_oil_tot = cum_oil_tot + qo;
    cum_wat_tot = cum_wat_tot + qw;
    cum_oil(cycle) = cum_oil(cycle)+ qo;
    cum_wat(cycle) = cum_wat(cycle) + qw;
    end

    if time <= injTime(cycle) 
    Tavg = Ts;
    end

    WOR = qw/qo;
    OSR = cum_oil_tot/cum_steam_tot;

cumTime = cumTime + 1.0;
 time = time + timeStep;
end
end




**Error:**

 - Error in GetSteamZoneParameters (line 7)  tcD = FindtcD( fhv );   

   Output argument "angleOfInclination" (and maybe others) not assigned
   during call to
   "H:\MATLAB\CSI-mine\GetSteamZoneParameters.m>GetSteamZoneParameters".

   Error in SAGD (line 29) [Qi, angleOfInclination, steamZoneRadius,
   steamZoneVolume ] = GetSteamZoneParameters( Qi,fhv, tD, cycle, rinj,
   Xinj, time, injTime, Tavg, Ti, Mr, Ts, reservoirThickness, length1);




function [Qi, angleOfInclination, steamZoneRadius, steamZoneVolume ] = GetSteamZoneParameters( Qi,fhv, tD, cycle, rinj, Xinj, time,... 
                                                                                               injTime, Tavg, Ti, Mr, Ts, reservoirThickness, length1)
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here


 tcD = FindtcD( fhv );   
 Ehs = GetEhs( tD, tcD );
 wt = 5.615*rinj(cycle)*62.4; 
 ws = Xinj*wt;

if( time ~= 0.0 && time <= injTime(cycle)) 
Qi = Qi+(wt*(h_wat(Tavg)-h_wat(Ti))+ws*latent_heat_vapor(Tavg));

end

if (time <= injTime(cycle))
steamZoneVolume = Ehs*Qi(cycle)/(Mr*(Ts-Ti));
steamZoneArea = steamZoneVolume/reservoirThickness;
steamZoneRadius = steamZoneArea / length1;
angleOfInclination =(180.0/pi)*atan(steamZoneRadius/reservoirThickness);
end
end

Answers


Well, read the error message:

"angleOfInclination" was not assigned

That means, GetSteamZoneParameters did not set this variable and then of course throws an error when it should return. Which, looking at this function, means that the following if-condition is obviously not true:

if (time <= injTime(cycle))
    ..
end

So you should probably define and alternative value to the variables from within the if block in an else block.


Need Your Help

JS/jQuery event does not fire after addEventListener

javascript jquery addeventlistener

I'm using a script that creates an HTML structure like this by adding objects with JS and jQuery using createElement and appendChild:

How to center vertically a container div

jquery css html center vertical-alignment

I can't center vertically popup_interstitial_table that contains an ads type container.