The Williams-Hazen tables show that for 3000 gpm (STP) water through 100 feet of pipe, a 10 inch pipe should loose about 3.3 psi (Delta P).
In running the pipe unit, I can only get convergence after increaseing pressure to 2000 psi. I tried SI,CGS,and ENG
units entry but all fail. Is it something obvisous or are there still things to work out in DWSIM Pipe? Roualt and Simple LLE for PP and flash. How do I upload my simulaiton if that would help?
Many Thanks and Regards, Howard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can download the PlatformDistributionPackages.zip file and unpack the contents of the "Windows" folder inside your DWSIM installation folder, overwriting existing files.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe the diameter unit was OK I didn't find a problem in the calcs using the Segment.DI.
I spent the last few days on the Beggs Brill and have the fix for Liquid only flow. Similar fix for gas I would guess. I converted the BeggsBrill.vp to python, as not sure if I could get the github into my current VB environment.
So from the DWSIM 5.1 BeggsBrill.vb:
ln 37: Dim ResVector(4) As Object
38:
ln 39: If qv = 0.0# Then
40:
41: ql = ql / 3600 / 24 **change
42: Dim vlo = ql / (Math.PI * D ^ 2 / 4) 43: mul = 0.001 * mul **change
44: Dim Re_fit = NRe(rhol, vlo, D, mul)
FIX
ln 37: Dim ResVector(4) As Object
38:
ln 39: If qv = 0.0# Then
40:
41: ql = ql <===
42: Dim vlo = ql / (Math.PI * D ^ 2 / 4)
43: mul = mul <===*
44: Dim Re_fit = NRe(rhol, vlo, D, mul)
The Beggs need ENG units after NRe calculation checked against the python fluids package
I would also recommend that the friction factor uses the Clamond func:
ref:'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, Caleb Bell Caleb.Andrew.Bell@gmail.com
def Clamond(Re, eD):
r'''Calculates Darcy friction factor using a solution accurate to almost
machine precision. Recommended very strongly. For details of the algorithm,
see [1]_.
Parameters----------Re : float Reynolds number,[-]eD : float Relative roughness,[-]Returns-------fd : float Darcy friction factor [-]Notes-----This is a highly optimized function, 4 times faster than the solution usingthe LambertW function, and faster than many other approximations which are much less accurate.The code used here is only slightly modified than that in [1]_, for furtherperformance improvements.Examples-------->>> Clamond(1E5, 1E-4)0.01851386607747165References----------..[1] Clamond, Didier. "Efficient Resolution of the Colebrook Equation." Industrial & Engineering Chemistry Research 48, no. 7 (April 1, 2009): 3665-71. doi:10.1021/ie801626g. http://math.unice.fr/%7Edidierc/DidPublis/ICR_2009.pdf'''X1 = eD*Re*0.1239681863354175460160858261654858382699 X2 = log(Re) - 0.7793974884556819406441139701653776731705 F = X2 - 0.2X1F = X1 + FX1F1 = 1.+ X1FE = (log(X1F) - 0.2)/float((X1F1))F = F - (X1F1 + 0.5*E)*E*(X1F)/float((X1F1 + E*(1.+ E/3.)))X1F = X1 + FX1F1 = 1.+ X1FE = (log(X1F) + F - X2)/(X1F1)F = F - (X1F1 + 0.5*E)*E*(X1F)/ float((X1F1 + E*(1.+ E/3.)))return 1.325474527619599502640416597148504422899/float((F*F))
Kindest Regards,
Howard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The issue with your calculation was that when designing the new UI, I've thought that the diameters were being stored internally in meters (as they should be), but they're actually being stored in inches, due to the usage of some legacy code - I kept it that way for compatibility purposes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Also, as an aside issue probably MY casting or interop problem, but I could'nt get Visco or Cp from script in:
OK IAPWS_IF97 = Thermodynamics.PropertyPackages.Auxiliary.IAPWS_IF97()
OK print(IAPWS_IF97)
print('IAPWS_IF97_cpW',IAPWS_IF97.cpW(oms.Phases[1].Properties.temperature,oms.Phases[1].Properties.pressure))
print('IAPWS_IF97_viscW',IAPWS_IF97.viscW(oms.Phases[1].Properties.temperature,oms.Phases[1].Properties.pressure))
oms is the Pipe problem water stream
return values [-1,0,0]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Before you pull out your hair ;) one last correction to beggs brill.vb:
ln 54: Dim dPl = fric * L / D * vlo ^ 2 / 2 * rhol ** change
ln 54: Dim dPl = fric * L / D * vlo ^ 2 / (2 * g) <==* where g = 9.80665000 is gravitation constant
for dPl: Classic Darcy formula
I'm working on generating the calculated tables for the pipe in Pipe so that you can see.
H
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Daniel,
I MADE A MISTAKE of trying to put 'g' in the DP calc, as I though everything was converted to ENG units and worse wrong 'g'.
HOWEVER I still can't figure out how to send the correct units.
The reason I looked at the code was that the units sent via PIPE to the BB routine are done internally. Even changing the System units to m3/d and cP it seems that BB gets mul in Pa sec and ql in m3/s, not sure about D. All I know is that I'm getting negative pressure warnings when I shouldn't.
Have you tried to solve a simple water flow DP calc so I have an example?
or
How do I get the PIPE to correctly calc liquid only DP?
Sorry to be a PITA.
Regards,
Howard
image my pyhton pipe flow calcs matched to reference published DP's:
SO with DP working in Pipe the output pressure is updated but NOT the temperature.
In Python no access to the Pipe.PipeResults or PIpe.?..TermperaturaInicial which I believe is updated with the final Tout value. This means no work around to update by script the PIPE Out Stream Temp.
Any Ideas,
Regards,
Howard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know that it sounds a little too much complicated, but the pipe code is from almost 10 years ago, I didn't have much coding knowledge at that time. If it just worked, then I would move on to the next task. :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks - got it. I don't think it the code is bad(too complex) there is just alot of it and I have only been looking at it for a few weeks. Coders can always refactor more, but you have it going live so that great.
I'm using a manual update script, but am afraid it might be something else I doing wrong.
1) For some UOs like HX and PIPE with certain Flash Algos, while successful, fail to update properties.
-- See Uploaded file --
Specifically in the attached PIPE I had to add a manual update to Temperature.
2) Why is there a DT of 100-40K for a 1.6 psia drop in 100 ft of pipe. Streams using the same PP(property package) and Flash give reasonable results, so I would think PIPE should also flash ok too. This is related to the PP and Flash selected for PIPE as starting fresh with water only the Peng-Robinson(PR) pp gives reasonable values per Last uploaded example above.
I looked at the code you sent and can't find where the update to stream is missing. It seems there might be some boxing issues. I did verify (see script) that PIPE has the results, which can be seen in the property tables as well, and use those values to update stream Temp.
Hi,
The Williams-Hazen tables show that for 3000 gpm (STP) water through 100 feet of pipe, a 10 inch pipe should loose about 3.3 psi (Delta P).
In running the pipe unit, I can only get convergence after increaseing pressure to 2000 psi. I tried SI,CGS,and ENG
units entry but all fail. Is it something obvisous or are there still things to work out in DWSIM Pipe? Roualt and Simple LLE for PP and flash. How do I upload my simulaiton if that would help?
Many Thanks and Regards, Howard
Ahh Here is the sim, tables ref and python script to get properties from flowsheet objects.
H
Check the pipe's internal and external diameters.
When working with Water only, it is preferable to use the Steam Tables Property Package.
Regards
Daniel
Hi Howard,
Actually there was an error in the diameter unit conversion on the New UI. I've fixed the bug on this intermediate release: https://github.com/DanWBR/dwsim5/releases/latest
You can download the PlatformDistributionPackages.zip file and unpack the contents of the "Windows" folder inside your DWSIM installation folder, overwriting existing files.
Daniel,
Maybe the diameter unit was OK I didn't find a problem in the calcs using the Segment.DI.
I spent the last few days on the Beggs Brill and have the fix for Liquid only flow. Similar fix for gas I would guess. I converted the BeggsBrill.vp to python, as not sure if I could get the github into my current VB environment.
So from the DWSIM 5.1 BeggsBrill.vb:
FIX
ln 37: Dim ResVector(4) As Object
38:
ln 39: If qv = 0.0# Then
40:
41: ql = ql <===
42: Dim vlo = ql / (Math.PI * D ^ 2 / 4)
43: mul = mul <===*
44: Dim Re_fit = NRe(rhol, vlo, D, mul)
The Beggs need ENG units after NRe calculation checked against the python fluids package
I would also recommend that the friction factor uses the Clamond func:
ref:'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, Caleb Bell Caleb.Andrew.Bell@gmail.com
def Clamond(Re, eD):
r'''Calculates Darcy friction factor using a solution accurate to almost
machine precision. Recommended very strongly. For details of the algorithm,
see [1]_.
Kindest Regards,
Howard
The flow rates must be sent to BB calc routine in m3/d, and viscosity in cP. The code is correct:
https://github.com/DanWBR/dwsim5/blob/master/DWSIM.UnitOperations/Unit%20Operations/Pipe.vb#L395
The issue with your calculation was that when designing the new UI, I've thought that the diameters were being stored internally in meters (as they should be), but they're actually being stored in inches, due to the usage of some legacy code - I kept it that way for compatibility purposes.
Daniel,
Also the reason using different PropertyPackage is to handle soultions other than water i.e. electrolytes, salts etc.
Daniel,
Also, as an aside issue probably MY casting or interop problem, but I could'nt get Visco or Cp from script in:
OK IAPWS_IF97 = Thermodynamics.PropertyPackages.Auxiliary.IAPWS_IF97()
OK print(IAPWS_IF97)
print('IAPWS_IF97_cpW',IAPWS_IF97.cpW(oms.Phases[1].Properties.temperature,oms.Phases[1].Properties.pressure))
print('IAPWS_IF97_viscW',IAPWS_IF97.viscW(oms.Phases[1].Properties.temperature,oms.Phases[1].Properties.pressure))
oms is the Pipe problem water stream
return values [-1,0,0]
You need to send the pressure in bars, not in Pa: https://github.com/DanWBR/dwsim5/blob/master/DWSIM.Thermodynamics/Property%20Packages/SteamTables.vb#L819
Daniel,
Before you pull out your hair ;) one last correction to beggs brill.vb:
ln 54: Dim dPl = fric * L / D * vlo ^ 2 / 2 * rhol ** change
ln 54: Dim dPl = fric * L / D * vlo ^ 2 / (2 * g) <==* where g = 9.80665000 is gravitation constant
for dPl: Classic Darcy formula
I'm working on generating the calculated tables for the pipe in Pipe so that you can see.
H
Daniel,
I MADE A MISTAKE of trying to put 'g' in the DP calc, as I though everything was converted to ENG units and worse wrong 'g'.
HOWEVER I still can't figure out how to send the correct units.
The reason I looked at the code was that the units sent via PIPE to the BB routine are done internally. Even changing the System units to m3/d and cP it seems that BB gets mul in Pa sec and ql in m3/s, not sure about D. All I know is that I'm getting negative pressure warnings when I shouldn't.
Have you tried to solve a simple water flow DP calc so I have an example?
or
How do I get the PIPE to correctly calc liquid only DP?
Sorry to be a PITA.
Regards,
Howard
image my pyhton pipe flow calcs matched to reference published DP's:
Daniel,
Third time of reloading your update worked. For some reason on my side on file was not getting overwritten on first two tries.
SO... You provided a solution within a few hours after my original post that is awesome. It only took me a few weeks to get it.
Regards,
Howard
Hi Daniel,
SO with DP working in Pipe the output pressure is updated but NOT the temperature.
In Python no access to the Pipe.PipeResults or PIpe.?..TermperaturaInicial which I believe is updated with the final Tout value. This means no work around to update by script the PIPE Out Stream Temp.
Any Ideas,
Regards,
Howard
Actually you do have access to the hydraulic profile. Pipe.PipeProfile.Sections is a sorted integer dictionary of "PipeSection": http://dwsim.inforside.com.br/api_help5/html/P_DWSIM_UnitOperations_UnitOperations_Auxiliary_Pipe_PipeProfile_Sections.htm
Each "PipeSection" has a property called "Resultados" (Results), which is a list of "PipeResults", where you will find the calculated values: http://dwsim.inforside.com.br/api_help5/html/T_DWSIM_UnitOperations_UnitOperations_Auxiliary_Pipe_PipeResults.htm
This is the code that displays the results on the new UI:
https://github.com/DanWBR/dwsim5/blob/master/DWSIM.UI.Desktop.Editors/General/Results.cs#L54
https://github.com/DanWBR/dwsim5/blob/master/DWSIM.UI.Desktop.Editors/General/Results.cs#L279
The pipe temperature profile is calculated from the heat balance, starting with the inlet stream temperature, using defined thermal profile: https://github.com/DanWBR/dwsim5/blob/master/DWSIM.UnitOperations/Unit%20Operations/Pipe.vb#L318
I know that it sounds a little too much complicated, but the pipe code is from almost 10 years ago, I didn't have much coding knowledge at that time. If it just worked, then I would move on to the next task. :-)
Thanks - got it. I don't think it the code is bad(too complex) there is just alot of it and I have only been looking at it for a few weeks. Coders can always refactor more, but you have it going live so that great.
I'm using a manual update script, but am afraid it might be something else I doing wrong.
1) For some UOs like HX and PIPE with certain Flash Algos, while successful, fail to update properties.
-- See Uploaded file --
Specifically in the attached PIPE I had to add a manual update to Temperature.
2) Why is there a DT of 100-40K for a 1.6 psia drop in 100 ft of pipe. Streams using the same PP(property package) and Flash give reasonable results, so I would think PIPE should also flash ok too. This is related to the PP and Flash selected for PIPE as starting fresh with water only the Peng-Robinson(PR) pp gives reasonable values per Last uploaded example above.
I looked at the code you sent and can't find where the update to stream is missing. It seems there might be some boxing issues. I did verify (see script) that PIPE has the results, which can be seen in the property tables as well, and use those values to update stream Temp.
Regards,