@@ -7,13 +7,18 @@ using GridapDistributed
7
7
using PartitionedArrays
8
8
using Test
9
9
10
- function test_fe_spaces (parts,das)
10
+ function main (parts)
11
+ main (parts,SubAssembledRows ())
12
+ main (parts,FullyAssembledRows ())
13
+ end
14
+
15
+ function main (parts,das)
11
16
output = mkpath (joinpath (@__DIR__ ," output" ))
12
17
13
18
domain = (0 ,4 ,0 ,4 )
14
19
cells = (4 ,4 )
15
20
model = CartesianDiscreteModel (parts,domain,cells)
16
- Ω = Boundary (model)
21
+ Ω = Triangulation (model)
17
22
Γ = Boundary (model)
18
23
19
24
u ((x,y)) = x+ y
@@ -29,9 +34,8 @@ function test_fe_spaces(parts,das)
29
34
uh = interpolate (u,U)
30
35
eh = u - uh
31
36
32
- Ωint = Triangulation (no_ghost,model)
33
- dΩint = Measure (Ωint,3 )
34
- cont = ∫ ( abs2 (eh) )dΩint
37
+ dΩ = Measure (Ω,3 )
38
+ cont = ∫ ( abs2 (eh) )dΩ
35
39
@test sqrt (sum (cont)) < 1.0e-9
36
40
37
41
# Assembly
@@ -49,10 +53,10 @@ function test_fe_spaces(parts,das)
49
53
r1 = A1* x1 - b1
50
54
uh1 = FEFunction (U,x1)
51
55
eh1 = u - uh1
52
- @test sqrt (sum (∫ ( abs2 (eh1) )dΩint )) < 1.0e-9
56
+ @test sqrt (sum (∫ ( abs2 (eh1) )dΩ )) < 1.0e-9
53
57
54
58
writevtk (Ω,joinpath (output," Ω" ), nsubcells= 10 ,
55
- celldata= [" err" => cont[Ωint ]],
59
+ celldata= [" err" => cont[Ω ]],
56
60
cellfields= [" uh" => uh," zh" => zh," eh" => eh])
57
61
58
62
writevtk (Γ,joinpath (output," Γ" ),cellfields= [" uh" => uh])
@@ -63,43 +67,27 @@ function test_fe_spaces(parts,das)
63
67
r2 = A2* x2 - b2
64
68
uh = FEFunction (U,x2)
65
69
eh2 = u - uh
66
- sqrt (sum (∫ ( abs2 (eh2) )dΩint )) < 1.0e-9
70
+ sqrt (sum (∫ ( abs2 (eh2) )dΩ )) < 1.0e-9
67
71
68
72
op = AffineFEOperator (a,l,U,V,das)
69
73
solver = LinearFESolver (BackslashSolver ())
70
74
uh = solve (solver,op)
71
75
eh = u - uh
72
- @test sqrt (sum (∫ ( abs2 (eh) )dΩint )) < 1.0e-9
76
+ @test sqrt (sum (∫ ( abs2 (eh) )dΩ )) < 1.0e-9
73
77
74
78
data = collect_cell_matrix (U,V,a (du,dv))
75
79
A3 = assemble_matrix (assem,data)
76
80
x3 = A3\ op. op. vector
77
81
uh = FEFunction (U,x3)
78
82
eh3 = u - uh
79
- sqrt (sum (∫ ( abs2 (eh3) )dΩint )) < 1.0e-9
83
+ sqrt (sum (∫ ( abs2 (eh3) )dΩ )) < 1.0e-9
80
84
81
85
A4 = allocate_matrix (assem,data)
82
86
assemble_matrix! (A4,assem,data)
83
87
x4 = A4\ op. op. vector
84
88
uh = FEFunction (U,x4)
85
89
eh4 = u - uh
86
- sqrt (sum (∫ ( abs2 (eh4) )dΩint)) < 1.0e-9
87
-
88
- al (u,v) = ∫ ( ∇ (v)⋅ ∇ (u) )dΩass
89
- ll (v) = ∫ ( 0 * v )dΩass
90
-
91
- data = collect_cell_matrix_and_vector (U,V,al (du,dv),ll (dv),zh)
92
- A,b = assemble_matrix_and_vector (assem,data)
93
- x = A\ b
94
- r = A* x - b
95
- uh = FEFunction (U,x)
96
- eh = u - uh
97
- @test sqrt (sum (∫ ( abs2 (eh) )dΩint)) < 1.0e-9
98
-
99
- op = AffineFEOperator (al,ll,U,V,das)
100
- uh = solve (solver,op)
101
- eh = u - uh
102
- @test sqrt (sum (∫ ( abs2 (eh) )dΩint)) < 1.0e-9
90
+ sqrt (sum (∫ ( abs2 (eh4) )dΩ)) < 1.0e-9
103
91
104
92
dv = get_fe_basis (V)
105
93
l= ∫ (1 * dv)dΩass
@@ -114,9 +102,4 @@ function test_fe_spaces(parts,das)
114
102
115
103
end
116
104
117
- function main (parts)
118
- test_fe_spaces (parts,SubAssembledRows ())
119
- test_fe_spaces (parts,FullyAssembledRows ())
120
- end
121
-
122
105
end # module
0 commit comments