.SSC Error: A.viscocity_kin not recognized
1 view (last 30 days)
Show older comments
Hello,
I am trying to replicate a tutorial from Steven Miller regarding the development of a custom orifice.
I copied his code from the video since I could not find it.
However, I get an error that A.viscocity_kin cannot be recognized.
Could you please help me?
The code is the following:
component custom_orifice
nodes
A = foundation.hydraulic.hydraulic; %A:left
B = foundation.hydraulic.hydraulic; %B:right
end
variables
q = { 1 , 'm^3/s'}; %Volumetric flow rate
p = { 0 , 'Pa'}; %Pressure
Re = { 1 , 'l'}; %Reynolds number
end
parameters
area = {1e-5, 'm^2'}; % Orifice area
Cd = {0.7, '1' }; % Flow discharge coefficient
Recr = {12, '1' }; % Critical Reynolds number
end
% parameters (Access=private)
% density = {850, 'kg/m^3'};
% viscocity_kin = {9.8866e-6, 'm^2/s'};
% Dh = { 1, 'm'};
% end
function setup %#simple
if area <= 0
error('Orifice area must be greater than zero')
end
Dh = sqrt(4*area/pi);
density = A.density; %use domain parameter from node A
viscocity_kin = A.viscocity_kin; %use domain parameter from node A
end
branches
q: A.q -> B.q;
end
equations
p == A.p - B.p;
Re == q/(area*viscocity_kin)*Dh;
if(abs(Re)>=Recr) %Turbulent flow
q == Cd*area*sqrt(2/density*abs(p))*sign(p);
else %Laminar flow
q == 2*(Cd/sqrt(Recr))^2*area*Dh*p/(viscocity_kin*density);
end
end
end
0 Comments
Answers (0)
See Also
Categories
Find more on Simulation Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!