|
Last update: 2017-08-01
Numerics for Chemical Engineering can be called in your own .m files within Octave or Matlab. The examples are built with Octave, but shall run the same way in Matlab.
Quick start
Download nce.m and put it in a directory of your choice. Copy nce.jar to the same folder. Start Octave, surf to the directory where nce.m is located and type “nce”. This should setup NCE environment in Octave, relieving you from bothering about the initialization of Java. The example file nce-example.m can be used to check if everything works and to understand the principles of how to make NCE working in Octave.
Step-by-step example
Here below a step by step script that evaluates the pressure drop in a pipe using NCE, all data in SI units.
Download NCE binary archive nce.jar and put it in your favorite path.
Load the library in Octave
javaaddpath("/myPath/nce.jar");
Create a Stream object (single component stream)
s = javaObject('nce.base.Stream',1);
and fill it up with with process data
s.setFlowMass(1.5);
s.setDens(1000);
s.setVisc(0.001);
s.evalVolFlowByDensity();
Create a Pipe object
p = javaObject('nce.piping.Pipe');
Assign the stream to the pipe
p.setStream(s);
Define pipe geometry, query NCE built-in data bank for a 2 inches carbon steel pipe, schedule standard
od = javaMethod("getOd", "nce.piping.databank.PipeB3610schSTD", "2");
th = javaMethod("getTh", "nce.piping.databank.PipeB3610schSTD", "2");
p.defineSectionGeometry(od, th);
p.setLength(100);
p.defineRugosity(0.05e-3);
Now evaluate pressure drop for incompressible flow and print the result
p.evalPressureDropIncompressible();
printf("Pressure drop = %.3f bar \n", p.getPressDelta() * 1e-5);