getSinglePhaseProperty can only calculate one composition condition. if there are lots of conditions to be calculated at the same time, for loop is not efficient.
is there some way to calculate a matrix composition?
Moderator: jasper
jasper wrote:Not in this version of CAPE-OPEN.
With a well written efficient material object the overhead need not to be too large though. I suppose you mean to call both CalcSinglePhaseProperty and GetSinglePhaeProperty?
jasper wrote:But if you do GetSinglePhaseProperty 1000x without CalcSinglePhaseProperty you will be getting the same value over and over again.
colancto wrote:Would be great to know more on the case at hand. It is not the first time the requirement for calculating a property at a number of condition sets has been formulated.
King wrote:I don't find the CalcSinglePhaseProperty inthe help of the matlab unit operaton, what's that?
jasper wrote:King wrote:I don't find the CalcSinglePhaseProperty inthe help of the matlab unit operaton, what's that?
Ah - now I understand your question better. I was not aware that you were using the Matlab Unit Operation.
For Matlab Thermo, you can get values by vector (not by matrix, as this would make composition a tensor), from Matlab itself. But under the hood this translates to an individual property calculation for each item in the vector, as CAPE-OPEN itself does not allow for vector values. This is because the calculation results are stored on a material object, and there is only one of those.
For Matlab Unit Operation, this is not implemented, but doing the loop inside Matlab is not much less effective than the loop being done in the mex file, as is the case for thermo.
In any case the overhead of the loop is rather small, unless the underlying thermo (a) would be optimized for vector calculations, e.g. initialize each calculation by using the previous point in the vector, or (b) the calculations are very fast compared to the function call, which is not typically the case. Typically e.g. solving the equation of state takes longer than the function call itself.
The only true optimization I can think of is splitting the calculations over multiple threads, but Matlab Thermo currently is not designed to be thread safe, and Matlab Unit Operation cannot be designed that way, as it depends on a Material Object delivered by the simulation environment, for which it cannot be assumed that it can be duplicated and used from other threads. The latter is actually a restriction imposed by COM.
Return to MATLAB Unit Operation (AmsterCHEM)
Users browsing this forum: No registered users and 0 guests