summaryrefslogtreecommitdiff
path: root/Utilib/src/steam.h
blob: 9db9d0601c997283d0d08b54589bc25a1d0c4df7 (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
/*
freesteam - IAPWS-IF97 steam tables library
Copyright (C) 2004-2005  John Pye

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
#ifndef FREESTEAM_STEAM_H
#define FREESTEAM_STEAM_H

#include "common.h"

#include <stdio.h>

typedef struct SteamState_R1_struct{
	double p, T;
} SteamState_R1;

typedef struct SteamState_R2_struct{
	double p, T;
} SteamState_R2;

typedef struct SteamState_R3_struct{
	double rho, T;
} SteamState_R3;

typedef struct SteamState_R4_struct{
	double T, x;
} SteamState_R4;

typedef struct SteamState_struct{
	char region;
	union{
		SteamState_R1 R1;
		SteamState_R2 R2;
		SteamState_R3 R3;
		SteamState_R4 R4;
	} valueR;
} SteamState;

FREESTEAM_DLL int freesteam_region(SteamState S);

FREESTEAM_DLL SteamState freesteam_region1_set_pT(double p, double T);
FREESTEAM_DLL SteamState freesteam_region2_set_pT(double p, double T);
FREESTEAM_DLL SteamState freesteam_region3_set_rhoT(double rho, double T);
FREESTEAM_DLL SteamState freesteam_region4_set_Tx(double T, double x);

FREESTEAM_DLL int freesteam_fprint(FILE *f, SteamState S);

#if 0
# define FREESTEAM_DEBUG(NAME,STATE)\
	fprintf(stderr,"%s (%s:%d): %s ",__func__,__FILE__,__LINE__,NAME);\
	freesteam_fprint(stderr,S);
#else
# define FREESTEAM_DEBUG(NAME,STATE)
#endif

typedef double SteamPropertyFunction(SteamState S);

FREESTEAM_DLL double freesteam_p(SteamState S);
FREESTEAM_DLL double freesteam_T(SteamState S);
FREESTEAM_DLL double freesteam_rho(SteamState S);
FREESTEAM_DLL double freesteam_v(SteamState S);
FREESTEAM_DLL double freesteam_u(SteamState S);
FREESTEAM_DLL double freesteam_h(SteamState S);
FREESTEAM_DLL double freesteam_s(SteamState S);
FREESTEAM_DLL double freesteam_cp(SteamState S);
FREESTEAM_DLL double freesteam_cv(SteamState S);
FREESTEAM_DLL double freesteam_w(SteamState S);

FREESTEAM_DLL double freesteam_x(SteamState S);

FREESTEAM_DLL double freesteam_mu(SteamState S);
FREESTEAM_DLL double freesteam_k(SteamState S);

#endif