TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Fluide_eau_c3_liquide.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 <Fluide_eau_c3_liquide.h>
17#include <Lois_eau_c3.h>
18
19Implemente_instanciable(Fluide_eau_c3_liquide, "Fluide_eau_c3_liquide", Fluide_reel_base);
20
21Sortie& Fluide_eau_c3_liquide::printOn(Sortie& os) const { return os; }
22
24{
25#if HAVE_LIBC3
27#else
28 Process::exit(que_suis_je() + " : this binary was not compiled with C3 water laws!");
29#endif
30 return is;
31}
32
33#define ind std::distance(res.begin(), &val)
34
35void Fluide_eau_c3_liquide::rho_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
36{
37 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
38#if HAVE_LIBC3
39 /* calcul a saturation */
40 for (auto& val : res)
41 {
42 int un = 1;
43 double hl, dP_hl, dT_hl, cpl, dT_cpl, dP_cpl, rhol, dT_rhol, dP_rhol; //sorties
44 F77NAME(FTLIQ)(&un, &P[ind], &T[ind * ncomp + id], &hl, &dP_hl, &dT_hl, &cpl, &dP_cpl, &dT_cpl, &rhol, &dP_rhol, &dT_rhol);
45 val = rhol;
46 }
47#else
48 for (auto& val : res) val = 0;
49#endif
50}
51
52void Fluide_eau_c3_liquide::dP_rho_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
53{
54 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
55#if HAVE_LIBC3
56 /* calcul a saturation */
57 for (auto& val : res)
58 {
59 int un = 1;
60 double hl, dP_hl, dT_hl, cpl, dT_cpl, dP_cpl, rhol, dT_rhol, dP_rhol; //sorties
61 F77NAME(FTLIQ)(&un, &P[ind], &T[ind * ncomp + id], &hl, &dP_hl, &dT_hl, &cpl, &dP_cpl, &dT_cpl, &rhol, &dP_rhol, &dT_rhol);
62 val = dP_rhol;
63 }
64#else
65 for (auto& val : res) val = 0;
66#endif
67}
68
69void Fluide_eau_c3_liquide::dT_rho_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
70{
71 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
72#if HAVE_LIBC3
73 /* calcul a saturation */
74 for (auto& val : res)
75 {
76 int un = 1;
77 double hl, dP_hl, dT_hl, cpl, dT_cpl, dP_cpl, rhol, dT_rhol, dP_rhol; //sorties
78 F77NAME(FTLIQ)(&un, &P[ind], &T[ind * ncomp + id], &hl, &dP_hl, &dT_hl, &cpl, &dP_cpl, &dT_cpl, &rhol, &dP_rhol, &dT_rhol);
79 val = dT_rhol;
80 }
81#else
82 for (auto& val : res) val = 0;
83#endif
84}
85
86void Fluide_eau_c3_liquide::h_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
87{
88 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
89#if HAVE_LIBC3
90 /* calcul a saturation */
91 for (auto& val : res)
92 {
93 int un = 1;
94 double hl, dP_hl, dT_hl, cpl, dT_cpl, dP_cpl, rhol, dT_rhol, dP_rhol; //sorties
95 F77NAME(FTLIQ)(&un, &P[ind], &T[ind * ncomp + id], &hl, &dP_hl, &dT_hl, &cpl, &dP_cpl, &dT_cpl, &rhol, &dP_rhol, &dT_rhol);
96 val = hl;
97 }
98#else
99 for (auto& val : res) val = 0;
100#endif
101}
102
103void Fluide_eau_c3_liquide::dP_h_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
104{
105 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
106#if HAVE_LIBC3
107 /* calcul a saturation */
108 for (auto& val : res)
109 {
110 int un = 1;
111 double hl, dP_hl, dT_hl, cpl, dT_cpl, dP_cpl, rhol, dT_rhol, dP_rhol; //sorties
112 F77NAME(FTLIQ)(&un, &P[ind], &T[ind * ncomp + id], &hl, &dP_hl, &dT_hl, &cpl, &dP_cpl, &dT_cpl, &rhol, &dP_rhol, &dT_rhol);
113 val = dP_hl;
114 }
115#else
116 for (auto& val : res) val = 0;
117#endif
118}
119
120void Fluide_eau_c3_liquide::dT_h_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
121{
122 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
123#if HAVE_LIBC3
124 /* calcul a saturation */
125 for (auto& val : res)
126 {
127 int un = 1;
128 double hl, dP_hl, dT_hl, cpl, dT_cpl, dP_cpl, rhol, dT_rhol, dP_rhol; //sorties
129 F77NAME(FTLIQ)(&un, &P[ind], &T[ind * ncomp + id], &hl, &dP_hl, &dT_hl, &cpl, &dP_cpl, &dT_cpl, &rhol, &dP_rhol, &dT_rhol);
130 val = dT_hl;
131 }
132#else
133 for (auto& val : res) val = 0;
134#endif
135}
136
137void Fluide_eau_c3_liquide::cp_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
138{
139 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
140#if HAVE_LIBC3
141 /* calcul a saturation */
142 for (auto& val : res)
143 {
144 int un = 1;
145 double hl, dP_hl, dT_hl, cpl, dT_cpl, dP_cpl, rhol, dT_rhol, dP_rhol; //sorties
146 F77NAME(FTLIQ)(&un, &P[ind], &T[ind * ncomp + id], &hl, &dP_hl, &dT_hl, &cpl, &dP_cpl, &dT_cpl, &rhol, &dP_rhol, &dT_rhol);
147 val = cpl;
148 }
149#else
150 for (auto& val : res) val = 0;
151#endif
152}
153
154void Fluide_eau_c3_liquide::beta_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
155{
156 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
157 VectorD dT_rho___((int )res.size()), rho___((int )res.size());
158 dT_rho_(T,P,SpanD(dT_rho___),ncomp,id);
159 rho_(T,P,SpanD(rho___),ncomp,id);
160 for (auto& val : res) val = dT_rho___[ind] / rho___[ind];
161}
162
163void Fluide_eau_c3_liquide::mu_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
164{
165 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
166#if HAVE_LIBC3
167 /* calcul a saturation */
168 for (auto& val : res)
169 {
170 int un = 1;
171 double hl = _h_(T[ind * ncomp + id], P[ind]), zero = 0, cond, dcond1, dcond2, visc, dvisc1, dvisc2;
172 F77NAME(FHLIQA)(&un, &P[ind], &hl, &T[ind * ncomp + id], &zero, &zero, &cond, &dcond1, &dcond2, &visc, &dvisc1, &dvisc2);
173 val = visc;
174 }
175#else
176 for (auto& val : res) val = 0;
177#endif
178}
179
180void Fluide_eau_c3_liquide::lambda_(const SpanD T, const SpanD P, SpanD res, int ncomp, int id) const
181{
182 assert((int )T.size() == ncomp * (int )P.size() && (int )T.size() == ncomp * (int )res.size());
183#if HAVE_LIBC3
184 /* calcul a saturation */
185 for (auto& val : res)
186 {
187 int un = 1;
188 double hl = _h_(T[ind * ncomp + id], P[ind]), zero = 0, cond, dcond1, dcond2, visc, dvisc1, dvisc2;
189 F77NAME(FHLIQA)(&un, &P[ind], &hl, &T[ind * ncomp + id], &zero, &zero, &cond, &dcond1, &dcond2, &visc, &dvisc1, &dvisc2);
190 val = cond;
191 }
192#else
193 for (auto& val : res) val = 0;
194#endif
195}
196
197#undef ind
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
void dP_h_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void beta_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void dP_rho_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void mu_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void dT_h_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void h_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void lambda_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void cp_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void rho_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
void dT_rho_(const SpanD T, const SpanD P, SpanD res, int ncomp=1, int id=0) const override
Classe Fluide_reel_base Cette classe represente un fluide reel ainsi que.
double _h_(const double T, const double P) const
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