-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscvheoscalcentropy.c
60 lines (46 loc) · 1.42 KB
/
scvheoscalcentropy.c
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
/*
* Calculate s(rho, T) for the SCVH EOS.
*
* Author: Christian Reinhardt
* Created: 19.06.2020
* Modified:
*/
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <assert.h>
#include "scvheos.h"
int main(int argc, char **argv) {
SCVHEOSMAT *Mat;
int iMat = SCVHEOS_HHE_EXT_LOWRHOT;
double dKpcUnit = 2.06701e-13;
double dMsolUnit = 4.80438e-08;
double rho, T;
dKpcUnit = 0.0;
dMsolUnit = 0.0;
#if 0
if (argc != 3) {
fprintf(stderr, "Usage: scvheoscalcentropy <rho> <T>\n");
exit(1);
}
rho = atof(argv[1]);
T = atof(argv[2]);
assert(rho > 0.0);
assert(T > 0.0);
fprintf(stderr, "SCVH EOS: Initializing material %i\n", iMat);
Mat = scvheosInitMaterial(iMat, dKpcUnit, dMsolUnit);
fprintf(stderr, "Done.\n");
printf("rho= %15.7E g/cm^3 T= %15.7E K s= %15.7E erg/g/K\n", rho, T, scvheosSofRhoT(Mat, rho, T));
#endif
// double logrho = -11.339134521996131;
// double logT = 1.6901960800285136;
double logrho = -7.298432014944073;
double logT = 3.2227164711475833;
fprintf(stderr, "SCVH EOS: Initializing material %i\n", iMat);
Mat = scvheosInitMaterial(iMat, dKpcUnit, dMsolUnit);
fprintf(stderr, "Done.\n");
double logs = scvheosLogSofLogRhoLogT(Mat, logrho, logT);
printf("logrho= %15.7E g/cm^3 logT= %15.7E K logs= %15.7E erg/g/K\n", logrho, logT, logs);
scvheosFinalizeMaterial(Mat);
return 0;
}