1919from beam import (case_scene , run_reference_scene ,
2020 element_quad , element_tri ,
2121 quad_q1_rule , tri_p1_rule )
22+ coef = 0.1
2223
2324
2425class Incompressible (MMSCase2D ):
@@ -31,15 +32,15 @@ class Incompressible(MMSCase2D):
3132
3233 def u_ex (self , x , y , L ):
3334 k = np .pi / L
34- return ( np .sin (k * x ) * np .cos (k * y ),
35- - np .cos (k * x ) * np .sin (k * y ))
35+ return (coef * np .sin (k * x ) * np .cos (k * y ),
36+ - coef * np .cos (k * x ) * np .sin (k * y ))
3637
3738 def grad_u_ex (self , x , y , L ):
3839 k = np .pi / L
39- dux_dx = k * np .cos (k * x ) * np .cos (k * y )
40- dux_dy = - k * np .sin (k * x ) * np .sin (k * y )
41- duy_dx = k * np .sin (k * x ) * np .sin (k * y )
42- duy_dy = - k * np .cos (k * x ) * np .cos (k * y )
40+ dux_dx = coef * k * np .cos (k * x ) * np .cos (k * y )
41+ dux_dy = - coef * k * np .sin (k * x ) * np .sin (k * y )
42+ duy_dx = coef * k * np .sin (k * x ) * np .sin (k * y )
43+ duy_dy = - coef * k * np .cos (k * x ) * np .cos (k * y )
4344 return np .array ([[dux_dx , dux_dy ],
4445 [duy_dx , duy_dy ]])
4546
@@ -48,12 +49,12 @@ def source(self, x, y, E, nu, L, dim):
4849 k = np .pi / L
4950 ux = np .sin (k * x ) * np .cos (k * y )
5051 uy = - np .cos (k * x ) * np .sin (k * y )
51- d2ux_dxx = - k ** 2 * ux
52- d2ux_dyy = - k ** 2 * ux
53- d2ux_dxy = - k ** 2 * np .cos (k * x ) * np .sin (k * y )
54- d2uy_dxx = - k ** 2 * uy
55- d2uy_dyy = - k ** 2 * uy
56- d2uy_dxy = k ** 2 * np .sin (k * x ) * np .cos (k * y )
52+ d2ux_dxx = - coef * k ** 2 * ux
53+ d2ux_dyy = - coef * k ** 2 * ux
54+ d2ux_dxy = - coef * k ** 2 * np .cos (k * x ) * np .sin (k * y )
55+ d2uy_dxx = - coef * k ** 2 * uy
56+ d2uy_dyy = - coef * k ** 2 * uy
57+ d2uy_dxy = coef * k ** 2 * np .sin (k * x ) * np .cos (k * y )
5758 fx = - ((lam + 2 * mu ) * d2ux_dxx + lam * d2uy_dxy
5859 + mu * (d2ux_dyy + d2uy_dxy ))
5960 fy = - (mu * (d2ux_dxy + d2uy_dxx ) + lam * d2ux_dxy
@@ -97,8 +98,8 @@ def apply_bcs(self, Beam, nodes_2d, L, dim):
9798
9899
99100mms = Incompressible ()
100- createScene = case_scene (mms , element_quad )
101+ createScene = case_scene (mms , element_tri )
101102
102103
103104if __name__ == "__main__" :
104- run_reference_scene (element_quad , mms )
105+ run_reference_scene (element_tri , mms )
0 commit comments