forked from AMReX-Astro/Microphysics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheos_cell.H
46 lines (33 loc) · 1014 Bytes
/
eos_cell.H
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
#ifndef EOS_CELL_H
#define EOS_CELL_H
#include <extern_parameters.H>
#include <eos.H>
#include <network.H>
#include <iostream>
#include <react_util.H>
using namespace unit_test_rp;
AMREX_INLINE
void eos_cell_c()
{
eos_t state;
// Set mass fractions to sanitize inputs for them
amrex::Real massfractions[NumSpec];
for (int n = 0; n < NumSpec; ++n) {
massfractions[n] = -1.0e0_rt;
}
// Make sure user set all the mass fractions to values in the interval [0, 1]
for (int n = 1; n <= NumSpec; ++n) {
massfractions[n-1] = get_xn(n, unit_test_rp::uniform_xn);
if (massfractions[n-1] < 0 || massfractions[n-1] > 1) {
amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!");
}
}
state.T = temperature;
state.rho = density;
for (int n = 0; n < NumSpec; ++n) {
state.xn[n] = massfractions[n];
}
eos(eos_input_rt, state);
std::cout << state;
}
#endif