User talk:Sidharth: Difference between revisions

From ASCEND
Jump to navigation Jump to search
Sidharth (talk | contribs)
No edit summary
Sidharth (talk | contribs)
No edit summary
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
FPROPS uses function pointers from the underlying correlation (helmholtz or Pengrob) to calculate fundamental quantities with Temperature and rho as the input. Following are those functions of fprops :-
FPROPS uses function pointers from the underlying correlation (helmholtz or Pengrob) to calculate fundamental quantities with Temperature and <math> \rho</math> as the input. Following are those functions of fprops :-




Line 12: Line 12:
To begin with we can tabulate the following functions:  
To begin with we can tabulate the following functions:  


#helmholtz_p
<code language="C">
#helmholtz_s
*helmholtz_p
#helmholtz_u
*helmholtz_s
#helmholtz_g
*helmholtz_u
#helmholtz_h
*helmholtz_g
 
*helmholtz_h
</code>
In order to use look up tables for TTSE method inside these routines we need to complete the set of all partial derivatives we need :-
In order to use look up tables for TTSE method inside these routines we need to complete the set of all partial derivatives we need :-


Line 27: Line 28:
   \frac{\partial^2 X}{\partial \rho \partial T} </math>
   \frac{\partial^2 X}{\partial \rho \partial T} </math>


Many of the partial derivatives are already listed in helmholtz.c. Specifically the new ones we need to implement are:
Many of the partial derivatives are already listed in helmholtz.c. Specifically the new 18 ones we need to implement are:




{| class="wikitable"
{| class="wikitable" style="text-align: center"
|-
|-
! Variable
! Variable
! Partial derivative wrt T
! Partial derivative<br> with  T constant
! Partial derivative wrt <math>\rho</math>
! Partial derivative<br> with  <math>\rho</math> constant
! Partial second derivative wrt <math>\rho</math>
! Partial second derivative<br> with  <math>\rho</math> constant
! Partial second derivative wrt <math>T</math>
! Partial second derivative<br> with  <math>T</math> constant
! Partial mixed second derivative wrt <math>\rho and T</math>
! Partial mixed second <br> derivative
|-
|-
|Pressure, P
|Pressure, P
|   
<already implemented>
|  
| <already implemented>
|   
<already implemented>
| helmholtz_d2pdT2_rho()    
|<code language="C"> helmholtz_d2pdT2_rho() </code>     
  <math>\frac{\partial^2 p}{\partial (T^2)} </math>  
<math>\frac{\partial^2 p}{\partial (T^2)} </math>  
|  helmholtz_d2pdrhodT()      
|<code language="C"> helmholtz_d2pdrhodT() </code>     
  <math>\frac{\partial^2 p}{\partial (T \rho)} </math>  
<math>\frac{\partial^2 p}{\partial (T \rho)} </math>  
|-
|-
|Enthalpy, h
|Enthalpy, h
|  
| <already implemented>
|  
| <already implemented>
|helmholtz_d2hdrho2_T()    
|<code language="C"> helmholtz_d2hdrho2_T() </code> 
  <math>\frac{\partial^2 h}{\partial \rho^2}\bigg|_{T}</math>  
<math>\frac{\partial^2 h}{\partial \rho^2}\bigg|_{T}</math>  
|helmholtz_d2hdT2_rho()    
|<code language="C"> helmholtz_d2hdT2_rho() </code> 
  <math>\frac{\partial^2 h}{\partial T ^2}\bigg|_{\rho}</math>  
<math>\frac{\partial^2 h}{\partial T ^2}\bigg|_{\rho}</math>  
|helmholtz_d2hdrhodT()    
|<code language="C"> helmholtz_d2hdrhodT() </code> 
  <math>\frac{\partial^2 h}{\partial (T \rho)} </math>  
<math>\frac{\partial^2 h}{\partial (T \rho)} </math>  
|-
|-
|Internal Energy, u
|Internal Energy, u
|  
| <already implemented>
|   
<already implemented>
|helmholtz_d2udrho2_T()      
|<code language="C"> helmholtz_d2udrho2_T() </code>   
  <math>\frac{\partial^2 u}{\partial \rho^2}\bigg|_{T}</math>  
<math>\frac{\partial^2 u}{\partial \rho^2}\bigg|_{T}</math>  
|helmholtz_d2udT2_rho()      
|<code language="C">helmholtz_d2udT2_rho()   </code>   
  <math>\frac{\partial^2 u}{\partial T^2}\bigg|_{\rho}</math>  
<math>\frac{\partial^2 u}{\partial T^2}\bigg|_{\rho}</math>  
|helmholtz_d2udrhodT()      
|<code language="C"> helmholtz_d2udrhodT() </code>     
  <math>\frac{\partial^2 u}{\partial (T \rho)}</math>
<math>\frac{\partial^2 u}{\partial (T \rho)}</math>
|-
|-
|Entropy, s
|Entropy, s
|helmholtz_dsdT_rho()        
|<code language="C"> helmholtz_dsdT_rho() </code>         
  <math>\frac{\partial s}{\partial T}\bigg|_{\rho}</math>   
<math>\frac{\partial s}{\partial T}\bigg|_{\rho}</math>   
|helmholtz_dsdrho_T()        
|<code language="C"> helmholtz_dsdrho_T() </code>     
  <math>\frac{\partial s}{\partial \rho}\bigg|_{T}</math>   
<math>\frac{\partial s}{\partial \rho}\bigg|_{T}</math>   
|helmholtz_d2sdrho2_T()       
|<code language="C"> helmholtz_d2sdrho2_T() </code>        
  <math>\frac{\partial^2 s}{\partial \rho^2}\bigg|_{T}</math>  
<math>\frac{\partial^2 s}{\partial \rho^2}\bigg|_{T}</math>  
|helmholtz_d2sdT2_rho()    
|<code language="C"> helmholtz_d2sdT2_rho() </code>   
  <math>\frac{\partial^2 s}{\partial T^2}\bigg|_{\rho}</math>  
<math>\frac{\partial^2 s}{\partial T^2}\bigg|_{\rho}</math>  
|helmholtz_d2sdrhodT()         
|<code language="C"> helmholtz_d2sdrhodT() </code>        
  <math>\frac{\partial^2 s}{\partial (T \rho)}</math>
<math>\frac{\partial^2 s}{\partial (T \rho)}</math>
|-
|-
|Gibbs Free Energy, g
|Gibbs Free Energy, g
|helmholtz_dgdT_rho()        
|<code language="C">helmholtz_dgdT_rho()</code>     
  <math>\frac{\partial g}{\partial T}\bigg|_{\rho}</math>   
<math>\frac{\partial g}{\partial T}\bigg|_{\rho}</math>   
|helmholtz_dgdrho_T()        
|<code language="C">helmholtz_dgdrho_T()</code>         
  <math>\frac{\partial g}{\partial \rho}\bigg|_{T}</math>   
<math>\frac{\partial g}{\partial \rho}\bigg|_{T}</math>   
|helmholtz_d2gdrho2_T()       
|<code language="C">helmholtz_d2gdrho2_T() </code>        
  <math>\frac{\partial^2 g}{\partial \rho^2}\bigg|_{T}</math>  
<math>\frac{\partial^2 g}{\partial \rho^2}\bigg|_{T}</math>  
|helmholtz_d2gdT2_rho()       
|<code language="C">helmholtz_d2gdT2_rho() </code>        
  <math>\frac{\partial^2 g}{\partial T^2}\bigg|_{\rho}</math>  
<math>\frac{\partial^2 g}{\partial T^2}\bigg|_{\rho}</math>  
|helmholtz_d2gdrhodT()      
|<code language="C">helmholtz_d2gdrhodT() </code>       
  <math>\frac{\partial^2 g}{\partial (T \rho)}</math>
<math>\frac{\partial^2 g}{\partial (T \rho)}</math>
|}
|}


Line 99: Line 100:


Third partial derivative of ideal part of helmholtz (all other partial derivatives invloving delta are zero) in file cp0.c
Third partial derivative of ideal part of helmholtz (all other partial derivatives invloving delta are zero) in file cp0.c
<code language="C">
*ideal_phi_tautautau()
*ideal_phi_tautautau()
</code>


Third derivative of helmholtz residual function, with respect to delta once and tau twice
Third derivative of helmholtz residual function, with respect to delta once and tau twice
<code language="C">
*helm_resid_deltautau()
*helm_resid_deltautau()
</code>
Third derivative of helmholtz residual function, with respect to delta twice and tau once  
Third derivative of helmholtz residual function, with respect to delta twice and tau once  
<code language="C">
*helm_resid_deldeltau()
*helm_resid_deldeltau()
</code>
Third derivative of helmholtz residual function, with respect to tau thrice
<code language="C">
*helm_resid_tautautau()
</code>


 
Once we have the above four routines then we can compute all the functions in the table. The detailed expressions to be evaluated can be found in this reference - [http://gfzpublic.gfz-potsdam.de/pubman/item/escidoc:247373:5/component/escidoc:306833/247373.pdf]
Once we have the above three routines then we can compute all the functions in the table. The detailed expressions to be evaluated can be found in this reference - [http://gfzpublic.gfz-potsdam.de/pubman/item/escidoc:247373:5/component/escidoc:306833/247373.pdf]

Latest revision as of 02:27, 17 June 2015

FPROPS uses function pointers from the underlying correlation (helmholtz or Pengrob) to calculate fundamental quantities with Temperature and <math> \rho</math> as the input. Following are those functions of fprops :-


fprops_p() fprops_u() fprops_h() fprops_s() fprops_g()
fprops_dpdrho_T() fprops_alphap() fprops_betaP() fprops_a()
fprops_cp() fprops_cv() fprops_w()

Both the underlying correlations provide these 13 functions calculated from first principles, with T and <math>\rho</math> as inputs. So the TTSE implementation for a specific liquid and a specific correlation (H or P) should eventually generate tables for each of the above 13 entries. For the saturation function fprops_sat(), takes only 1 input (temperature) and returns saturated liquid density, saturated vapour density and the saturation pressure. This function involves solving equations iteratively and tabulation should speed up calculation on saturation curve.

To begin with we can tabulate the following functions:

  • helmholtz_p
  • helmholtz_s
  • helmholtz_u
  • helmholtz_g
  • helmholtz_h

In order to use look up tables for TTSE method inside these routines we need to complete the set of all partial derivatives we need :-

For each of the above variable X (where X is either of P,s,u,g and h) we need <math> \frac{\partial X}{\partial T}\bigg|_{\rho} ,

\frac{\partial^2 X}{\partial T^2}\bigg|_{\rho} ,
   \frac{\partial X}{\partial \rho}\bigg|_{T} , 
\frac{\partial^2 X}{\partial \rho^2}\bigg|_{T}</math>   and <math>
  \frac{\partial^2 X}{\partial \rho \partial T} </math>

Many of the partial derivatives are already listed in helmholtz.c. Specifically the new 18 ones we need to implement are:


Variable Partial derivative
with T constant
Partial derivative
with <math>\rho</math> constant
Partial second derivative
with <math>\rho</math> constant
Partial second derivative
with <math>T</math> constant
Partial mixed second
derivative
Pressure, P <already implemented> <already implemented> <already implemented> helmholtz_d2pdT2_rho()

<math>\frac{\partial^2 p}{\partial (T^2)} </math>

helmholtz_d2pdrhodT()

<math>\frac{\partial^2 p}{\partial (T \rho)} </math>

Enthalpy, h <already implemented> <already implemented> helmholtz_d2hdrho2_T()

<math>\frac{\partial^2 h}{\partial \rho^2}\bigg|_{T}</math>

helmholtz_d2hdT2_rho()

<math>\frac{\partial^2 h}{\partial T ^2}\bigg|_{\rho}</math>

helmholtz_d2hdrhodT()

<math>\frac{\partial^2 h}{\partial (T \rho)} </math>

Internal Energy, u <already implemented> <already implemented> helmholtz_d2udrho2_T()

<math>\frac{\partial^2 u}{\partial \rho^2}\bigg|_{T}</math>

helmholtz_d2udT2_rho()

<math>\frac{\partial^2 u}{\partial T^2}\bigg|_{\rho}</math>

helmholtz_d2udrhodT()

<math>\frac{\partial^2 u}{\partial (T \rho)}</math>

Entropy, s helmholtz_dsdT_rho()

<math>\frac{\partial s}{\partial T}\bigg|_{\rho}</math>

helmholtz_dsdrho_T()

<math>\frac{\partial s}{\partial \rho}\bigg|_{T}</math>

helmholtz_d2sdrho2_T()

<math>\frac{\partial^2 s}{\partial \rho^2}\bigg|_{T}</math>

helmholtz_d2sdT2_rho()

<math>\frac{\partial^2 s}{\partial T^2}\bigg|_{\rho}</math>

helmholtz_d2sdrhodT()

<math>\frac{\partial^2 s}{\partial (T \rho)}</math>

Gibbs Free Energy, g helmholtz_dgdT_rho()

<math>\frac{\partial g}{\partial T}\bigg|_{\rho}</math>

helmholtz_dgdrho_T()

<math>\frac{\partial g}{\partial \rho}\bigg|_{T}</math>

helmholtz_d2gdrho2_T()

<math>\frac{\partial^2 g}{\partial \rho^2}\bigg|_{T}</math>

helmholtz_d2gdT2_rho()

<math>\frac{\partial^2 g}{\partial T^2}\bigg|_{\rho}</math>

helmholtz_d2gdrhodT()

<math>\frac{\partial^2 g}{\partial (T \rho)}</math>



To evaluate these drivatives we need the underlying partial derivatives of the residual and the ideal part of helmholtz function. So the three new functions needed in helmholtz.c and cp0.c

Third partial derivative of ideal part of helmholtz (all other partial derivatives invloving delta are zero) in file cp0.c

  • ideal_phi_tautautau()

Third derivative of helmholtz residual function, with respect to delta once and tau twice

  • helm_resid_deltautau()

Third derivative of helmholtz residual function, with respect to delta twice and tau once

  • helm_resid_deldeltau()

Third derivative of helmholtz residual function, with respect to tau thrice

  • helm_resid_tautautau()

Once we have the above four routines then we can compute all the functions in the table. The detailed expressions to be evaluated can be found in this reference - [1]