8 ){ this->
name = _name; }
28 this->U =
U; this->U.
name =
"U";
29 this->V =
V; this->V.
name =
"V";
30 this->Ux =
Ux; this->Ux.
name =
"Ux";
31 this->Uxx =
Uxx; this->Uxx.
name =
"Uxx";
32 this->Uy =
Uy; this->Uy.
name =
"Uy";
33 this->Uxy =
Uxy; this->Uxy.
name =
"Uxy";
34 this->Vx =
Vx; this->Vx.
name =
"Vx";
35 this->Vxx =
Vxx; this->Vxx.
name =
"Vxx";
36 this->Vy =
Vy; this->Vy.
name =
"Vy";
37 this->W =
W; this->W.
name =
"W";
38 this->Wx =
Wx; this->Wx.
name =
"Wx";
39 this->Wy =
Wy; this->Wy.
name =
"Wy";
40 this->Wxy =
Wxy; this->Wxy.
name =
"Wxy";
41 this->P =
P; this->P.
name =
"P";
47 PetscPrintf(PETSC_COMM_WORLD,(
"---------------- "+
name+
"---done-------\n\n").c_str());
66 PetscPrintf(PETSC_COMM_WORLD,(
"---------------- "+
name+
"---done-------\n\n").c_str());
94 PetscInt multiply_nypts = 8;
95 PetscScalar dy,jfloat;
96 PetscScalar multiply_nypts_float=multiply_nypts;
97 PetscScalar eta[multiply_nypts*grid.
ny];
98 PetscScalar deta[multiply_nypts*grid.
ny-1];
100 for(
int i=0; i<grid.
ny; ++i){
101 dy = grid.
y(i+1,PETSC_TRUE)-grid.
y(i,PETSC_TRUE);
103 for(
int j=0; j<multiply_nypts; j++){
104 PetscInt ij = i*multiply_nypts+j;
105 jfloat=(PetscScalar)j;
106 eta[ij] = (grid.
y(i,PETSC_TRUE)+dy*jfloat/multiply_nypts_float)*PetscSqrtScalar(1./(2.*params.
nu*params.
x));
109 for(
int i=0; i<grid.
ny*multiply_nypts-1; ++i){
110 deta[i] = eta[i+1] - eta[i];
113 PetscScalar **fs =
new PetscScalar*[grid.
ny*multiply_nypts];
114 for(
int i=0; i<grid.
ny*multiply_nypts; ++i) fs[i] =
new PetscScalar[3];
115 PetscScalar k1[3],k2[3],k3[3],k4[3];
116 PetscScalar temp[3],temp2[3];
120 fs[0][0] = 0.332057336215195*
std::sqrt(2.);
125 for(
int i=0; i<grid.
ny*multiply_nypts-1; ++i){
127 for(
int j=0; j<3; ++j){
128 k1[j] = deta[i]*temp[j];
129 temp2[j] = fs[i][j] + k1[j]/2.;
132 for(
int j=0; j<3; ++j){
133 k2[j] = deta[i]*temp[j];
134 temp2[j] = fs[i][j] + k2[j]/2.;
137 for(
int j=0; j<3; ++j){
138 k3[j] = deta[i]*temp[j];
139 temp2[j] = fs[i][j] + k3[j];
142 for(
int j=0; j<3; ++j){
143 k4[j] = deta[i]*temp[j];
145 for(
int j=0; j<3; ++j){
146 fs[i+1][j] = fs[i][j] + (k1[j] + (k2[j]*2.) + (k3[j]*2.) + k4[j])/6.;
159 PetscScalar *fpp =
new PetscScalar[grid.
ny*multiply_nypts];
160 PetscScalar *fp =
new PetscScalar[grid.
ny*multiply_nypts];
161 PetscScalar *f =
new PetscScalar[grid.
ny*multiply_nypts];
162 PetscScalar *Utmp =
new PetscScalar[grid.
ny*multiply_nypts];
163 PetscScalar *Uxtmp =
new PetscScalar[grid.
ny*multiply_nypts];
164 PetscScalar *Uytmp =
new PetscScalar[grid.
ny*multiply_nypts];
165 PetscScalar *Vtmp =
new PetscScalar[grid.
ny*multiply_nypts];
166 PetscScalar *Vxtmp =
new PetscScalar[grid.
ny*multiply_nypts];
167 PetscScalar *Vytmp =
new PetscScalar[grid.
ny*multiply_nypts];
168 for (
int i=0; i<grid.
ny*multiply_nypts; ++i){
175 Uxtmp[i]= fpp[i]*(-eta[i]/(2.*params.
x));
176 Uytmp[i]= fpp[i]*PetscSqrtScalar(1./(2.*params.
nu*params.
x));
178 Vtmp[i] = PetscSqrtScalar(params.
nu/(2.*params.
x))*(eta[i]*fp[i] - f[i]);
179 Vxtmp[i]= PetscSqrtScalar(params.
nu/(8.*PetscPowScalar(params.
x,3)))*
183 - PetscPowScalar(eta[i],2)*fpp[i]
185 Vytmp[i]= (1./(2.*params.
x))*eta[i]*fpp[i];
192 PetscScalar *divergence =
new PetscScalar[grid.
ny*multiply_nypts];
193 for(
int i=0; i<grid.
ny*multiply_nypts; ++i) divergence[i] = Uxtmp[i] + Vytmp[i];
194 PetscScalar sum_divergence = 0.;
195 for(
int i=0; i<grid.
ny*multiply_nypts; ++i) sum_divergence += PetscAbsScalar(divergence[i]);
196 printfc(
"the sum of the divergence of Blasius boundary flow is %g+%gi",sum_divergence);
202 for(
int i=0; i<grid.
ny; i++){
203 U(i,Utmp[i*multiply_nypts]);
204 Uy(i,Uytmp[i*multiply_nypts]);
205 Ux(i,Uxtmp[i*multiply_nypts]);
206 V(i,Vtmp[i*multiply_nypts]);
207 Vy(i,Vytmp[i*multiply_nypts]);
208 Vx(i,Vxtmp[i*multiply_nypts]);
219 SPIbaseflow baseflow(U, V, Ux, O,grid.
Dy*U, grid.
Dy*Ux, Vx, O, grid.
Dy*V, O, O, O, O, O);
224 baseflow.
Uxy = Dyp*Ux;
229 for(
int i=0; i<grid.
ny*multiply_nypts; ++i)
delete[] fs[i];
244 const PetscScalar input[3],
245 PetscScalar output[3]){
246 output[0] = -input[2]*input[0];
247 output[1] = input[0];
248 output[2] = input[1];
260 SPI::SPIbaseflow channel_flow(U,o,o,o,Uy,o,o,o,o,o,o,o,o,o);