LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
solver_fluid_analyzer_jline.m
1function [QN, UN, RN, TN, CN, XN, t, QNt, UNt, TNt, xvec] = solver_fluid_analyzer_jline(network, options)
2% [QN, UN, RN, TN, CN, XN, T, QNT, UNT, TNT, XVEC] = SOLVER_FLUID_ANALYZER_JLINE(QN, OPTIONS)
3
4% Copyright (c) 2012-2026, Imperial College London
5% All rights reserved.
6
7%%%% Returning Result from JLINE %%%%
8
9jmodel = LINE2JLINE(network);
10jsolver = JLINE.SolverFluid(jmodel);
11import jline.solvers.fluid.*;
12
13jsolver.options.method = options.method;
14jsolver.options.stiff = options.stiff;
15result = jsolver.runMethodSpecificAnalyzerViaLINE();
16
17%%%% Migrating Result from JLINE SolverResult to native MatLab data structures %%%%
18
19M = jmodel.getNumberOfStatefulNodes; %number of stations
20K = jmodel.getNumberOfClasses; %number of classes
21
22QN = NaN*zeros(M,K);
23UN = NaN*zeros(M,K);
24RN = NaN*zeros(M,K);
25TN = NaN*zeros(M,K);
26CN = NaN*zeros(1,K);
27XN = NaN*zeros(1,K);
28
29QNt = cell(M,K);
30UNt = cell(M,K);
31TNt = cell(M,K);
32
33Tmax = result.t.length();
34t = NaN*zeros(Tmax, 1);
35
36for ist=1:M
37 for jst=1:K
38 QN(ist,jst) = result.QN.get(ist-1, jst-1);
39 UN(ist,jst) = result.UN.get(ist-1, jst-1);
40 RN(ist,jst) = result.RN.get(ist-1, jst-1);
41 TN(ist,jst) = result.TN.get(ist-1, jst-1);
42 end
43end
44
45for jst=1:K
46 CN(1,jst) = result.CN.get(0, jst-1);
47 XN(1,jst) = result.XN.get(0, jst-1);
48end
49
50for ist=1:M
51 for jst=1:K
52 for p=1:Tmax
53 QNt{ist,jst}(p,1) = result.QNt(ist,jst).get(p-1, 0);
54 UNt{ist,jst}(p,1) = result.UNt(ist,jst).get(p-1, 0);
55 TNt{ist,jst}(p,1) = result.TNt(ist,jst).get(p-1, 0);
56 end
57 end
58end
59
60for p=1:Tmax
61 t(p,1) = result.t.get(p-1, 0);
62end
63
64% NOTE: JLINE designed such that odeStateVec is not returned to LINE
65xvec.odeStateVec = [];
66xvec.sn = network;
67end