summaryrefslogtreecommitdiff
path: root/Utilib/src/FREESTEAM.f90
blob: 94dfc7380fe763503593d2644ed4aa040ecdfb35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
!
!-----------------------------------------------------------------------
!
!Purpose:
! Fortran-2003 bindings for freesteam (light water).
!
!Copyright:
! Copyright (C) 2012 Ecole Polytechnique de Montreal
! This library is free software; you can redistribute it and/or
! modify it under the terms of the GNU Lesser General Public
! License as published by the Free Software Foundation; either
! version 2.1 of the License, or (at your option) any later version.
!
!Author(s): A. Hebert
!
!-----------------------------------------------------------------------
!
subroutine THMSAP(p, t)
! return the saturation pressure (Pa) as a function of the temperature (K)
   use, intrinsic :: iso_c_binding
   real :: p, t
   real(c_double) :: td
   interface 
      real(c_double) function region4_psat_T (td) bind(c, name='freesteam_region4_psat_T')
      use, intrinsic :: iso_c_binding
      real(c_double), value :: td
      end function region4_psat_T
   end interface
   td=t
   p = real(region4_psat_T (td))
end subroutine THMSAP
!
subroutine THMSAT(p, t)
   ! return the saturation temperature (K) as a function of the pressure (Pa)
   use, intrinsic :: iso_c_binding
   real :: p, t
   real(c_double) :: pd
   interface 
      real(c_double) function region4_Tsat_p (pd) bind(c, name='freesteam_region4_Tsat_p')
      use, intrinsic :: iso_c_binding
      real(c_double), value :: pd
      end function region4_tsat_p
   end interface
   pd=p
   t = real(region4_tsat_p (pd))
end subroutine THMSAT
!
subroutine THMPT(p, t, rho, h, zk, zmu, cp)
   ! return the remaining thermohydraulics parameters as a function of the pressure (Pa)
   ! and temperature (K)
   use, intrinsic :: iso_c_binding
   real :: p, t, rho, h, zk, zmu, cp
   real(c_double) :: pd, td, rhod, hd, zkd, zmud, cpd
   interface 
      subroutine free_pT (pd, td, rhod, hd, zkd, zmud, cpd) bind(c, name='free_pT')
      use, intrinsic :: iso_c_binding
      real(c_double) :: pd, td, rhod, hd, zkd, zmud, cpd
      end subroutine free_pT
   end interface
   pd=p
   td=t
   call free_pT(pd, td, rhod, hd, zkd, zmud, cpd)
   rho=real(rhod)
   h=real(hd)
   zk=real(zkd)
   zmu=real(zmud)
   cp=real(cpd)
end subroutine THMPT
!
subroutine THMTX(t, x, rho, h, zk, zmu, cp)
   ! return the remaining thermohydraulics parameters as a function of the temperature (K)
   ! and quality
   use, intrinsic :: iso_c_binding
   real :: t, x, rho, h, zmu
   real(c_double) :: td, xd, rhod, hd, zkd, zmud, cpd
   interface 
      subroutine free_Tx (td, xd, rhod, hd, zkd, zmud, cpd) bind(c, name='free_Tx')
      use, intrinsic :: iso_c_binding
      real(c_double) :: td, xd, rhod, hd, zkd, zmud, cpd
      end subroutine free_Tx
   end interface
   td=t
   xd=x
   call free_Tx(td, xd, rhod, hd, zkd, zmud, cpd)
   rho=real(rhod)
   h=real(hd)
   zk=real(zkd)
   zmu=real(zmud)
   cp=real(cpd)
end subroutine THMTX