Skip to content

Commit 638b83e

Browse files
committed
Improved version for paper
1 parent 582c70d commit 638b83e

8 files changed

+58
-12
lines changed

+bases/getPolynomials.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function symPolynomials = getPolynomials(order)
1+
function [symPolynomials, xyz] = getPolynomials(order)
22
% GETPOLYNOMIALS Gives the symbolic representation of the polynomials that
33
% compose the mixed-order curl-conforming hexahedral space.
44
%
File renamed without changes.
File renamed without changes.
File renamed without changes.

mainEvaluateCoefficients.m

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
%% Driver to show the operating principle of the basis functions.
2+
3+
% Point defined in the reference element.
4+
pointToEvaluateInReferenceElement = [1/2, 1/2, 1/2];
5+
6+
%% Using the coefficients given in the paper.
7+
% Table extracted from Table II in the manuscript.
8+
disp('Evaluating the bases from a stored table of coefficients')
9+
load('tableReferenceCoefficients');
10+
% Polynomial order of the basis functions
11+
orderBasisFunctions = 2;
12+
% Polynomials that compose the space of function in the reference hexahedron.
13+
[polynomialsInSpace, symXYZ] = bases.getPolynomials(orderBasisFunctions);
14+
% The proposed functions are a linear combination of these polynomials with the
15+
% coefficients obtained from the procedure shown in figure 3
16+
symbolicReferenceFunctions = tableReferenceCoefficients.'*polynomialsInSpace;
17+
symbolicReferenceFunctionEvaluated = zeros(size(symbolicReferenceFunctions));
18+
for indexFunctions = 1:size(symbolicReferenceFunctions,1)
19+
for indexComponent = 1:size(symbolicReferenceFunctions,2)
20+
symbolicReferenceFunctionEvaluated(indexFunctions,indexComponent) = vpa(subs(symbolicReferenceFunctions(indexFunctions,indexComponent), symXYZ, pointToEvaluateInReferenceElement));
21+
end
22+
end
23+
24+
%% This is the equivalent procedure following the workflow of this demonstrator.
25+
disp('Evaluating the bases following the workflow of the code')
26+
sysBasesObj = bases.SystematicBases();
27+
polyReferenceFunctionEvaluated = sysBasesObj.getBasesEvaluated(pointToEvaluateInReferenceElement);
28+
29+
% We can compare both outputs to obtain that numerically both procedures yield
30+
% the same results.
31+
fprintf('The total error obtained is %e\n',sum(abs(symbolicReferenceFunctionEvaluated(:)-polyReferenceFunctionEvaluated(:))))

mainGenerateCoefficients.m

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
%% Driver for the generation of basis functions following the pseudcode shown in the document.
2+
3+
%% Obtention of the basis functions following the figure 2.
4+
% For demonstration purposes.
5+
disp("Removing the bases stored...")
6+
bases.SystematicBases.removeBases();
7+
% The bases are defined as an object, and here we define the polynomial q in the
8+
% dofs (6), (7), and (8).
9+
sysBasesObj = bases.SystematicBases();
10+
disp("Generating the new coefficients...")
11+
% We obtain the coefficients as the dual basis to the Nédélec dofs.
12+
sysBasesObj.getCoefficients();
13+
% We store the coefficients for using them later.
14+
disp("Storing the coefficients generated...")
15+
sysBasesObj.saveCoefficients();
16+
disp("Showing the coefficients of the polynomials...")
17+
bases.showPolynomials();
18+
sysBasesObj.showBases();

mainHalfFilled.m

+8-11
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414

1515
%% Obtention of analytic eigenvalues.
1616
% Eigenvalues for the first six modes.
17-
k101 = getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 1, 0, 300, 16);
18-
k102 = getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 1, 0, 600, 16);
19-
k103 = getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 1, 0, 800, 16);
20-
k201 = getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 2, 0, 540, 16);
21-
k202 = getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 2, 0, 760, 16);
22-
k301 = getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 3, 0, 750, 16);
17+
k101 = math.getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 1, 0, 300, 16);
18+
k102 = math.getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 1, 0, 600, 16);
19+
k103 = math.getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 1, 0, 800, 16);
20+
k201 = math.getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 2, 0, 540, 16);
21+
k202 = math.getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 2, 0, 760, 16);
22+
k301 = math.getKcFromHalfFilledCavity(a, b, c, h, epr, sigmaCond, 3, 0, 750, 16);
2323
numberKc = 6;
2424
kc = [k101 k201 k102 k301 k202 k103];
2525

2626
%% Loading of the hexahedral meshes.
2727
% In this container are included the meshes used for the results.
28-
load('meshesHalfFilledTAP2021.mat','projectMeshes');
28+
load('+settings/meshesHalfFilledTAP2021.mat','projectMeshes');
2929
lengthMeshes = length(projectMeshes);
3030
% Container to store the error for the different eigenvalues.
3131
errorHalfConvergence = zeros(numberKc,lengthMeshes);
@@ -45,9 +45,6 @@
4545
% We store the coefficients for using them later.
4646
disp("Storing the coefficients generated...")
4747
sysBasesObj.saveCoefficients();
48-
disp("Showing the coefficients of the polynomials...")
49-
bases.showPolynomials();
50-
sysBasesObj.showBases();
5148

5249
%% Running through all the meshes.
5350
for indexMesh = 1:length(projectMeshes)
@@ -75,4 +72,4 @@
7572
end
7673

7774
%% Plotting the results.
78-
plotHalfFilledCavity(errorHalfConvergence,lengthHalfConvergence);
75+
math.plotHalfFilledCavity(errorHalfConvergence,lengthHalfConvergence);

tableReferenceCoefficients.mat

4.95 KB
Binary file not shown.

0 commit comments

Comments
 (0)