TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Saturation_R12_c1.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_R12_c1.h>
17#include <Lois_R12_c1.h>
18
19Implemente_instanciable(Saturation_R12_c1, "Saturation_R12_c1", 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_R12_c1::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, ill, ivstat, ierrth ;
42 double tsp, dtsp1 ;
43 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
44 res[i * ncomp + ind] = tsp;
45 }
46#else
47 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
48#endif
49}
50
51void Saturation_R12_c1::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, ill, ivstat, ierrth ;
57 double tsp, dtsp1 ;
58 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
59 res[i * ncomp + ind] = dtsp1;
60 }
61#else
62 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
63#endif
64}
65
66void Saturation_R12_c1::Lvap_(const SpanD P, SpanD res, int ncomp, int ind) const
67{
68#if HAVE_LIBC3
69 for (int i =0; i < (int)P.size(); i++)
70 {
71 // Calcule Tsat
72 int un=1, ill, ivstat, ierrth ;
73 double tsp, dtsp1 ;
74 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
75
76 // Calcule masses volumiques (avec tl, tg = tsat)
77 double rg, rl, drl1, drg1 ;
78 double DP_Tl = 0.; // Renvoye a 0. dans FCPLR12, on gange un appel
79 F77NAME(FROVLR12)(&un, &P[i], &tsp, &tsp, &rg, &rl, &DP_Tl, &drl1, &drg1, &ill, &ivstat, &ierrth);
80
81 // Calcule les enthalpies
82 double hvsp, hlsp, dhvsp1, dhlsp1 ;
83 F77NAME(FHSATR12)(&un, &tsp, &rg, &rl, &P[i], &hvsp, &hlsp, &dtsp1, &drg1, &drl1, &dhvsp1, &dhlsp1);
84
85 // Calcule (enfin...) Lvap
86 res[i * ncomp + ind] = hvsp - hlsp;
87 }
88#else
89 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
90#endif
91}
92
93void Saturation_R12_c1::dP_Lvap_(const SpanD P, SpanD res, int ncomp, int ind) const
94{
95#if HAVE_LIBC3
96 for (int i =0; i < (int)P.size(); i++)
97 {
98 // Calcule Tsat
99 int un=1, ill, ivstat, ierrth ;
100 double tsp, dtsp1 ;
101 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
102
103 // Calcule masses volumiques (avec tl, tg = tsat)
104 double rg, rl, drl1, drg1 ;
105 double DP_Tl = 0.; // Renvoye a 0. dans FCPLR12, on gange un appel
106 F77NAME(FROVLR12)(&un, &P[i], &tsp, &tsp, &rg, &rl, &DP_Tl, &drl1, &drg1, &ill, &ivstat, &ierrth);
107
108 // Calcule les derivees des enthalpies
109 double hvsp, hlsp, dhvsp1, dhlsp1 ;
110 F77NAME(FHSATR12)(&un, &tsp, &rg, &rl, &P[i], &hvsp, &hlsp, &dtsp1, &drg1, &drl1, &dhvsp1, &dhlsp1);
111
112 // Calcule (enfin...) dP_Lvap
113 res[i * ncomp + ind] = dhvsp1 - dhlsp1;
114 }
115#else
116 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
117#endif
118}
119
120void Saturation_R12_c1::Hls_(const SpanD P, SpanD res, int ncomp, int ind) const
121{
122#if HAVE_LIBC3
123 for (int i =0; i < (int)P.size(); i++)
124 {
125 // Calcule Tsat
126 int un=1, ill, ivstat, ierrth ;
127 double tsp, dtsp1 ;
128 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
129
130 // Calcule masses volumiques (avec tl, tg = tsat)
131 double rg, rl, drl1, drg1 ;
132 double DP_Tl = 0.; // Renvoye a 0. dans FCPLR12, on gange un appel
133 F77NAME(FROVLR12)(&un, &P[i], &tsp, &tsp, &rg, &rl, &DP_Tl, &drl1, &drg1, &ill, &ivstat, &ierrth);
134
135 // Calcule les enthalpies
136 double hvsp, hlsp, dhvsp1, dhlsp1 ;
137 F77NAME(FHSATR12)(&un, &tsp, &rg, &rl, &P[i], &hvsp, &hlsp, &dtsp1, &drg1, &drl1, &dhvsp1, &dhlsp1);
138 res[i * ncomp + ind] = hlsp;
139 }
140#else
141 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
142#endif
143}
144
145void Saturation_R12_c1::dP_Hls_(const SpanD P, SpanD res, int ncomp, int ind) const
146{
147#if HAVE_LIBC3
148 for (int i =0; i < (int)P.size(); i++)
149 {
150 // Calcule Tsat
151 int un=1, ill, ivstat, ierrth ;
152 double tsp, dtsp1 ;
153 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
154
155 // Calcule masses volumiques (avec tl, tg = tsat)
156 double rg, rl, drl1, drg1 ;
157 double DP_Tl = 0.; // Renvoye a 0. dans FCPLR12, on gange un appel
158 F77NAME(FROVLR12)(&un, &P[i], &tsp, &tsp, &rg, &rl, &DP_Tl, &drl1, &drg1, &ill, &ivstat, &ierrth);
159
160 // Calcule les enthalpies
161 double hvsp, hlsp, dhvsp1, dhlsp1;
162 F77NAME(FHSATR12)(&un, &tsp, &rg, &rl, &P[i], &hvsp, &hlsp, &dtsp1, &drg1, &drl1, &dhvsp1, &dhlsp1);
163 res[i * ncomp + ind] = dhlsp1;
164 }
165#else
166 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
167#endif
168}
169
170void Saturation_R12_c1::Hvs_(const SpanD P, SpanD res, int ncomp, int ind) const
171{
172#if HAVE_LIBC3
173 for (int i =0; i < (int)P.size(); i++)
174 {
175 // Calcule Tsat
176 int un=1, ill, ivstat, ierrth ;
177 double tsp, dtsp1 ;
178 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
179
180 // Calcule masses volumiques (avec tl, tg = tsat)
181 double rg, rl, drl1, drg1 ;
182 double DP_Tl = 0.; // Renvoye a 0. dans FCPLR12, on gange un appel
183 F77NAME(FROVLR12)(&un, &P[i], &tsp, &tsp, &rg, &rl, &DP_Tl, &drl1, &drg1, &ill, &ivstat, &ierrth);
184
185 // Calcule les enthalpies
186 double hvsp, hlsp, dhvsp1, dhlsp1 ;
187 F77NAME(FHSATR12)(&un, &tsp, &rg, &rl, &P[i], &hvsp, &hlsp, &dtsp1, &drg1, &drl1, &dhvsp1, &dhlsp1);
188 res[i * ncomp + ind] = hvsp;
189 }
190#else
191 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
192#endif
193}
194
195void Saturation_R12_c1::dP_Hvs_(const SpanD P, SpanD res, int ncomp, int ind) const
196{
197#if HAVE_LIBC3
198 for (int i =0; i < (int)P.size(); i++)
199 {
200 // Calcule Tsat
201 int un=1, ill, ivstat, ierrth ;
202 double tsp, dtsp1 ;
203 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
204
205 // Calcule masses volumiques (avec tl, tg = tsat)
206 double rg, rl, drl1, drg1 ;
207 double DP_Tl = 0.; // Renvoye a 0. dans FCPLR12, on gange un appel
208 F77NAME(FROVLR12)(&un, &P[i], &tsp, &tsp, &rg, &rl, &DP_Tl, &drl1, &drg1, &ill, &ivstat, &ierrth);
209
210 // Calcule les enthalpies
211 double hvsp, hlsp, dhvsp1, dhlsp1 ;
212 F77NAME(FHSATR12)(&un, &tsp, &rg, &rl, &P[i], &hvsp, &hlsp, &dtsp1, &drg1, &drl1, &dhvsp1, &dhlsp1);
213 res[i * ncomp + ind] = dhvsp1;
214 }
215#else
216 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
217#endif
218}
219
220void Saturation_R12_c1::sigma_(const SpanD T, const SpanD P, SpanD res, int ncomp, int ind) const
221{
222 //TODO : FIXME : verifier indices ...
223#if HAVE_LIBC3
224 for (int i =0; i < (int)P.size(); i++)
225 {
226 // Calcule Tsat
227 int un=1, ill, ivstat, ierrth ;
228 double tsp, dtsp1 ;
229 F77NAME(FPSATR12)(&un, &P[i], &tsp, &dtsp1, &ill, &ivstat, &ierrth);
230
231 // Calcule sigma
232 double sigma, dsig1;
233 F77NAME(FSIGMAR12)(&un, &tsp, &dtsp1, &sigma, &dsig1);
234 res[i*ncomp+ind] = sigma;
235 }
236#else
237 for (int i =0; i < (int)P.size(); i++) res[i] = 0;
238#endif
239}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
double sigma(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