|
31 | 31 | */ |
32 | 32 | public class Example6 { |
33 | 33 | public static void main(String[] args) { |
34 | | -// Func u = new Func("u", x, y); |
35 | | -// Func v = new Func("v", x, y); |
36 | | -// |
37 | | -//// //Our PDE equation |
38 | | -//// Eq pde = new Eq(0.5*dot(grad(u), grad(v)) + 0.1*u*v, (x*x+y*y)*v); |
39 | | -//// //Read the mesh |
40 | | -//// Mesh2D mesh = new Mesh2D("mesh1", x, y); |
41 | | -//// mesh.readTriangleMesh("double_hex3.1.node", "double_hex3.1.ele"); |
42 | | -//// solve(pde, mesh, null, "double_hex3.1.dat"); |
43 | | -// |
44 | | -// //Another PDE equation with Dirichlet condition |
45 | | -// WeakForm wf = new WeakForm(dot(grad(u), grad(v)), (-2*(x*x+y*y)+36)*v, u, v); |
46 | | -// //Eq pde2 = new Eq(u*v, (-2*(x*x+y*y)+36)*v); |
47 | | -// Mesh2D mesh2 = new Mesh2D("mesh2"); |
48 | | -// //mesh2.readGridGenMesh("patch_triangle.grd"); |
49 | | -// mesh2.readGridGenMesh("triangle.grd"); |
50 | | -// //Mark boundary nodes |
51 | | -// double eps = 0.01; |
52 | | -// for(Node n : mesh2.nodes) { |
53 | | -// //if(1-Math.abs(n.coords[0])<eps || 1-Math.abs(n.coords[1])<eps || Math.abs(n.coords[0])<eps || Math.abs(n.coords[1])<eps ) |
54 | | -// if(Math.abs(3-Math.abs(n.coords[0]))<eps || Math.abs(3-Math.abs(n.coords[1]))<eps) |
55 | | -// n.setType(1); |
56 | | -// } |
57 | | -// Map<Integer, Double> diri = new HashMap<Integer, Double>(); |
58 | | -// diri.put(1, 0.0); |
59 | | -// //solve(pde2, mesh2, diri, "patch_triangle.dat"); |
60 | | -// solve(wf, mesh2, diri, "triangle.dat"); |
61 | | -// solve2(mesh2, diri, "triangle_hardcode.dat"); |
62 | | - peper_example(); |
| 34 | + Func u = new Func("u", x, y); |
| 35 | + Func v = new Func("v", x, y); |
| 36 | + |
| 37 | +// //Our PDE equation |
| 38 | +// Eq pde = new Eq(0.5*dot(grad(u), grad(v)) + 0.1*u*v, (x*x+y*y)*v); |
| 39 | +// //Read the mesh |
| 40 | +// Mesh2D mesh = new Mesh2D("mesh1", x, y); |
| 41 | +// mesh.readTriangleMesh("double_hex3.1.node", "double_hex3.1.ele"); |
| 42 | +// solve(pde, mesh, null, "double_hex3.1.dat"); |
| 43 | + |
| 44 | + //Another PDE equation with Dirichlet condition |
| 45 | + ////WeakForm wf = new WeakForm(dot(grad(u), grad(v)), (-2*(x*x+y*y)+36)*v, u, v); |
| 46 | + //Eq pde2 = new Eq(u*v, (-2*(x*x+y*y)+36)*v); |
| 47 | + Mesh2D mesh2 = new Mesh2D("mesh2"); |
| 48 | + //mesh2.readGridGenMesh("patch_triangle.grd"); |
| 49 | + mesh2.readGridGenMesh("triangle.grd"); |
| 50 | + //Mark boundary nodes |
| 51 | + double eps = 0.01; |
| 52 | + for(Node n : mesh2.nodes) { |
| 53 | + //if(1-Math.abs(n.coords[0])<eps || 1-Math.abs(n.coords[1])<eps || Math.abs(n.coords[0])<eps || Math.abs(n.coords[1])<eps ) |
| 54 | + if(Math.abs(3-Math.abs(n.coords[0]))<eps || Math.abs(3-Math.abs(n.coords[1]))<eps) |
| 55 | + n.setType(1); |
| 56 | + } |
| 57 | + Map<Integer, Double> diri = new HashMap<Integer, Double>(); |
| 58 | + diri.put(1, 0.0); |
| 59 | + //solve(pde2, mesh2, diri, "patch_triangle.dat"); |
| 60 | + ////solve(wf, mesh2, diri, "triangle.dat"); |
| 61 | + solve2(mesh2, diri, "triangle_hardcode.dat"); |
| 62 | + |
| 63 | + //peper_example(); |
63 | 64 | } |
64 | 65 |
|
65 | 66 | public static void peper_example() { |
@@ -262,6 +263,9 @@ public static void solve2(Mesh2D mesh, Map<Integer, Double> dirichlet, String ou |
262 | 263 | List<Domain> eles = mesh.getSubDomains(); |
263 | 264 | double[][] matA = new double[mesh.nodes.size()][mesh.nodes.size()]; |
264 | 265 | double[] vecb = new double[mesh.nodes.size()]; |
| 266 | + |
| 267 | + int NN = 10000*512/eles.size(); |
| 268 | + for(int ii=0; ii<NN; ii++) |
265 | 269 | for(Domain d : eles) { |
266 | 270 | Element e = (Element)d; |
267 | 271 | double[] coords = e.getNodeCoords(); |
|
0 commit comments