function state2 = getStateAfterIsoentropicProcessConst(state1, state2, gas) state1HasTemperature = isfield(state1, "T") ; state2HasPressure = isfield(state2, "p") ; V = getVname(state1) ; k = gas.k ; if state2HasPressure if state1HasTemperature equation.variableNames = [ "T" "p" "const"] ; equation.exponents = [ k -(k-1) -1 ] ; otherVariableName = V ; else equation.variableNames = [ "p" V "const"] ; equation.exponents = [ 1 k -1 ] ; otherVariableName = "T" ; end else equation.variableNames = [ "T" V "const"] ; equation.exponents = [ 1 (k-1) -1 ] ; otherVariableName = "p" ; end variableName = getUnknownVariableNameFromConstEquation(state2, equation) ; state2 = updateStateFromConstEquation(variableName, state1, state2, equation) ; if isfield(state1, otherVariableName) state2.(otherVariableName) = getVariableFromStateEquation(otherVariableName, state2, gas) ; end end