Commit 4595d5ca by Matthieu Constant

### gravite + termes de bord + cas test gravite

parent 7f50552a
 ... ... @@ -252,24 +252,48 @@ static void compute_weak_boundary_conditions(FluidProblem *problem, double dt, d const int nodes[2] = {el[i0],el[i1]}; const double *x[2] = {&mesh->x[nodes[0]*3], &mesh->x[nodes[1]*3]}; const double dx[2] = {x[1][0]-x[0][0], x[1][1]-x[0][1]}; double dxdxi[D][D], dxidx[D][D], dphi[N_N][D]; for (int i = 0; i < D; ++i) for (int j = 0; j < D; ++j) dxdxi[i][j] = mesh->x[el[j+1]*3+i] - mesh->x[el[0]*3+i]; const double detj = invDD(dxdxi, dxidx); grad_shape_functions(dxidx, dphi); double dp[D]={0}; const double l = sqrt(dx[0]*dx[0] + dx[1]*dx[1]); const double n[2] = {-dx[1]/l,dx[0]/l}; double *local_matrix = &all_local_matrix[local_size*local_size*iel]; double *local_vector = &all_local_vector[local_size*iel]; const int U = 0; const int Q = 2; const int P = 3; for (int i = 0; i< N_SF; ++i) { for (int j = 0; j < D; ++j) { dp[j] += dphi[i][j]*solution[el[i]*n_fields+3]; } } double p0 = solution[el[i0]*n_fields+P]; double p1 = solution[el[i1]*n_fields+P]; /*for (int k = 0; k < D; ++k) { for (int k = 0; k < D; ++k) { if (!forced) { local_matrix[(i0*n_fields+U+k)*local_size + (i0*n_fields+P)] += l/3*n[k]; local_matrix[(i0*n_fields+U+k)*local_size + (i1*n_fields+P)] += l/6*n[k]; local_matrix[(i1*n_fields+U+k)*local_size + (i0*n_fields+P)] += l/6*n[k]; local_matrix[(i1*n_fields+U+k)*local_size + (i1*n_fields+P)] += l/3*n[k]; local_vector[i0*n_fields+U+k] += l*(p0/3+p1/6)*n[k]; local_vector[i1*n_fields+U+k] += l*(p0/6+p1/3)*n[k]; local_vector[i0+(U+k)*N_SF] += l*(p0/3+p1/6)*n[k]; local_vector[i1+(U+k)*N_SF] += l*(p0/6+p1/3)*n[k]; local_matrix[(i0*n_fields+Q)*local_size + (i0*n_fields+P)] += dphi[i0][k]*n[k]*problem->epsilon/2.*l; local_matrix[(i0*n_fields+Q)*local_size + (i1*n_fields+P)] += dphi[i1][k]*n[k]*problem->epsilon/2.*l; local_matrix[(i1*n_fields+Q)*local_size + (i0*n_fields+P)] += dphi[i0][k]*n[k]*problem->epsilon/2.*l; local_matrix[(i1*n_fields+Q)*local_size + (i1*n_fields+P)] += dphi[i1][k]*n[k]*problem->epsilon/2.*l; local_vector[i0+Q*N_SF] += dp[k]*n[k]*problem->epsilon/2.*l; local_vector[i1+Q*N_SF] += dp[k]*n[k]*problem->epsilon/2.*l; } }*/ } if (forced) { for (int ifluid = 0; ifluid < problem->n_fluids; ++ifluid) { const int Q = ifluid*(D+1)+D; ... ... @@ -298,8 +322,8 @@ static void fluid_problem_f(FluidProblem *problem, double *f0, double *f1, doubl double epsilonp = problem->epsilon; double epsilonq = problem->epsilon/10; f0[P] = 1-c; f1[P*D+0] = epsilonp*dp[0]; f1[P*D+1] = epsilonp*dp[1]; f1[P*D+0] = 0;//epsilonp*dp[0]; f1[P*D+1] = 0;//epsilonp*dp[1]; for (int ifluid=0; ifluid < problem->n_fluids; ++ifluid) { int Q = ifluid*(D+1)+D; int U = ifluid*(D+1); ... ... @@ -327,11 +351,11 @@ static void fluid_problem_f(FluidProblem *problem, double *f0, double *f1, doubl f0[Q] = divu+(q-qold)/dt; f0[P] -= q; for (int i = 0; i < D; ++i) { f0[U+i] = rho*((u[i]-uold[i])/dt + u[i]*oq2*divu + utau[i]*oq2) - p*dq[i]; f0[U+i] = rho*((u[i]-uold[i])/dt + u[i]*oq2*divu + utau[i]*oq2) - p*dq[i] + (i==(D-1) ? -rho*problem->g : 0); for (int j = 0; j < D; ++j) { f1[(U+j)*D+i] = mu*(tau[i][j]+tau[j][i]) + (i==j ? -q*p : 0); } f1[Q*D+i] = epsilonq*dq[i]; f1[Q*D+i] = epsilonq*dq[i]+epsilonp*q*dp[i]; } } } ... ... @@ -465,6 +489,7 @@ static void fluid_problem_assemble_system(FluidProblem *problem, double *rhs, co } } } } for (int inode = 0; inode < N_SF; ++inode) { for(int ifield = 0; ifield < n_fields; ++ifield) { ... ...
 L = .5; H = 1; y = 0; lc = .05; Point(1) = {-L, H, 0, lc}; Point(2) = {-L, 0, 0, lc}; Point(3) = {L, 0, 0, lc}; Point(4) = {L, H, 0, lc}; Line(1) = {1, 2}; Line(2) = {2, 3}; Line(3) = {3, 4}; Line(4) = {4, 1}; Line Loop(1) = {1:4}; Plane Surface(1) = {1}; Physical Line("Left") = {1}; Physical Line("Right") = {3}; Physical Line("Bottom") = {2}; Physical Line("Top") = {4}; Physical Surface("Domain") = {1}; Physical Point("PtFix") = {1};