TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Saturation_eau_c3.cpp
1/****************************************************************************
2* Copyright (c) 2021, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <Saturation_eau_c3.h>
17#include <Lois_eau_c3.h>
18
19Implemente_instanciable(Saturation_eau_c3, "Saturation_eau_c3", Saturation_base);
20
22{
23 return os;
24}
25
27{
28#if HAVE_LIBC3
30#else
31 Process::exit(que_suis_je() + " : this binary was not compiled with C3 water laws!");
32#endif
33 return is;
34}
35
36void Saturation_eau_c3::Tsat_(const SpanD P, SpanD res, int ncomp, int ind) const
37{
38#if HAVE_LIBC3
39 for (int i =0; i < (int)P.size(); i++)
40 {
41 int un = 1, ienc = 0;
42 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
43 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
44 res[i * ncomp + ind] = Ts;
45 }
46#else
47 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
48#endif
49}
50
51void Saturation_eau_c3::dP_Tsat_(const SpanD P, SpanD res, int ncomp, int ind) const
52{
53#if HAVE_LIBC3
54 for (int i =0; i < (int)P.size(); i++)
55 {
56 int un = 1, ienc = 0;
57 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
58 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
59 res[i * ncomp + ind] = dP_Ts;
60 }
61#else
62 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
63#endif
64}
65
66void Saturation_eau_c3::Psat_(const SpanD T, SpanD res, int ncomp, int ind) const
67{
68#if HAVE_LIBC3
69 for (int i =0; i < (int)T.size() / ncomp; i++)
70 {
71 int ienc = 0;
72 double Ps, dT_Ps, d2T_Ps, hls, dT_hls, hgs, dT_hgs, cpls, dT_cpls, cpgs, dT_cpgs, rhols, dT_rhols, rhogs, dT_rhogs;
73 F77NAME(FPSATT)(&ienc, &T[i * ncomp + ind], &Ps, &dT_Ps, &d2T_Ps, &hls, &dT_hls, &hgs, &dT_hgs, &cpls, &dT_cpls, &cpgs, &dT_cpgs, &rhols, &dT_rhols, &rhogs, &dT_rhogs);
74 res[i * ncomp + ind] = Ps;
75 }
76#else
77 for (int i =0; i < (int)T.size() / ncomp; i++) res[i] = 0;
78#endif
79}
80
81void Saturation_eau_c3::dT_Psat_(const SpanD T, SpanD res, int ncomp, int ind) const
82{
83#if HAVE_LIBC3
84 for (int i =0; i < (int)T.size() / ncomp; i++)
85 {
86 int ienc = 0;
87 double Ps, dT_Ps, d2T_Ps, hls, dT_hls, hgs, dT_hgs, cpls, dT_cpls, cpgs, dT_cpgs, rhols, dT_rhols, rhogs, dT_rhogs;
88 F77NAME(FPSATT)(&ienc, &T[i * ncomp + ind], &Ps, &dT_Ps, &d2T_Ps, &hls, &dT_hls, &hgs, &dT_hgs, &cpls, &dT_cpls, &cpgs, &dT_cpgs, &rhols, &dT_rhols, &rhogs, &dT_rhogs);
89 res[i * ncomp + ind] = dT_Ps;
90 }
91#else
92 for (int i =0; i < (int)T.size() / ncomp; i++) res[i] = 0;
93#endif
94}
95
96void Saturation_eau_c3::Lvap_(const SpanD P, SpanD res, int ncomp, int ind) const
97{
98#if HAVE_LIBC3
99 for (int i =0; i < (int)P.size(); i++)
100 {
101 int un = 1, ienc = 0;
102 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
103 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
104 res[i * ncomp + ind] = hgs - hls;
105 }
106#else
107 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
108#endif
109}
110
111void Saturation_eau_c3::dP_Lvap_(const SpanD P, SpanD res, int ncomp, int ind) const
112{
113#if HAVE_LIBC3
114 for (int i =0; i < (int)P.size(); i++)
115 {
116 int un = 1, ienc = 0;
117 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
118 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
119 res[i * ncomp + ind] = dP_hgs - dP_hls;
120 }
121#else
122 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
123#endif
124}
125
126void Saturation_eau_c3::Hls_(const SpanD P, SpanD res, int ncomp, int ind) const
127{
128#if HAVE_LIBC3
129 for (int i =0; i < (int)P.size(); i++)
130 {
131 int un = 1, ienc = 0;
132 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
133 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
134 res[i * ncomp + ind] = hls;
135 }
136#else
137 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
138#endif
139}
140
141void Saturation_eau_c3::dP_Hls_(const SpanD P, SpanD res, int ncomp, int ind) const
142{
143#if HAVE_LIBC3
144 for (int i =0; i < (int)P.size(); i++)
145 {
146 int un = 1, ienc = 0;
147 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
148 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
149 res[i * ncomp + ind] = dP_hls;
150 }
151#else
152 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
153#endif
154}
155
156void Saturation_eau_c3::Hvs_(const SpanD P, SpanD res, int ncomp, int ind) const
157{
158#if HAVE_LIBC3
159 for (int i =0; i < (int)P.size(); i++)
160 {
161 int un = 1, ienc = 0;
162 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
163 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
164 res[i * ncomp + ind] = hgs;
165 }
166#else
167 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
168#endif
169}
170
171void Saturation_eau_c3::dP_Hvs_(const SpanD P, SpanD res, int ncomp, int ind) const
172{
173#if HAVE_LIBC3
174 for (int i =0; i < (int)P.size(); i++)
175 {
176 int un = 1, ienc = 0;
177 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
178 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
179 res[i * ncomp + ind] = dP_hgs;
180 }
181#else
182 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
183#endif
184}
185
186void Saturation_eau_c3::sigma_(const SpanD T, const SpanD P, SpanD res, int ncomp, int ind) const
187{
188 //TODO : FIXME : verifier indices ...
189#if HAVE_LIBC3
190 for (int i =0; i < (int)P.size(); i++)
191 {
192 /* calcul a saturation */
193 int un = 1, ienc = 0;
194 double Ts, dP_Ts, d2P_Ts, hls, dP_hls, hgs, dP_hgs, cpls, dP_cpls, cpgs, dP_cpgs, rhols, dP_rhols, rhogs, dP_rhogs;
195 F77NAME(FTSATP)(&un, &ienc, &P[i], &Ts, &dP_Ts, &d2P_Ts, &hls, &dP_hls, &hgs, &dP_hgs, &cpls, &dP_cpls, &cpgs, &dP_cpgs, &rhols, &dP_rhols, &rhogs, &dP_rhogs);
196 /* calcul a T */
197 double cond, dT_cond, dP_cond, visc, dP_visc, dT_visc, surfaceTension, dP_surfaceTension;
198 F77NAME(FHVAPA)(&un, &ienc, &P[i], &T[i * ncomp + ind], &Ts, &dP_Ts, &cond, &dP_cond, &dT_cond, &visc, &dP_visc, &dT_visc, &surfaceTension, &dP_surfaceTension);
199 res[i] = surfaceTension;
200 }
201#else
202 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
203#endif
204}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52