|
20 | 20 |
|
21 | 21 | struct Metrics |
22 | 22 | max_von_mises_stress_nodes::Float64 |
| 23 | + L2_error::Float64 |
23 | 24 | end |
24 | 25 |
|
25 | 26 | function value_with_unit(json::JSON.Object{String,Any}) |
@@ -64,6 +65,42 @@ function vonMises!(result,∇u,qpinfo) |
64 | 65 | result[1] = sqrt(1.5)*sqrt(dot(sv,sv)+p*p)/qpinfo.volume |
65 | 66 | end |
66 | 67 |
|
| 68 | +function sigma_exact(r,θ,a,T) |
| 69 | + cos2t = cos(2*θ) |
| 70 | + cos4t = cos(4*θ) |
| 71 | + sin2t = sin(2*θ) |
| 72 | + sin4t = sin(4*θ) |
| 73 | + |
| 74 | + fac1 = a^2/(r^2) |
| 75 | + fac2 = T*1.5 * fac1*fac1 |
| 76 | + |
| 77 | + sxx = T - T*fac1 *(1.5*cos2t+cos4t) + fac2 *cos4t |
| 78 | + syy = -T *fac1 * (0.5*cos2t-cos4t) - fac2*cos4t |
| 79 | + sxy = -T *fac1 * (0.5*sin2t+sin4t) + fac2*sin4t |
| 80 | + |
| 81 | + return sxx,sxy,syy; |
| 82 | +end |
| 83 | + |
| 84 | +function traction_right_kernel!(result,qpinfo) |
| 85 | + x = qpinfo.x[1] |
| 86 | + y = qpinfo.x[2] |
| 87 | + r = sqrt(x^2+y^2) |
| 88 | + θ = atan(y,x) |
| 89 | + sxx,sxy,_ = sigma_exact(r,θ,qpinfo.params[1],qpinfo.params[2]) |
| 90 | + result[1] = sxx |
| 91 | + result[2] = sxy |
| 92 | +end |
| 93 | + |
| 94 | + |
| 95 | +function traction_top_kernel!(result,qpinfo) |
| 96 | + x = qpinfo.x[1] |
| 97 | + y = qpinfo.x[2] |
| 98 | + r = sqrt(x^2+y^2) |
| 99 | + θ = atan(y,x) |
| 100 | + _,sxy,syy = sigma_exact(r,θ,qpinfo.params[1],qpinfo.params[2]) |
| 101 | + result[1] = sxy |
| 102 | + result[2] = syy |
| 103 | +end |
67 | 104 |
|
68 | 105 | function u_ex_kernel!(result,qpinfo) |
69 | 106 | x = qpinfo.x[1] |
@@ -111,7 +148,10 @@ function solve_plate_with_hole(config::PlateConfig,grid::ExtendableGrid,outputzi |
111 | 148 | assign_unknown!(PD, u) |
112 | 149 |
|
113 | 150 | assign_operator!(PD, BilinearOperator(sigma!, [grad(u)];params=[config.E,config.ν])) |
114 | | - assign_operator!(PD, InterpolateBoundaryData(u, u_ex_kernel!; regions = [3,4], params = [config.radius,config.F,config.E,config.ν])) |
| 151 | + assign_operator!(PD, LinearOperator(traction_right_kernel!,[id(u)];entities = ON_BFACES, regions = [3], params = [config.radius,config.F])) |
| 152 | + assign_operator!(PD, LinearOperator(traction_top_kernel!,[id(u)];entities = ON_BFACES, regions = [4], params = [config.radius,config.F])) |
| 153 | + # Dirichlet BC version |
| 154 | + # assign_operator!(PD, InterpolateBoundaryData(u, u_ex_kernel!; regions = [3,4], params = [config.radius,config.F,config.E,config.ν])) |
115 | 155 | assign_operator!(PD, HomogeneousBoundaryData(u; regions = [1], mask = [1,0])) |
116 | 156 | assign_operator!(PD, HomogeneousBoundaryData(u; regions = [2], mask = [0,1])) |
117 | 157 |
|
@@ -140,7 +180,7 @@ function solve_plate_with_hole(config::PlateConfig,grid::ExtendableGrid,outputzi |
140 | 180 | vonMises_stresses = evaluate(vonMisesIntegration,sol) |
141 | 181 |
|
142 | 182 |
|
143 | | - metrics = Metrics(maximum(vonMises_stresses)) |
| 183 | + metrics = Metrics(maximum(vonMises_stresses),L2error) |
144 | 184 |
|
145 | 185 | outputvtk = splitdir(outputzip)[1]*"/results_"*config.id*".vtu"; |
146 | 186 | writeVTK(outputvtk,grid;compress=false, u_x=u_x,u_y=u_y,u_mag=u_mag,uexx=u_exx,uexy=u_exy,uex=uex_mag) |
|
0 commit comments