def test_validation2DEF_Delaunay_triangles():
start = time.time()
#### 2D FE Delaunay triangle mesh
- meshList=['squareWithTriangles_1','squareWithTriangles_2','squareWithTriangles_3','squareWithTriangles_4','squareWithTriangles_5']
+ meshList=['squareWithTriangles_1','squareWithTriangles_2','squareWithTriangles_3','squareWithTriangles_4','squareWithTriangles_5']#linear system is hard to solve for 'squareWithTriangles_5'
meshType="Unstructured_triangles"
testColor="Green"
nbMeshes=len(meshList)
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D triangle meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D triangle meshes : scheme order is ", -a)
assert abs(a+0.05)<0.01
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D brickwall meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D brickwall meshes : scheme order is ", -a)
assert abs(a-0.13)<0.01
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D checkerboard meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D checkerboard meshes : scheme order is ", -a)
assert abs(a+0.5475)<0.001 #The scheme is not converging
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D cross triangles meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D cross triangles meshes : scheme order is ", -a)
assert abs(a+0.035)<0.001
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D deformed quadrangles meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D deformed quadrangles meshes : scheme order is ", -a)
assert abs(a+0.944)<0.001
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D flat cross triangles meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D flat cross triangles meshes : scheme order is ", -a)
assert abs(a-0.32)<0.1
# Plot of convergence curve
# Storing of numerical errors, mesh sizes and diagonal values
for filename in meshList:
error_tab[i], mesh_size_tab[i], diag_data[i], min_sol_num, max_sol_num, time_tab[i] =FiniteVolumes2DDiffusion_SQUARE.solve_file(mesh_path+filename,resolution,meshType,testColor)
- print min_sol_num
assert min_sol_num>-0.03
assert max_sol_num<1.2
plt.plot(curv_abs, diag_data[i], label= str(mesh_size_tab[i]) + ' cells')
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D hexagonal meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D hexagonal meshes : scheme order is ", -a)
assert abs(a+1.95)<0.01
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D refined squares meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D refined squares meshes : scheme order is ", -a)
assert abs(a+0.982)<0.001
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D long rectangles meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D long rectangles meshes : scheme order is ", -a)
assert abs(a+1.488)<0.1
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D skinny triangles meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D skinny triangles meshes : scheme order is ", -a)
assert abs(a-0.442)<0.01
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV for diffusion on 2D rectangular meshes : scheme order is ", -a
+ print( "FV for diffusion on 2D rectangular meshes : scheme order is ", -a)
assert abs(a+2)<0.1
# Plot of convergence curve
a=( a3*b1-a2*b2)/det
b=(-a2*b1+a1*b2)/det
- print "FV on 3D checkerboard mesh : scheme order is ", -a
+ print( "FV on 3D checkerboard mesh : scheme order is ", -a)
assert abs(a-0.26)<0.01
# Plot of convergence curve
bp=(-a2*b1p+a1*b2p)/det
if(scaling==0):
- print "FV pseudo staggered on 2D checkerboard meshes : scheme order for pressure without scaling is ", -ap
+ print( "FV pseudo staggered on 2D checkerboard meshes : scheme order for pressure without scaling is ", -ap)
else:
- print "FV pseudo staggered on 2D checkerboard meshes : scheme order for pressure with scaling is ", -ap
+ print( "FV pseudo staggered on 2D checkerboard meshes : scheme order for pressure with scaling is ", -ap)
b1u=np.dot(error_u_tab,mesh_size_tab)
b2u=np.sum(error_u_tab)
bu=(-a2*b1u+a1*b2u)/det
if(scaling==0):
- print "FV pseudo staggered on 2D checkerboard meshes : scheme order for velocity without scaling is ", -au
+ print( "FV pseudo staggered on 2D checkerboard meshes : scheme order for velocity without scaling is ", -au)
else:
- print "FV pseudo staggered on 2D checkerboard meshes : scheme order for velocity with scaling is ", -au
+ print( "FV pseudo staggered on 2D checkerboard meshes : scheme order for velocity with scaling is ", -au)
# Plot of convergence curves
plt.close()