Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of Clapeyron and robust reverse flow modelling #3228

Open
branch171 opened this issue Nov 21, 2024 · 1 comment
Open

Use of Clapeyron and robust reverse flow modelling #3228

branch171 opened this issue Nov 21, 2024 · 1 comment
Labels
question Further information is requested

Comments

@branch171
Copy link

Using Clapeyron for properties(enthalpy, density etc) and robust modelling with allowance for reverse flow has been challenging

However, I have a working solution attached for those interested.

To circumvent the complication of instream, actualstream and other Modelica functionality, I have explicity modeled both the forward and reverse flow connectors. See attached

The only annoying issue is the warning associated with vector symbolic variables. These have been noted previously but they come up always with Clapeyron as the composition is a vector and all Clapeyron function calls need to be @register_symbolic functions. Hence:

function rho_pTz(model,p,T,z)
return 1/volume(model,p,T,z)
end
@register_symbolic rho_pTz(model::EoSModel,p::Float64,T::Float64,z::Array{Float64, 1})

this results in a warning as follows:

Warning: Internal error: Variable (vol₊zᵢ(t))[2] was marked as being in 0 ~ Main.rho_pTz(PR{AlyLeeIdeal, PRAlpha, NoTranslation, vdW1fRule}("nitrogen", "oxygen", "argon", "carbon dioxide"), vol₊p(t), vol₊T(t), vol₊zᵢ(t)) - vol₊rho(t), but was actually zero
└ @ ModelingToolkit.StructuralTransformations ~/.julia/packages/ModelingToolkit/zfOUk/src/structural_transformation/utils.jl:237

one for each variable in the vector so 4 molefractions zᵢ(t)[ 1..4] and this for eery Clapeyron function called.

It would be nice if we coud suppress this warning as it is fine to note it but it provides no value or issues to the model.

ReverseFlow_FWD_REV_Connectors_Clapeyron_Rev1.zip

@branch171 branch171 added the question Further information is requested label Nov 21, 2024
@ChrisRackauckas
Copy link
Member

You might want to check out ProcessSimulator.jl which is being put together to cover this domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants