Commit 1a689a76 authored by Matthieu Constant's avatar Matthieu Constant
Browse files

fluid friction wall gradient

parent 9a79ab0b
......@@ -241,21 +241,25 @@ static void f_boundary(WeakBoundary *wbnd, FluidProblem *problem,const double *n
const int aid = wbnd->aid;
if (wbnd->type == BND_WALL) {
double p = s[P];
double u[D], du[D][D], dp[D];
double u[D], du[D][D], dp[D], dun[D];
for (int iD = 0; iD < D; ++iD) {
u[iD] = s[U+iD];
dp[iD] = ds[P*D+iD];
dun[iD] = 0;
for (int jD = 0; jD < D; ++jD) du[iD][jD] = ds[(U+iD)*D+jD];
}
double un = 0;
double dcn = 0;
for (int i = 0; i < D; ++i) {
un += u[i]*n[i];
dcn += dc[i]*n[i];
for (int j = 0; j < D; ++j) dun[i] += du[i][j]*n[j];
}
double h = problem->element_size[eid];
f[P] = (pid<0 ? 0 : -(s[P]-data[pid])/h*problem->taup[eid]);
for (int id = 0; id < D; ++id) {
f[U+id] = (pid<0?p:data[pid])*n[id]+ (un> 0 ? rho*u[id]*un/c : 0)+(vid<0?0:5*(1+D)*(s[U+id]-data[vid+id])/(D*h)*(mu+problem->tauc[eid])*N_N);
f[U+id] = (pid<0?p:data[pid])*n[id] + (un> 0 ? rho*u[id]*un/c : 0) + (vid<0?0:(1+D)*(s[U+id]-data[vid+id])/(D*h)*(mu+problem->tauc[eid])*N_N) - mu/c*(dun[id]-u[id]/c*dcn);
}
//printf("%s:velocity=[%g,%g]\n",wbnd->tag,data[vid],data[vid+1]);
}
......
......@@ -42,7 +42,7 @@ class Poiseuille(unittest.TestCase) :
if not os.path.isdir(outputdir) :
os.makedirs(outputdir)
subprocess.call(["gmsh", "-2", "mesh.geo","-clscale","2"])
subprocess.call(["gmsh", "-2", "mesh.geo","-clscale","1.5"])
t = 0
ii = 0
......@@ -113,6 +113,6 @@ class Poiseuille(unittest.TestCase) :
E += abs(s[i,0]-np.polyval(p,x[i,1]))
N += 1
self.assertLess(E/N,5*vUp/100, "error is too large in Cavity")
self.assertLess(E/N,vUp/10, "error is too large in Cavity")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment