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

functionality for subcooling and superheating #64

Merged
merged 17 commits into from
Apr 16, 2019

Conversation

fwitte
Copy link
Member

@fwitte fwitte commented Apr 11, 2019

Add functionality for setting subcooling oder superheating temperature. With this feature you are able to specify the temperature difference to boiling point (Td_bp). I have added an example code:

nw = nwk.network(['water', 'air'], T_unit='C', p_unit='bar', h_unit='kJ / kg')

so = cmp.source('so')
si = cmp.sink('si')

c = con.connection(so, 'out1', si, 'in1')

nw.add_conns(c)

c.set_attr(p=1, fluid={'water': 1, 'air': 0}, m=5, Td_bp=-5) # temperature is 5 K below boiling point

nw.solve('design')
nw.print_results()

c.set_attr(p=1, fluid={'water': 1, 'air': 0}, m=5, Td_bp=5) # temperature is 5 K above boiling point

nw.solve('design')
nw.print_results()

resolve #65

@fwitte
Copy link
Member Author

fwitte commented Apr 16, 2019

I will add the option the predefine the state of pure fluids for connections using the keyword state. The convergence check manipulates enthalpy values for convergence stability, if the keyword state is passed.

Usage:

from tespy import cmp, con, nwk
import numpy as np

nw = nwk.network(['water'], T_unit='C', p_unit='bar', h_unit='kJ / kg')

so = cmp.source('so')
he = cmp.heat_exchanger_simple('he')
si = cmp.sink('si')

c1 = con.connection(so, 'out1', he, 'in1')
c2 = con.connection(he, 'out1', si, 'in1')

nw.add_conns(c1, c2)

he.set_attr(pr=0.99, Q=-10e3)

c1.set_attr(p=1, fluid={'water': 1}, T=120)
# the state is just above boiling point, an error in jacobian matrix is very likely
c2.set_attr(T=99.5)

nw.solve('design')

# using state='g' the convergence_check will keep the enthalpy values for
# this connection just above the wet steam area
c2.set_attr(state='g')
nw.solve('design')

@fwitte fwitte merged commit bfcc1b0 into dev Apr 16, 2019
@fwitte
Copy link
Member Author

fwitte commented Apr 16, 2019

Merged.

@fwitte fwitte deleted the features/boiling_point_temperature_difference branch April 16, 2019 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve convergence stability for temperature specification near boiling point
1 participant