-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_pressure_field_order1.jl
31 lines (25 loc) · 1.32 KB
/
plot_pressure_field_order1.jl
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
# Copyright (c) 2024 Ashwin. S. Nayak, Andrés Prieto, Daniel Fernández Comesaña
#
# This file is part of pressure-projections
#
# SPDX-License-Identifier: MIT
"""
Plot the interpolated values of the exact solution for an specific triangular mesh (N)
a fixed FE order, and a given wavenumber k
"""
# Load the package to use the generate_mesh function
include("meshing.jl")
# Load the computing.jl file to compute the relative errors
include("../computing.jl")
# Define the range of N values: logspace between 1e1 and 500
N_value = 25
k = 50.0 # wavenumber
orderFE_postprocessing = 1 # order of the finite element for postprocessing
# Define the exact solution# Compute the analytical solution and the displacement error
p0 = 1.0; # Pressure amplitude
pex(x) = p0*exp(1im*k*x[1]) # =-divergence(uex(x))
uex(x) = VectorValue(1im/k*p0*exp(1im*k*x[1]), 0.0)
grad_pex(x) = VectorValue(1im*k*p0*exp(1im*k*x[1]), 0.0) # =k^2*uex(x)
exact_solution = Dict("ExactPressure"=>pex, "ExactDisplacement"=>uex, "ExactGradientPressure"=>grad_pex)
# Compute the relative errors and plot
error_L2_u, error_H1_u, error_L2_p, error_H1_p, error_L2_proj_DG, error_H1_proj_DG, error_L2_proj_CG, error_H1_proj_CG, error_L2_proj_H1, error_H1_proj_H1, error_L2_proj_H2_DG, error_H1_proj_H2_DG = compute_from_exact(k, N_value, orderFE_postprocessing, exact_solution, true)