Skip to content

Commit

Permalink
[matlab] Redirect RP setter to thermo_set_DP
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Feb 11, 2023
1 parent b20cfec commit 474dc29
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion interfaces/matlab/toolbox/@ThermoPhase/set.m
Expand Up @@ -171,7 +171,7 @@ function set(tp, varargin)
setTemperature(tp, tval);
setPressure(tp, pval);
elseif np == 1 && nv == 1
setState_RP(tp, [1.0/vval, pval])
setState_DP(tp, [1.0/vval, pval])
elseif nt == 1 && nq == 1
setState_Tsat(tp, [tval,qval]);
elseif np == 1 && nq == 1
Expand Down
16 changes: 16 additions & 0 deletions interfaces/matlab/toolbox/@ThermoPhase/setState_DP.m
@@ -0,0 +1,16 @@
function setState_DP(tp, dp)
% SETSTATE_DP Set the density and pressure.
% setState_DP(tp, [density,p])
% The density is set first, then the pressure is set by
% changing the temperature holding the density and
% chemical composition fixed.
%
% :param tp:
% Instance of class :mat:func:`ThermoPhase` (or another
% class derived from ThermoPhase)
% :param dp:
% Vector of length 2 containing the desired values for the density (kg/m^3)
% and pressure (Pa)
%

thermo_set(tp.tp_id, 26, dp);
2 changes: 1 addition & 1 deletion interfaces/matlab/toolbox/@ThermoPhase/setState_RP.m
Expand Up @@ -12,5 +12,5 @@ function setState_RP(tp, rp)
% Vector of length 2 containing the desired values for the density (kg/m^3)
% and pressure (Pa)
%

warning('To be removed after Cantera 3.0. Renamed to setState_DP.')
thermo_set(tp.tp_id, 26, rp);
2 changes: 1 addition & 1 deletion src/matlab/thermomethods.cpp
Expand Up @@ -63,7 +63,7 @@ static void thermoset(int nlhs, mxArray* plhs[],
ierr = thermo_setState_Tsat(th,ptr[0],ptr[1]);
break;
case 26:
ierr = thermo_set_RP(th,ptr);
ierr = thermo_set_DP(th,ptr);
break;
case 27:
ierr = thermo_set_ST(th,ptr);
Expand Down

0 comments on commit 474dc29

Please sign in to comment.