Skip to content

Commit

Permalink
modified: validate_visco.py
Browse files Browse the repository at this point in the history
	modified:   viscosity_models.cpp
  • Loading branch information
NorbertHofbauer committed Mar 17, 2024
1 parent 9ba58d4 commit ccc9c98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion miniapps/nurbs_stokes_fsi/validate_visco.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,24 @@

# compute dyn_vis_spp with splinepy values
k1=1786
k2=0.054
k2=0.0084
#k2=0
k3=0.73
k3=1
print("dyn_vis_spp")
for i in range(len(du_dy[:, 0])):
print(np.multiply(k1,1/(1+k2*np.absolute(du_dy[i,0].ravel()))**k3))
dyn_vis_spp = np.multiply(k1,1/(1+k2*np.absolute(du_dy[:,0].ravel()))**k3)
dyn_vis_spp = k1 / np.power(1 + k2 * abs(du_dy[:, 0]), k3)

# compute K with splinepy values
print("K_spp")
for i in range(len(d2u_dy2[:, 0])):
print(np.multiply(-d2u_dy2[i].ravel(),dyn_vis_spp[i].ravel()))
K_spp = np.multiply(-d2u_dy2[:,0].ravel(),dyn_vis_spp[:].ravel())

K_spp = np.gradient(dyn_vis_spp * du_dy[:,0],y[:,0])

# compute error
error_u = np.multiply(uv[:, 0].ravel()-u_v[:, 0].ravel(),100/u_v[:, 0].ravel())
# check elementwise to catch zero values from u
Expand Down
6 changes: 4 additions & 2 deletions miniapps/nurbs_stokes_fsi/viscosity_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ double ShearRate::Calc(mfem::DenseMatrix &grad)
double shearrate = 0;
for (size_t n = 0; n < grad.Size(); n++)
{
for (size_t m = 0; m < grad.Size(); m++)
//for (size_t m = 0; m < grad.Size(); m++)5
for (size_t m = n; m < grad.Size(); m++)
{
if (n==m)
{
shearrate += 2*grad(n,m)*grad(n,m);
}else
{
shearrate += 0.5*(grad(n,m)+grad(m,n))*(grad(n,m)+grad(m,n));
//shearrate += 0.5*(grad(n,m)+grad(m,n))*(grad(n,m)+grad(m,n));
shearrate += (grad(n,m)+grad(m,n))*(grad(n,m)+grad(m,n));
}
//std::cout << "shearrate " << shearrate << " n " << n << " m " << m << "\n";
}
Expand Down

0 comments on commit ccc9c98

Please sign in to comment.