@@ -17,12 +17,12 @@ using GridVisualize
1717
1818function main (;
1919 problem = PoissonProblemPrimal,
20- nrefs = 4 , # number of uniform refinements of the initial grid
20+ nrefs = 3 , # number of uniform refinements of the initial grid
2121 order = 2 , # polynomial order of the FEspaces
2222 decay = 2.0 , # decay factor for the random coefficient
2323 mean = problem == PoissonProblemPrimal ? 1.0 : 0.0 , # mean value of coefficient
2424 domain = " square" , # domain, e.g., "square" or "lshape"
25- initial_modes = [[0 ], [1 ,0 ], [0 ,1 ], [0 ,0 ,1 ]], # initial multi-indices for stochastic basis
25+ initial_modes = [[0 ], [1 ,0 ], [0 ,1 ], [2 , 0 ], [ 0 ,0 ,1 ]], # initial multi-indices for stochastic basis
2626 f! = (result, qpinfo) -> (result[1 ] = 1 ), # right-hand side function
2727 use_iterative_solver = true , # use iterative solver ? (otherwise direct)
2828 Plotter = nothing )
@@ -69,13 +69,20 @@ function main(;
6969 @info " Solving..."
7070 solve! (problem, sol, C; rhs = f!, use_iterative_solver = use_iterative_solver)
7171
72+ # # compute exact error (by MC sampling)
73+ weightederrorH1, weightederrorL2, uniformerrorH1, uniformerrorL2 = calculate_sampling_error (sol, C; problem = problem, rhs = f!, order = order + 1 , nsamples = 50 )
74+
7275 # # plot solution
7376 if ! isnothing (Plotter)
7477 p = plot_modes (sol; Plotter = Plotter, ncols = 4 )
7578 display (p)
7679 end
7780
78- return sol, xgrid
81+ @info " RESULTS
82+ || ∇(u-u_h) || (w,u) = $(sqrt (weightederrorH1[end ])) , $(sqrt (uniformerrorH1[end ]))
83+ || u - u_h || (w,u) = $(sqrt (weightederrorL2[end ])) , $(sqrt (uniformerrorL2[end ])) "
84+
85+ return sol
7986end
8087
8188end # module
0 commit comments