MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
jacobian_second_derivative.cpp
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 
21 //#define BOOST_TEST_DYN_LINK
22 //#define BOOST_TEST_MODULE InviscidFluxSecondDerivative
23 //#include <boost/test/unit_test.hpp>
24 //
26 //#include "fluid/fluid_elem_initialization.h"
27 //
28 //
29 //
30 //BOOST_FIXTURE_TEST_SUITE(fxSecondDerivative, BuildFluidElem)
31 //
32 //
34 //BOOST_AUTO_TEST_CASE(AxU1Derivative)
35 //{
36 // DenseRealMatrix deriv(5,5);
37 // RealMatrixX deriv_analytical(5,5);
38 //
39 // // initialize the analytical derivative of the flux Jacobian
40 // deriv_analytical
41 // << 0, 0, 0, 0, 0,
42 // -(62975./358.), 1145./716., 0, 0, 0,
43 // -11., 0, 1., 0, 0,
44 // -22., 0, 0, 1., 0,
45 // -(489809925./1432.), 3905./179., -(3157./716.), -(3157./358.), 1003./716.;
46 //
47 // _fluid_elem->calculate_advection_flux_jacobian_u1_derivative(0,
48 // *_primitive_sol,
49 // deriv);
50 //
51 // BOOST_CHECK(compare(deriv_analytical, deriv));
52 // }
53 //
54 //
55 // // test wrt u2
56 // BOOST_AUTO_TEST_CASE(AxU2Derivative)
57 // {
58 // DenseRealMatrix deriv(5,5);
59 // RealMatrixX deriv_analytical(5,5);
60 //
61 // // initialize the analytical derivative of the flux Jacobian
62 // deriv_analytical <<
63 // 0, 0, 0, 0, 0,
64 // 4.409217877094972, 0, -0.40083798882681565, 0, 0,
65 // -110, 1, 0, 0, 0,
66 // 0, 0, 0, 0, 0,
67 // -724.9860335195531, 11, -44.09217877094972, 0, 0;
68 //
69 // _fluid_elem->calculate_advection_flux_jacobian_u2_derivative(0,
70 // *_primitive_sol,
71 // deriv);
72 //
73 // BOOST_CHECK(compare(deriv_analytical, deriv));
74 // }
75 //
76 //
77 // // test wrt u3
78 // BOOST_AUTO_TEST_CASE(AxU3Derivative)
79 // {
80 // DenseRealMatrix deriv(5,5);
81 // RealMatrixX deriv_analytical(5,5);
82 //
83 // // initialize the analytical derivative of the flux Jacobian
84 // deriv_analytical <<
85 // 0, 0, 0, 0, 0,
86 // 8.818435754189943, 0, 0, -0.40083798882681565, 0,
87 // 0, 0, 0, 0, 0,
88 // -110, 1, 0, 0, 0,
89 // -1449.9720670391062, 22, 0, -44.09217877094972, 0;
90 //
91 // _fluid_elem->calculate_advection_flux_jacobian_u3_derivative(0,
92 // *_primitive_sol,
93 // deriv);
94 //
95 // BOOST_CHECK(compare(deriv_analytical, deriv));
96 // }
97 //
98 //
99 //
100 // // test wrt u3
101 // BOOST_AUTO_TEST_CASE(AxTDerivative)
102 // {
103 // DenseRealMatrix deriv(5,5);
104 // RealMatrixX deriv_analytical(5,5);
105 //
106 // // initialize the analytical derivative of the flux Jacobian
107 // deriv_analytical <<
108 // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -110330., 1003., 0, 0, 0;
109 //
110 // _fluid_elem->calculate_advection_flux_jacobian_T_derivative(0,
111 // *_primitive_sol,
112 // deriv);
113 //
114 // BOOST_CHECK(compare(deriv_analytical, deriv));
115 // }
116 //
117 //
118 // BOOST_AUTO_TEST_SUITE_END()
119 //
120 //
121 //
122 // BOOST_FIXTURE_TEST_SUITE(fySecondDerivative, BuildFluidElem)
123 //
124 //
125 // // sensitivity wrt rho is all zero. Hence, the first one tested is wrt u1
126 // BOOST_AUTO_TEST_CASE(AyU1Derivative)
127 // {
128 // DenseRealMatrix deriv(5,5);
129 // RealMatrixX deriv_analytical(5,5);
130 //
131 // // initialize the analytical derivative of the flux Jacobian
132 // deriv_analytical <<
133 // 0, 0, 0, 0, 0, -11, 0, 1, 0, 0, 44.09217877094972, -0.40083798882681565, 0, 0, 0, 0, 0, 0, 0, 0, -724.9860335195531, -4.409217877094972, 110, 0, 0;
134 //
135 // _fluid_elem->calculate_advection_flux_jacobian_u1_derivative(1,
136 // *_primitive_sol,
137 // deriv);
138 //
139 // BOOST_CHECK(compare(deriv_analytical, deriv));
140 // }
141 //
142 //
143 // // test wrt u2
144 // BOOST_AUTO_TEST_CASE(AyU2Derivative)
145 // {
146 // DenseRealMatrix deriv(5,5);
147 // RealMatrixX deriv_analytical(5,5);
148 //
149 // // initialize the analytical derivative of the flux Jacobian
150 // deriv_analytical <<
151 // 0, 0, 0, 0, 0, -110, 1, 0, 0, 0, -17.59078212290503, 0, 1.5991620111731844, 0, 0, -22, 0, 0, 1, 0, -334868.6752793296, -44.09217877094972, 2.1815642458100557, -8.818435754189943, 1.4008379888268156;
152 //
153 // _fluid_elem->calculate_advection_flux_jacobian_u2_derivative(1,
154 // *_primitive_sol,
155 // deriv);
156 //
157 // BOOST_CHECK(compare(deriv_analytical, deriv));
158 // }
159 //
160 //
161 // // test wrt u3
162 // BOOST_AUTO_TEST_CASE(AyU3Derivative)
163 // {
164 // DenseRealMatrix deriv(5,5);
165 // RealMatrixX deriv_analytical(5,5);
166 //
167 // // initialize the analytical derivative of the flux Jacobian
168 // deriv_analytical <<
169 // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8.818435754189943, 0, 0, -0.40083798882681565, 0, -11, 0, 1, 0, 0, -144.99720670391062, 0, 22, -4.409217877094972, 0;
170 //
171 // _fluid_elem->calculate_advection_flux_jacobian_u3_derivative(1,
172 // *_primitive_sol,
173 // deriv);
174 //
175 // BOOST_CHECK(compare(deriv_analytical, deriv));
176 // }
177 //
178 //
179 // // test wrt T
180 // BOOST_AUTO_TEST_CASE(AyTDerivative)
181 // {
182 // DenseRealMatrix deriv(5,5);
183 // RealMatrixX deriv_analytical(5,5);
184 //
185 // // initialize the analytical derivative of the flux Jacobian
186 // deriv_analytical <<
187 // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -11033, 0, 1003, 0, 0;
188 //
189 // _fluid_elem->calculate_advection_flux_jacobian_T_derivative(1,
190 // *_primitive_sol,
191 // deriv);
192 //
193 // BOOST_CHECK(compare(deriv_analytical, deriv));
194 // }
195 //
196 //
197 // BOOST_AUTO_TEST_SUITE_END()
198 //
199 //
200 //
201 // BOOST_FIXTURE_TEST_SUITE(fzSecondDerivative, BuildFluidElem)
202 //
203 //
204 // // sensitivity wrt rho is all zero. Hence, the first one tested is wrt u1
205 // BOOST_AUTO_TEST_CASE(AzU1Derivative)
206 // {
207 // DenseRealMatrix deriv(5,5);
208 // RealMatrixX deriv_analytical(5,5);
209 //
210 // // initialize the analytical derivative of the flux Jacobian
211 // deriv_analytical <<
212 // 0, 0, 0, 0, 0, -22, 0, 0, 1, 0, 0, 0, 0, 0, 0, 44.09217877094972, -0.40083798882681565, 0, 0, 0, -1449.9720670391062, -8.818435754189943, 0, 110, 0;
213 //
214 // _fluid_elem->calculate_advection_flux_jacobian_u1_derivative(2,
215 // *_primitive_sol,
216 // deriv);
217 //
218 // BOOST_CHECK(compare(deriv_analytical, deriv));
219 // }
220 //
221 //
222 // // test wrt u2
223 // BOOST_AUTO_TEST_CASE(AzU2Derivative)
224 // {
225 // DenseRealMatrix deriv(5,5);
226 // RealMatrixX deriv_analytical(5,5);
227 //
228 // // initialize the analytical derivative of the flux Jacobian
229 // deriv_analytical <<
230 // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -22, 0, 0, 1, 0, 4.409217877094972, 0, -0.40083798882681565, 0, 0, -144.99720670391062, 0, -8.818435754189943, 11, 0;
231 //
232 // _fluid_elem->calculate_advection_flux_jacobian_u2_derivative(2,
233 // *_primitive_sol,
234 // deriv);
235 //
236 // BOOST_CHECK(compare(deriv_analytical, deriv));
237 // }
238 //
239 //
240 // // test wrt u3
241 // BOOST_AUTO_TEST_CASE(AzU3Derivative)
242 // {
243 // DenseRealMatrix deriv(5,5);
244 // RealMatrixX deriv_analytical(5,5);
245 //
246 // // initialize the analytical derivative of the flux Jacobian
247 // deriv_analytical <<
248 // 0, 0, 0, 0, 0, -110, 1, 0, 0, 0, -11, 0, 1, 0, 0, -35.18156424581006, 0, 0, 1.5991620111731844, 0, -335086.17108938546, -44.09217877094972, -4.409217877094972, 4.363128491620111, 1.4008379888268156;
249 //
250 // _fluid_elem->calculate_advection_flux_jacobian_u3_derivative(2,
251 // *_primitive_sol,
252 // deriv);
253 //
254 // BOOST_CHECK(compare(deriv_analytical, deriv));
255 // }
256 //
257 //
258 // // test wrt T
259 // BOOST_AUTO_TEST_CASE(AzTDerivative)
260 // {
261 // DenseRealMatrix deriv(5,5);
262 // RealMatrixX deriv_analytical(5,5);
263 //
264 // // initialize the analytical derivative of the flux Jacobian
265 // deriv_analytical <<
266 // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -22066, 0, 0, 1003, 0;
267 //
268 // _fluid_elem->calculate_advection_flux_jacobian_T_derivative(2,
269 // *_primitive_sol,
270 // deriv);
271 //
272 // BOOST_CHECK(compare(deriv_analytical, deriv));
273 // }
274 //
275 //
276 // BOOST_AUTO_TEST_SUITE_END()
277 //
278 //