Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
TPM_def.hpp
1#ifndef TPM_def_hpp
2#define TPM_def_hpp
3#include "TPM_decl.hpp"
4
13
14namespace FEDD {
15void ZeroDirichlet(double* x, double* res, double t, double* parameters){
16
17 res[0] = 0.;
18
19 return;
20}
21
22void myTPM(int material, double h, std::vector<double> &matrix){
23
24 if (material == 0) {
25
26 double tmp[225] = {4.038461538461538e+07, 0.000000000000000e+00, 0.000000000000000e+00, -5.769230769230769e+06, 1.346153846153846e+07, 5.769230769230768e+06, -5.587935447692871e-09, 2.307692307692307e+07, 5.587935447692871e-09, 1.862645149230957e-09, -5.384615384615383e+07, -2.307692307692307e+07, h*-1.666666666666666e-01, h*6.938893903907228e-18, h*5.204170427930421e-18,
27 0.000000000000000e+00, 1.153846153846154e+07, -3.846153846153846e+06, 0.000000000000000e+00, 3.846153846153845e+06, 3.846153846153845e+06, 1.538461538461538e+07, -1.396983861923218e-09, 0.000000000000000e+00, 1.396983861923218e-09, -1.538461538461538e+07, -1.538461538461538e+07, h*0.000000000000000e+00, h*0.000000000000000e+00, h*0.000000000000000e+00,
28 0.000000000000000e+00, -3.846153846153846e+06, 1.153846153846153e+07, 0.000000000000000e+00, 3.846153846153845e+06, 3.846153846153845e+06, -9.313225746154785e-10, 1.538461538461538e+07, -1.538461538461538e+07, -1.538461538461538e+07, 9.313225746154785e-10, 7.380604162020826e-10, h*0.000000000000000e+00, h*0.000000000000000e+00, h*0.000000000000000e+00,
29 -5.769230769230769e+06, 0.000000000000000e+00, 0.000000000000000e+00, 4.038461538461538e+07, 5.769230769230767e+06, 1.346153846153846e+07, 2.307692307692307e+07, -5.587935447692871e-09, -2.307692307692307e+07, -5.384615384615384e+07, 2.736905129880212e-09, 5.587935447692871e-09, h*6.938893903907228e-18, h*-1.666666666666666e-01, h*-6.938893903907228e-18,
30 1.346153846153846e+07, 3.846153846153845e+06, 3.846153846153845e+06, 5.769230769230768e+06, 5.192307692307694e+07, 2.884615384615386e+07, -2.607703208923340e-08, -1.117587089538574e-08, -1.538461538461537e+07, -2.307692307692308e+07, -5.384615384615386e+07, -1.538461538461538e+07, h*6.418476861114186e-17, h*6.938893903907228e-17, h*1.666666666666668e-01,
31 5.769230769230770e+06, 3.846153846153845e+06, 3.846153846153845e+06, 1.346153846153846e+07, 2.884615384615386e+07, 5.192307692307694e+07, -1.117587089538574e-08, -2.235174179077148e-08, -1.538461538461538e+07, -5.384615384615386e+07, -2.307692307692308e+07, -1.538461538461537e+07, h*6.418476861114186e-17, h*6.938893903907228e-17, h*1.666666666666668e-01,
32 -1.862645149230957e-09, 1.538461538461538e+07, -1.862645149230957e-09, 2.307692307692307e+07, -1.862645149230957e-08, -9.313225746154785e-09, 1.384615384615384e+08, 3.846153846153846e+07, -1.076923076923077e+08, -3.846153846153846e+07, -3.076923076923075e+07, -3.846153846153845e+07, h*-1.666666666666667e-01, h*-3.333333333333333e-01, h*-1.666666666666667e-01,
33 2.307692307692307e+07, -1.862645149230957e-09, 1.538461538461538e+07, -1.862645149230957e-09, -8.381903171539307e-09, -1.676380634307861e-08, 3.846153846153846e+07, 1.384615384615384e+08, -3.846153846153845e+07, -3.076923076923075e+07, -3.846153846153845e+07, -1.076923076923077e+08, h*-3.333333333333333e-01, h*-1.666666666666667e-01, h*-1.666666666666667e-01,
34 1.862645149230957e-09, 9.313225746154785e-10, -1.538461538461538e+07, -2.307692307692307e+07, -1.538461538461537e+07, -1.538461538461538e+07, -1.076923076923077e+08, -3.846153846153845e+07, 1.384615384615384e+08, 3.846153846153844e+07, -3.166496753692627e-08, 3.846153846153846e+07, h*1.666666666666667e-01, h*3.333333333333333e-01, h*1.666666666666667e-01,
35 4.656612873077393e-10, 1.862645149230957e-09, -1.538461538461538e+07, -5.384615384615384e+07, -2.307692307692308e+07, -5.384615384615386e+07, -3.846153846153845e+07, -3.076923076923075e+07, 3.846153846153844e+07, 1.384615384615385e+08, 3.846153846153846e+07, -2.607703208923340e-08, h*-6.938893903907228e-17, h*1.666666666666666e-01, h*-1.666666666666668e-01,
36 -5.384615384615383e+07, -1.538461538461538e+07, 1.862645149230957e-09, 1.339921267956994e-09, -5.384615384615386e+07, -2.307692307692308e+07, -3.076923076923075e+07, -3.846153846153845e+07, -2.793967723846436e-08, 3.846153846153846e+07, 1.384615384615384e+08, 3.846153846153844e+07, h*1.666666666666666e-01, h*-7.864079757761525e-17, h*-1.666666666666668e-01,
37 -2.307692307692307e+07, -1.538461538461538e+07, 1.669382990817561e-09, 1.862645149230957e-09, -1.538461538461538e+07, -1.538461538461537e+07, -3.846153846153845e+07, -1.076923076923077e+08, 3.846153846153846e+07, -2.980232238769531e-08, 3.846153846153845e+07, 1.384615384615384e+08, h*3.333333333333333e-01, h*1.666666666666667e-01, h*1.666666666666667e-01,
38 h*-3.333333333333331e+01, h*0.000000000000000e+00, h*0.000000000000000e+00, h*3.552713678800501e-15, h*1.021405182655144e-14, h*1.021405182655144e-14, h*-3.333333333333333e+01, h*-6.666666666666666e+01, h*3.333333333333333e+01, h*-1.243449787580175e-14, h*3.333333333333331e+01, h*6.666666666666666e+01, -4.999999999999999e-03, 0.000000000000000e+00, 4.999999999999999e-03,
39 h*2.664535259100376e-15, h*0.000000000000000e+00, h*0.000000000000000e+00, h*-3.333333333333332e+01, h*1.154631945610163e-14, h*1.154631945610163e-14, h*-6.666666666666666e+01, h*-3.333333333333333e+01, h*6.666666666666666e+01, h*3.333333333333331e+01, h*-1.450691418843538e-14, h*3.333333333333333e+01, 0.000000000000000e+00, -4.999999999999999e-03, 4.999999999999999e-03,
40 h*3.552713678800501e-15, h*0.000000000000000e+00, h*0.000000000000000e+00, h*0.000000000000000e+00, h*3.333333333333336e+01, h*3.333333333333336e+01, h*-3.333333333333334e+01, h*-3.333333333333334e+01, h*3.333333333333334e+01, h*-3.333333333333335e+01, h*-3.333333333333336e+01, h*3.333333333333334e+01, 4.999999999999999e-03, 4.999999999999999e-03, -9.999999999999998e-03
41 };
42
43 matrix = std::vector<double> (std::begin(tmp),std::end(tmp));
44 } else if (material == 1) {
45 double tmp[225] = {4.038461538461538e+07, 0.000000000000000e+00, 0.000000000000000e+00, -5.769230769230769e+06, 1.346153846153846e+07, 5.769230769230768e+06, -5.587935447692871e-09, 2.307692307692307e+07, 5.587935447692871e-09, 1.862645149230957e-09, -5.384615384615383e+07, -2.307692307692307e+07, h*-1.666666666666666e-01, h*6.938893903907228e-18, h*5.204170427930421e-18,
46 0.000000000000000e+00, 1.153846153846154e+07, -3.846153846153846e+06, 0.000000000000000e+00, 3.846153846153845e+06, 3.846153846153845e+06, 1.538461538461538e+07, -1.396983861923218e-09, 0.000000000000000e+00, 1.396983861923218e-09, -1.538461538461538e+07, -1.538461538461538e+07, h*0.000000000000000e+00, h*0.000000000000000e+00, h*0.000000000000000e+00,
47 0.000000000000000e+00, -3.846153846153846e+06, 1.153846153846153e+07, 0.000000000000000e+00, 3.846153846153845e+06, 3.846153846153845e+06, -9.313225746154785e-10, 1.538461538461538e+07, -1.538461538461538e+07, -1.538461538461538e+07, 9.313225746154785e-10, 7.380604162020826e-10, h*0.000000000000000e+00, h*0.000000000000000e+00, h*0.000000000000000e+00,
48 -5.769230769230769e+06, 0.000000000000000e+00, 0.000000000000000e+00, 4.038461538461538e+07, 5.769230769230767e+06, 1.346153846153846e+07, 2.307692307692307e+07, -5.587935447692871e-09, -2.307692307692307e+07, -5.384615384615384e+07, 2.736905129880212e-09, 5.587935447692871e-09, h*6.938893903907228e-18, h*-1.666666666666666e-01, h*-6.938893903907228e-18,
49 1.346153846153846e+07, 3.846153846153845e+06, 3.846153846153845e+06, 5.769230769230768e+06, 5.192307692307694e+07, 2.884615384615386e+07, -2.607703208923340e-08, -1.117587089538574e-08, -1.538461538461537e+07, -2.307692307692308e+07, -5.384615384615386e+07, -1.538461538461538e+07, h*6.418476861114186e-17, h*6.938893903907228e-17, h*1.666666666666668e-01,
50 5.769230769230770e+06, 3.846153846153845e+06, 3.846153846153845e+06, 1.346153846153846e+07, 2.884615384615386e+07, 5.192307692307694e+07, -1.117587089538574e-08, -2.235174179077148e-08, -1.538461538461538e+07, -5.384615384615386e+07, -2.307692307692308e+07, -1.538461538461537e+07, h*6.418476861114186e-17, h*6.938893903907228e-17, h*1.666666666666668e-01,
51 -1.862645149230957e-09, 1.538461538461538e+07, -1.862645149230957e-09, 2.307692307692307e+07, -1.862645149230957e-08, -9.313225746154785e-09, 1.384615384615384e+08, 3.846153846153846e+07, -1.076923076923077e+08, -3.846153846153846e+07, -3.076923076923075e+07, -3.846153846153845e+07, h*-1.666666666666667e-01, h*-3.333333333333333e-01, h*-1.666666666666667e-01,
52 2.307692307692307e+07, -1.862645149230957e-09, 1.538461538461538e+07, -1.862645149230957e-09, -8.381903171539307e-09, -1.676380634307861e-08, 3.846153846153846e+07, 1.384615384615384e+08, -3.846153846153845e+07, -3.076923076923075e+07, -3.846153846153845e+07, -1.076923076923077e+08, h*-3.333333333333333e-01, h*-1.666666666666667e-01, h*-1.666666666666667e-01,
53 1.862645149230957e-09, 9.313225746154785e-10, -1.538461538461538e+07, -2.307692307692307e+07, -1.538461538461537e+07, -1.538461538461538e+07, -1.076923076923077e+08, -3.846153846153845e+07, 1.384615384615384e+08, 3.846153846153844e+07, -3.166496753692627e-08, 3.846153846153846e+07, h*1.666666666666667e-01, h*3.333333333333333e-01, h*1.666666666666667e-01,
54 4.656612873077393e-10, 1.862645149230957e-09, -1.538461538461538e+07, -5.384615384615384e+07, -2.307692307692308e+07, -5.384615384615386e+07, -3.846153846153845e+07, -3.076923076923075e+07, 3.846153846153844e+07, 1.384615384615385e+08, 3.846153846153846e+07, -2.607703208923340e-08, h*-6.938893903907228e-17, h*1.666666666666666e-01, h*-1.666666666666668e-01,
55 -5.384615384615383e+07, -1.538461538461538e+07, 1.862645149230957e-09, 1.339921267956994e-09, -5.384615384615386e+07, -2.307692307692308e+07, -3.076923076923075e+07, -3.846153846153845e+07, -2.793967723846436e-08, 3.846153846153846e+07, 1.384615384615384e+08, 3.846153846153844e+07, h*1.666666666666666e-01, h*-7.864079757761525e-17, h*-1.666666666666668e-01,
56 -2.307692307692307e+07, -1.538461538461538e+07, 1.669382990817561e-09, 1.862645149230957e-09, -1.538461538461538e+07, -1.538461538461537e+07, -3.846153846153845e+07, -1.076923076923077e+08, 3.846153846153846e+07, -2.980232238769531e-08, 3.846153846153845e+07, 1.384615384615384e+08, h*3.333333333333333e-01, h*1.666666666666667e-01, h*1.666666666666667e-01,
57 h*-3.333333333333331e+01, h*0.000000000000000e+00, h*0.000000000000000e+00, h*3.552713678800501e-15, h*1.021405182655144e-14, h*1.021405182655144e-14, h*-3.333333333333333e+01, h*-6.666666666666666e+01, h*3.333333333333333e+01, h*-1.243449787580175e-14, h*3.333333333333331e+01, h*6.666666666666666e+01, -5.000000000000000e-05, 0.000000000000000e+00, 5.000000000000000e-05,
58 h*2.664535259100376e-15, h*0.000000000000000e+00, h*0.000000000000000e+00, h*-3.333333333333332e+01, h*1.154631945610163e-14, h*1.154631945610163e-14, h*-6.666666666666666e+01, h*-3.333333333333333e+01, h*6.666666666666666e+01, h*3.333333333333331e+01, h*-1.450691418843538e-14, h*3.333333333333333e+01, 0.000000000000000e+00, -5.000000000000000e-05, 5.000000000000000e-05,
59 h*3.552713678800501e-15, h*0.000000000000000e+00, h*0.000000000000000e+00, h*0.000000000000000e+00, h*3.333333333333336e+01, h*3.333333333333336e+01, h*-3.333333333333334e+01, h*-3.333333333333334e+01, h*3.333333333333334e+01, h*-3.333333333333335e+01, h*-3.333333333333336e+01, h*3.333333333333334e+01, 5.000000000000000e-05, 5.000000000000000e-05, -1.000000000000000e-04
60 };
61
62 matrix = std::vector<double> (std::begin(tmp),std::end(tmp));
63 } else {
64 TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,"Only material 0 and 1 are defined.");
65 }
66}
67
68
69void myTPMold(int material, double h, std::vector<double> &matrix){
70
71 if (material == 0) {
72 double tmp[225] = {5.192307692307691e7, 2.884615384615384e7, 1.346153846153846e7, 3.846153846153846e6, 3.846153846153847e6, 5.769230769230768e6, -5.384615384615384e7, -1.5384615384615382e7, 9.313225746154785e-10, -9.313225746154785e-10, -1.5384615384615386e7, -2.3076923076923072e7, 0.16666666666666663*h, -6.938893903907228e-18*h, 1.734723475976807e-18*h, 2.884615384615384e7, 5.192307692307691e7, 5.769230769230769e6, 3.846153846153846e6, 3.846153846153845e6, 1.346153846153846e7, -2.3076923076923072e7, -1.5384615384615386e7, -9.313225746154785e-10, 1.862645149230957e-9, -1.5384615384615384e7, -5.384615384615385e7, 0.16666666666666663*h, -6.938893903907228e-18*h, -5.204170427930421e-18*h, 1.346153846153846e7, 5.769230769230769e6, 4.038461538461538e7, 0., 0., -5.769230769230767e6, -5.384615384615383e7, -2.3076923076923072e7, 3.725290298461914e-9, 2.3076923076923072e7, -3.725290298461914e-9, -2.271243842572473e-9, 6.938893903907228e-18*h, -0.16666666666666663*h, -6.938893903907228e-18*h, 3.8461538461538455e6, 3.846153846153846e6, 0., 1.1538461538461534e7, -3.846153846153844e6, 0., -1.5384615384615378e7, -1.5384615384615382e7, 1.5384615384615378e7, 0., -1.2037217035098218e-9, 0., 0.*h, 0.*h, 0.*h, 3.846153846153845e6, 3.846153846153845e6, 0., -3.846153846153845e6, 1.1538461538461542e7, 0., -5.587935447692871e-9, -9.313225746154785e-10, 5.587935447692871e-9, 1.5384615384615391e7, -1.5384615384615388e7, -1.5384615384615391e7, 0.*h, 0.*h, 0.*h, 5.769230769230768e6, 1.346153846153846e7, -5.769230769230767e6, 0., 0., 4.03846153846154e7, 0., -1.862645149230957e-8, 2.3076923076923084e7, 1.862645149230957e-8, -2.3076923076923084e7, -5.3846153846153855e7, -4.336808689942018e-17*h, -4.85722573273506e-17*h, -0.16666666666666677*h, -5.384615384615384e7, -2.3076923076923076e7, -5.384615384615384e7, -1.5384615384615378e7, -4.190951585769653e-9, -4.656612873077393e-10, 1.3846153846153843e8, 3.846153846153845e7, -3.0769230769230764e7, -3.846153846153846e7, 7.450580596923828e-9, 3.846153846153846e7, -0.16666666666666666*h, 0.16666666666666666*h, 1.3877787807814457e-17*h, -1.5384615384615384e7, -1.5384615384615386e7, -2.3076923076923072e7, -1.5384615384615382e7, 0., -1.862645149230957e-8, 3.8461538461538464e7, 1.3846153846153843e8, -3.8461538461538464e7, -1.0769230769230767e8, 3.8461538461538464e7, 2.514570951461792e-8, 0.16666666666666666*h, 0.3333333333333333*h, 0.16666666666666669*h, 0., 9.313225746154785e-10, 5.587935447692871e-9, 1.5384615384615378e7, 6.984919309616089e-9, 2.3076923076923084e7, -3.0769230769230768e7, -3.8461538461538464e7, 1.3846153846153846e8, 3.846153846153847e7, -1.0769230769230771e8, -3.846153846153848e7, -0.16666666666666669*h, -0.16666666666666669*h, -0.3333333333333334*h, 1.862645149230957e-9, 1.862645149230957e-9, 2.3076923076923072e7, 9.313225746154785e-10, 1.5384615384615391e7, 2.0489096641540527e-8, -3.846153846153846e7, -1.0769230769230767e8, 3.8461538461538464e7, 1.3846153846153843e8, -3.846153846153847e7, -3.0769230769230794e7, -0.16666666666666666*h, -0.3333333333333333*h, -0.16666666666666669*h, -1.5384615384615377e7, -1.5384615384615382e7, -5.587935447692871e-9, -1.6693829908175615e-9, -1.5384615384615384e7, -2.307692307692309e7, 7.450580596923828e-9, 3.8461538461538464e7, -1.0769230769230771e8, -3.846153846153847e7, 1.3846153846153843e8, 3.846153846153848e7, 0.1666666666666667*h, 0.1666666666666667*h, 0.3333333333333334*h, -2.3076923076923072e7, -5.384615384615383e7, -2.271243842572473e-9, -9.313225746154785e-10, -1.5384615384615388e7, -5.3846153846153855e7, 3.8461538461538464e7, 2.1420419216156006e-8, -3.846153846153847e7, -3.0769230769230787e7, 3.8461538461538464e7, 1.3846153846153846e8, -0.16666666666666657*h, 6.476300976980079e-17*h, 0.16666666666666677*h, 33.333333333333314*h, 33.333333333333314*h, 1.7763568394002505e-15*h, 0.*h, 0.*h, -1.021405182655144e-14*h, -33.33333333333333*h, 33.33333333333333*h, -33.333333333333336*h, -33.33333333333333*h, 33.333333333333336*h, -33.333333333333314*h, -0.001, 0.0004999999999999999, 0.0005, -1.7763568394002505e-15*h, -2.6645352591003757e-15*h, -33.33333333333332*h, 0.*h, 0.*h, -1.1546319456101628e-14*h, 33.33333333333333*h, 66.66666666666666*h, -33.333333333333336*h, -66.66666666666666*h, 33.333333333333336*h, 1.2730557349035127e-14*h, 0.0004999999999999999, -0.0004999999999999999, 0., -1.7763568394002505e-15*h, -2.6645352591003757e-15*h, -1.7763568394002505e-15*h, 0.*h, 0.*h, -33.33333333333336*h, 1.7763568394002505e-15*h, 33.33333333333334*h, -66.66666666666669*h, -33.33333333333334*h, 66.66666666666669*h, 33.33333333333336*h, 0.0005, 0., -0.0005};
73
74 matrix = std::vector<double> (std::begin(tmp),std::end(tmp));
75 } else if (material == 1) {
76 double tmp[225] = {5.192307692307691e7, 2.884615384615384e7, 1.346153846153846e7, 3.846153846153846e6, 3.846153846153847e6, 5.769230769230768e6, -5.384615384615384e7, -1.5384615384615382e7, 9.313225746154785e-10, -9.313225746154785e-10, -1.5384615384615386e7, -2.3076923076923072e7, 0.16666666666666663*h, -6.938893903907228e-18*h, 1.734723475976807e-18*h, 2.884615384615384e7, 5.192307692307691e7, 5.769230769230769e6, 3.846153846153846e6, 3.846153846153845e6, 1.346153846153846e7, -2.3076923076923072e7, -1.5384615384615386e7, -9.313225746154785e-10, 1.862645149230957e-9, -1.5384615384615384e7, -5.384615384615385e7, 0.16666666666666663*h, -6.938893903907228e-18*h, -5.204170427930421e-18*h, 1.346153846153846e7, 5.769230769230769e6, 4.038461538461538e7, 0., 0., -5.769230769230767e6, -5.384615384615383e7, -2.3076923076923072e7, 3.725290298461914e-9, 2.3076923076923072e7, -3.725290298461914e-9, -2.271243842572473e-9, 6.938893903907228e-18*h, -0.16666666666666663*h, -6.938893903907228e-18*h, 3.8461538461538455e6, 3.846153846153846e6, 0., 1.1538461538461534e7, -3.846153846153844e6, 0., -1.5384615384615378e7, -1.5384615384615382e7, 1.5384615384615378e7, 0., -1.2037217035098218e-9, 0., 0.*h, 0.*h, 0.*h, 3.846153846153845e6, 3.846153846153845e6, 0., -3.846153846153845e6, 1.1538461538461542e7, 0., -5.587935447692871e-9, -9.313225746154785e-10, 5.587935447692871e-9, 1.5384615384615391e7, -1.5384615384615388e7, -1.5384615384615391e7, 0.*h, 0.*h, 0.*h, 5.769230769230768e6, 1.346153846153846e7, -5.769230769230767e6, 0., 0., 4.03846153846154e7, 0., -1.862645149230957e-8, 2.3076923076923084e7, 1.862645149230957e-8, -2.3076923076923084e7, -5.3846153846153855e7, -4.336808689942018e-17*h, -4.85722573273506e-17*h, -0.16666666666666677*h, -5.384615384615384e7, -2.3076923076923076e7, -5.384615384615384e7, -1.5384615384615378e7, -4.190951585769653e-9, -4.656612873077393e-10, 1.3846153846153843e8, 3.846153846153845e7, -3.0769230769230764e7, -3.846153846153846e7, 7.450580596923828e-9, 3.846153846153846e7, -0.16666666666666666*h, 0.16666666666666666*h, 1.3877787807814457e-17*h, -1.5384615384615384e7, -1.5384615384615386e7, -2.3076923076923072e7, -1.5384615384615382e7, 0., -1.862645149230957e-8, 3.8461538461538464e7, 1.3846153846153843e8, -3.8461538461538464e7, -1.0769230769230767e8, 3.8461538461538464e7, 2.514570951461792e-8, 0.16666666666666666*h, 0.3333333333333333*h, 0.16666666666666669*h, 0., 9.313225746154785e-10, 5.587935447692871e-9, 1.5384615384615378e7, 6.984919309616089e-9, 2.3076923076923084e7, -3.0769230769230768e7, -3.8461538461538464e7, 1.3846153846153846e8, 3.846153846153847e7, -1.0769230769230771e8, -3.846153846153848e7, -0.16666666666666669*h, -0.16666666666666669*h, -0.3333333333333334*h, 1.862645149230957e-9, 1.862645149230957e-9, 2.3076923076923072e7, 9.313225746154785e-10, 1.5384615384615391e7, 2.0489096641540527e-8, -3.846153846153846e7, -1.0769230769230767e8, 3.8461538461538464e7, 1.3846153846153843e8, -3.846153846153847e7, -3.0769230769230794e7, -0.16666666666666666*h, -0.3333333333333333*h, -0.16666666666666669*h, -1.5384615384615377e7, -1.5384615384615382e7, -5.587935447692871e-9, -1.6693829908175615e-9, -1.5384615384615384e7, -2.307692307692309e7, 7.450580596923828e-9, 3.8461538461538464e7, -1.0769230769230771e8, -3.846153846153847e7, 1.3846153846153843e8, 3.846153846153848e7, 0.1666666666666667*h, 0.1666666666666667*h, 0.3333333333333334*h, -2.3076923076923072e7, -5.384615384615383e7, -2.271243842572473e-9, -9.313225746154785e-10, -1.5384615384615388e7, -5.3846153846153855e7, 3.8461538461538464e7, 2.1420419216156006e-8, -3.846153846153847e7, -3.0769230769230787e7, 3.8461538461538464e7, 1.3846153846153846e8, -0.16666666666666657*h, 6.476300976980079e-17*h, 0.16666666666666677*h, 33.333333333333314*h, 33.333333333333314*h, 1.7763568394002505e-15*h, 0.*h, 0.*h, -1.021405182655144e-14*h, -33.33333333333333*h, 33.33333333333333*h, -33.333333333333336*h, -33.33333333333333*h, 33.333333333333336*h, -33.333333333333314*h, -9.999999999999998e-8, 4.999999999999999e-8, 4.999999999999999e-8, -1.7763568394002505e-15*h, -2.6645352591003757e-15*h, -33.33333333333332*h, 0.*h, 0.*h, -1.1546319456101628e-14*h, 33.33333333333333*h, 66.66666666666666*h, -33.333333333333336*h, -66.66666666666666*h, 33.333333333333336*h, 1.2730557349035127e-14*h, 4.999999999999999e-8, -4.999999999999999e-8, 0., -1.7763568394002505e-15*h, -2.6645352591003757e-15*h, -1.7763568394002505e-15*h, 0.*h, 0.*h, -33.33333333333336*h, 1.7763568394002505e-15*h, 33.33333333333334*h, -66.66666666666669*h, -33.33333333333334*h, 66.66666666666669*h, 33.33333333333336*h, 4.999999999999999e-8, 0., -4.999999999999999e-8};
77
78 matrix = std::vector<double> (std::begin(tmp),std::end(tmp));
79 } else {
80 TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,"Only material 0 and 1 are defined.");
81 }
82}
83
84void myTPMSingleMat(int material, double h, std::vector<double> &matrix){
85
86 if (material == 0 || material == 1) {
87 double tmp[225] = {5.192307692307691e7, 2.884615384615384e7, 1.346153846153846e7, 3.846153846153846e6, 3.846153846153847e6, 5.769230769230768e6, -5.384615384615384e7, -1.5384615384615382e7, 9.313225746154785e-10, -9.313225746154785e-10, -1.5384615384615386e7, -2.3076923076923072e7, 0.16666666666666663*h, -6.938893903907228e-18*h, 1.734723475976807e-18*h, 2.884615384615384e7, 5.192307692307691e7, 5.769230769230769e6, 3.846153846153846e6, 3.846153846153845e6, 1.346153846153846e7, -2.3076923076923072e7, -1.5384615384615386e7, -9.313225746154785e-10, 1.862645149230957e-9, -1.5384615384615384e7, -5.384615384615385e7, 0.16666666666666663*h, -6.938893903907228e-18*h, -5.204170427930421e-18*h, 1.346153846153846e7, 5.769230769230769e6, 4.038461538461538e7, 0., 0., -5.769230769230767e6, -5.384615384615383e7, -2.3076923076923072e7, 3.725290298461914e-9, 2.3076923076923072e7, -3.725290298461914e-9, -2.271243842572473e-9, 6.938893903907228e-18*h, -0.16666666666666663*h, -6.938893903907228e-18*h, 3.8461538461538455e6, 3.846153846153846e6, 0., 1.1538461538461534e7, -3.846153846153844e6, 0., -1.5384615384615378e7, -1.5384615384615382e7, 1.5384615384615378e7, 0., -1.2037217035098218e-9, 0., 0.*h, 0.*h, 0.*h, 3.846153846153845e6, 3.846153846153845e6, 0., -3.846153846153845e6, 1.1538461538461542e7, 0., -5.587935447692871e-9, -9.313225746154785e-10, 5.587935447692871e-9, 1.5384615384615391e7, -1.5384615384615388e7, -1.5384615384615391e7, 0.*h, 0.*h, 0.*h, 5.769230769230768e6, 1.346153846153846e7, -5.769230769230767e6, 0., 0., 4.03846153846154e7, 0., -1.862645149230957e-8, 2.3076923076923084e7, 1.862645149230957e-8, -2.3076923076923084e7, -5.3846153846153855e7, -4.336808689942018e-17*h, -4.85722573273506e-17*h, -0.16666666666666677*h, -5.384615384615384e7, -2.3076923076923076e7, -5.384615384615384e7, -1.5384615384615378e7, -4.190951585769653e-9, -4.656612873077393e-10, 1.3846153846153843e8, 3.846153846153845e7, -3.0769230769230764e7, -3.846153846153846e7, 7.450580596923828e-9, 3.846153846153846e7, -0.16666666666666666*h, 0.16666666666666666*h, 1.3877787807814457e-17*h, -1.5384615384615384e7, -1.5384615384615386e7, -2.3076923076923072e7, -1.5384615384615382e7, 0., -1.862645149230957e-8, 3.8461538461538464e7, 1.3846153846153843e8, -3.8461538461538464e7, -1.0769230769230767e8, 3.8461538461538464e7, 2.514570951461792e-8, 0.16666666666666666*h, 0.3333333333333333*h, 0.16666666666666669*h, 0., 9.313225746154785e-10, 5.587935447692871e-9, 1.5384615384615378e7, 6.984919309616089e-9, 2.3076923076923084e7, -3.0769230769230768e7, -3.8461538461538464e7, 1.3846153846153846e8, 3.846153846153847e7, -1.0769230769230771e8, -3.846153846153848e7, -0.16666666666666669*h, -0.16666666666666669*h, -0.3333333333333334*h, 1.862645149230957e-9, 1.862645149230957e-9, 2.3076923076923072e7, 9.313225746154785e-10, 1.5384615384615391e7, 2.0489096641540527e-8, -3.846153846153846e7, -1.0769230769230767e8, 3.8461538461538464e7, 1.3846153846153843e8, -3.846153846153847e7, -3.0769230769230794e7, -0.16666666666666666*h, -0.3333333333333333*h, -0.16666666666666669*h, -1.5384615384615377e7, -1.5384615384615382e7, -5.587935447692871e-9, -1.6693829908175615e-9, -1.5384615384615384e7, -2.307692307692309e7, 7.450580596923828e-9, 3.8461538461538464e7, -1.0769230769230771e8, -3.846153846153847e7, 1.3846153846153843e8, 3.846153846153848e7, 0.1666666666666667*h, 0.1666666666666667*h, 0.3333333333333334*h, -2.3076923076923072e7, -5.384615384615383e7, -2.271243842572473e-9, -9.313225746154785e-10, -1.5384615384615388e7, -5.3846153846153855e7, 3.8461538461538464e7, 2.1420419216156006e-8, -3.846153846153847e7, -3.0769230769230787e7, 3.8461538461538464e7, 1.3846153846153846e8, -0.16666666666666657*h, 6.476300976980079e-17*h, 0.16666666666666677*h, 33.333333333333314*h, 33.333333333333314*h, 1.7763568394002505e-15*h, 0.*h, 0.*h, -1.021405182655144e-14*h, -33.33333333333333*h, 33.33333333333333*h, -33.333333333333336*h, -33.33333333333333*h, 33.333333333333336*h, -33.333333333333314*h, -0.001, 0.0004999999999999999, 0.0005, -1.7763568394002505e-15*h, -2.6645352591003757e-15*h, -33.33333333333332*h, 0.*h, 0.*h, -1.1546319456101628e-14*h, 33.33333333333333*h, 66.66666666666666*h, -33.333333333333336*h, -66.66666666666666*h, 33.333333333333336*h, 1.2730557349035127e-14*h, 0.0004999999999999999, -0.0004999999999999999, 0., -1.7763568394002505e-15*h, -2.6645352591003757e-15*h, -1.7763568394002505e-15*h, 0.*h, 0.*h, -33.33333333333336*h, 1.7763568394002505e-15*h, 33.33333333333334*h, -66.66666666666669*h, -33.33333333333334*h, 66.66666666666669*h, 33.33333333333336*h, 0.0005, 0., -0.0005};
88
89 matrix = std::vector<double> (std::begin(tmp),std::end(tmp));
90 }
91 else {
92 TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,"Only material 0 and 1 are defined.");
93 }
94}
95
96
97template<class SC,class LO,class GO,class NO>
98TPM<SC,LO,GO,NO>::TPM(const DomainConstPtr_Type &domainVelocity, std::string FETypeVelocity, const DomainConstPtr_Type &domainPressure, std::string FETypePressure, ParameterListPtr_Type parameterList):
99Problem<SC,LO,GO,NO>(parameterList, domainVelocity->getComm())
100{
101
102 this->addVariable( domainVelocity , FETypeVelocity , "u" , domainVelocity->getDimension());
103 this->addVariable( domainPressure , FETypePressure , "p" , 1);
104 this->dim_ = this->getDomain(0)->getDimension();
105}
106
107template<class SC,class LO,class GO,class NO>
108TPM<SC,LO,GO,NO>::~TPM(){
109
110}
111
112template<class SC,class LO,class GO,class NO>
113void TPM<SC,LO,GO,NO>::info(){
114 this->infoProblem();
115}
116
117template<class SC,class LO,class GO,class NO>
118void TPM<SC,LO,GO,NO>::assemble( std::string type ) const{
119
120 if ( type == "FirstAssemble") {
121
122 if (u_repNewton_.is_null()){
123 u_repNewton_ = Teuchos::rcp( new MultiVector_Type( this->getDomain(0)->getMapVecFieldRepeated() )) ;
124 u_repNewton_->putScalar(0.);
125 }
126 if (p_repNewton_.is_null()){
127 p_repNewton_ = Teuchos::rcp( new MultiVector_Type( this->getDomain(1)->getMapRepeated() )) ;
128 p_repNewton_->putScalar(0.);
129 }
130
131 if (u_repTime_.is_null()){
132 u_repTime_ = Teuchos::rcp( new MultiVector_Type( this->getDomain(0)->getMapVecFieldRepeated() )) ;
133 u_repTime_->putScalar(0.);
134 }
135 if (p_repTime_.is_null()){
136 p_repTime_ = Teuchos::rcp( new MultiVector_Type( this->getDomain(1)->getMapRepeated() )) ;
137 p_repTime_->putScalar(0.);
138 }
139
140 }
141
142 if (type == "SetSolutionInTime") {
143 TEUCHOS_TEST_FOR_EXCEPTION( u_repTime_.is_null(), std::runtime_error, "u_repTime_ not initialized.");
144 TEUCHOS_TEST_FOR_EXCEPTION( p_repTime_.is_null(), std::runtime_error, "p_repTime_ not initialized.");
145 MultiVectorConstPtr_Type u = this->solution_->getBlock(0);
146 MultiVectorConstPtr_Type p = this->solution_->getBlock(1);
147 u_repTime_->importFromVector(u, true);
148 p_repTime_->importFromVector(p, true);
149 }
150 else if (type == "SetSolutionNewton") {
151 TEUCHOS_TEST_FOR_EXCEPTION( u_repNewton_.is_null(), std::runtime_error, "u_repNewton_ not initialized.");
152 TEUCHOS_TEST_FOR_EXCEPTION( p_repNewton_.is_null(), std::runtime_error, "p_repNewton_ not initialized.");
153
154 MultiVectorConstPtr_Type u = this->solution_->getBlock(0);
155 MultiVectorConstPtr_Type p = this->solution_->getBlock(1);
156 u_repNewton_->importFromVector(u, true);
157 p_repNewton_->importFromVector(p, true);
158 }
159 else if( type == "FirstAssemble" || type == "Assemble" || type == "OnlyUpdate" || type == "AssembleAndUpdate"){
160 if (this->verbose_)
161 std::cout << "-- External assembly ... " << std::flush;
162
163 MapConstPtr_Type mapRepeatedConst1 = this->getDomain(0)->getMapRepeated();
164 MapConstPtr_Type mapRepeatedConst2 = this->getDomain(1)->getMapRepeated();
165 MapPtr_Type mapRepeated1 = Teuchos::rcp_const_cast<Map_Type>(mapRepeatedConst1);
166 MapPtr_Type mapRepeated2 = Teuchos::rcp_const_cast<Map_Type>(mapRepeatedConst2);
167
168 MatrixPtr_Type A00(new Matrix_Type( this->getDomain(0)->getMapVecFieldUnique(), this->getDomain(0)->getDimension() * this->getDomain(0)->getApproxEntriesPerRow() ) );
169 MatrixPtr_Type A01(new Matrix_Type( this->getDomain(0)->getMapVecFieldUnique(), this->getDomain(1)->getDimension() * this->getDomain(1)->getApproxEntriesPerRow() ) );
170 MatrixPtr_Type A10(new Matrix_Type( this->getDomain(1)->getMapUnique(), this->getDomain(0)->getDimension() * this->getDomain(0)->getApproxEntriesPerRow() ) );
171 MatrixPtr_Type A11(new Matrix_Type( this->getDomain(1)->getMapUnique(), this->getDomain(1)->getDimension() * this->getDomain(1)->getApproxEntriesPerRow() ) );
172
173 MultiVectorPtr_Type F0(new MultiVector_Type( this->getDomain(0)->getMapVecFieldRepeated(), 1 ) );
174 MultiVectorPtr_Type F1(new MultiVector_Type( this->getDomain(1)->getMapRepeated(), 1 ) );
175
176 bool update(type == "FirstAssemble" || type == "Assemble" || type == "AssembleAndUpdate");
177 bool updateHistory(type == "OnlyUpdate" || type == "AssembleAndUpdate"); //for AceGen History variables
178
179 this->feFactory_->assemblyAceGenTPM(A00,
180 A01,
181 A10,
182 A11,
183 F0,
184 F1,
185 mapRepeated1,
186 mapRepeated2,
187 this->parameterList_,
188 u_repNewton_,
189 p_repNewton_,
190 u_repTime_,
191 p_repTime_,
192 update,
193 updateHistory);
194
195 if (update) {
196 this->system_->addBlock( A00, 0, 0 );
197 this->system_->addBlock( A01, 0, 1 );
198 this->system_->addBlock( A10, 1, 0 );
199 this->system_->addBlock( A11, 1, 1 );
200
201 MultiVectorPtr_Type F0Unique = Teuchos::rcp(new MultiVector_Type( this->getDomain(0)->getMapVecFieldUnique() ) );
202 MultiVectorPtr_Type F1Unique = Teuchos::rcp(new MultiVector_Type( this->getDomain(1)->getMapUnique() ) );
203 F0Unique->exportFromVector( F0, false, "Add" );
204 F1Unique->exportFromVector( F1, false, "Add" );
205
206 this->rhs_->addBlock( F0Unique, 0 );
207 this->rhs_->addBlock( F1Unique, 1 );
208
209 }
210
211
212 if (this->verbose_)
213 std::cout << "done -- " << std::endl;
214 }
215}
216
217}
218#endif
Definition Problem_decl.hpp:38
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5