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

Parallel water pumps not converging; possible fix: derivative of characteristic pump curve not calculated? #693

Open
LasseBKMoeller opened this issue Feb 14, 2025 · 1 comment

Comments

@LasseBKMoeller
Copy link

LasseBKMoeller commented Feb 14, 2025

In a simple water grid setup with one external grid, one sink and two parallel pumps I had the problem that the pipeflow would not converge.

Minimal example:

#create empty net
net = pp.create_empty_network(fluid="water")

#create junctions
j1 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 1")
j2 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 2")
j3 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 3")
j4 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 4")
j5 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 5")
j6 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 6")
j7 = pp.create_junction(net, pn_bar=2, tfluid_k=293.15, name="Junction 7")


#create junction elements
ext_grid = pp.create_ext_grid(net, junction=j1, p_bar=3, t_k=293.15, name="Grid Connection")
sink = pp.create_sink(net, junction=j7, mdot_kg_per_s=44, name="Sink")

#create branch elements
pipe1 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j1, to_junction=j2, length_km=0.01, diameter_m=0.23, name="Pipe 1")
pipe2 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j2, to_junction=j3, length_km=0.10, diameter_m=0.23, name="Pipe 2")
pipe3 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j2, to_junction=j4, length_km=0.09, diameter_m=0.23, name="Pipe 3")
pipe4 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j5, to_junction=j7, length_km=0.03, diameter_m=0.23, name="Pipe 4")
pipe5 = pp.create_pipe_from_parameters(net, k_mm = 0.2, from_junction=j6, to_junction=j7, length_km=0.02, diameter_m=0.23, name="Pipe 5")

pump1 = pp.create_pump(net, from_junction=j3, to_junction=j5, std_type= "P2" , name="Pump 1")
pump2 = pp.create_pump(net, from_junction=j4, to_junction=j6, std_type= "P2" , name="Pump 2")

pp.set_user_pf_options(net, max_iter_hyd = 1000, alpha = 1)
pp.pipeflow(net)

If I would choose alpha to be very small for some setups it would converge for some it would't.

I did some experimenting and it seems like the derivative of the characteristic pump curve needed for the newton algorithm is not calculated, ie. JAC_DERIV_DM for the pumps in the branch_pit are always 0.
I wrote one function in the std_type_class.py for class PumpStdType(RegressionStdType) to calculate the derivative from the regression polynomial and added the necessary adaption_after_derivatives_hydraulic() function for the class Pump(BranchWZeroLengthComponent) in pump_component.py and I got it to converge quickly and with $\alpha = 1$.

I dont have git installed at the moment so I cannot contribute directly but I wanted to know if it is true that the derivative for the characteristic curve does not get calculated but is actually needed for the algorithm. Thanks!

@dlohmeier
Copy link
Collaborator

Dear @LasseBKMoeller ,

thanks for raising this issue. I am not the expert on the pump model, but it seems to me that you are right with your assumptions. As far as I understand, the following happens: The derivative JAC_DERIV_DM is set to 0 for pumps (due to length 0 of the component), and the pressure difference between the two nodes only depends on the pressure lift PL. It is derived iteratively from the resulting mass flow defined by the node equations. However, two parallel pumps can split the mass flow at any rate, so convergence might be an issue here. @SimonRubenDrauz maybe you can comment on that.
Your solution sounds very logical, but it seems like you would not like to contribute it yourself. Would you be willing to share your adaptions here so we can use it for an improved pump model?

Thanks and kind regards!

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

No branches or pull requests

2 participants