-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestRun.m
More file actions
33 lines (29 loc) · 744 Bytes
/
Copy pathTestRun.m
File metadata and controls
33 lines (29 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
% Paolo Bignardi - May 2022
% Coercive wave equation numerical tests
clc
clear
close all
addpath(genpath('src'));
%% Define problem, discretization and mesh
% Create simple problem
problem = WaveProblem(1);
% Discretise the domain
nx = 128; nt = 128;
d = Discretization(nx, nt, problem.Q);
% Build mesh
mesh = CartesianMesh(d);
%% Custom form parameters
form = FormParameters(problem);
form.NU = 1.0001;
%% Solve problem
u = SolverWaves(problem, mesh, d, form);
%% Plot solution
xq_eval = {linspace(0, 1, 5), linspace(0, 1, 5)};
[U, X, T] = OperatorEval(u, mesh, d, xq_eval, 'u');
pcolor(X, T, U);
colorbar
shading flat;
xlabel("X"); ylabel("T");
%% Compute errors
errors = ComputeErrors(u, problem, mesh, d, "relative");
disp(errors.L2E)