Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
f69b27d8
Commit
f69b27d8
authored
11 months ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for PolynomialReconstruction using element quadrature
parent
e6bb5bed
No related branches found
No related tags found
1 merge request
!205
High-order polynomial reconstruction
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_PolynomialReconstruction.cpp
+777
-765
777 additions, 765 deletions
tests/test_PolynomialReconstruction.cpp
with
777 additions
and
765 deletions
tests/test_PolynomialReconstruction.cpp
+
777
−
765
View file @
f69b27d8
...
@@ -24,8 +24,14 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -24,8 +24,14 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
{
{
SECTION
(
"degree 1"
)
SECTION
(
"degree 1"
)
{
{
PolynomialReconstructionDescriptor
descriptor
{
IntegrationMethodType
::
cell_center
,
1
};
std
::
vector
<
PolynomialReconstructionDescriptor
>
descriptor_list
=
{
PolynomialReconstructionDescriptor
{
IntegrationMethodType
::
cell_center
,
1
},
PolynomialReconstructionDescriptor
{
IntegrationMethodType
::
element
,
1
},
};
for
(
auto
descriptor
:
descriptor_list
)
{
SECTION
(
name
(
descriptor
.
integrationMethodType
()))
{
SECTION
(
"1D"
)
SECTION
(
"1D"
)
{
{
using
R1
=
TinyVector
<
1
>
;
using
R1
=
TinyVector
<
1
>
;
...
@@ -224,8 +230,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -224,8 +230,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
size_t
i
=
0
;
i
<
slope
.
dimension
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
slope
.
dimension
();
++
i
)
{
const
double
reconstructed_slope
=
const
double
reconstructed_slope
=
(
1
/
0.2
)
*
(
dpk_Vh
(
cell_id
,
i
)(
R1
{
0.1
}
+
xj
[
cell_id
])
-
(
1
/
0.2
)
*
(
dpk_Vh
(
cell_id
,
i
)(
R1
{
0.1
}
+
xj
[
cell_id
])
-
dpk_Vh
(
cell_id
,
i
)(
xj
[
cell_id
]
-
R1
{
0.1
}));
dpk_Vh
(
cell_id
,
i
)(
xj
[
cell_id
]
-
R1
{
0.1
}));
max_slope_error
=
std
::
max
(
max_slope_error
,
std
::
abs
(
reconstructed_slope
-
slope
[
i
]));
max_slope_error
=
std
::
max
(
max_slope_error
,
std
::
abs
(
reconstructed_slope
-
slope
[
i
]));
}
}
...
@@ -385,8 +391,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -385,8 +391,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
size_t
i
=
0
;
i
<
slope
.
dimension
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
slope
.
dimension
();
++
i
)
{
const
double
reconstructed_slope
=
const
double
reconstructed_slope
=
(
1
/
0.2
)
*
(
dpk_Vh
(
cell_id
,
i
)(
R1
{
0.1
}
+
xj
[
cell_id
])
-
(
1
/
0.2
)
*
(
dpk_Vh
(
cell_id
,
i
)(
R1
{
0.1
}
+
xj
[
cell_id
])
-
dpk_Vh
(
cell_id
,
i
)(
xj
[
cell_id
]
-
R1
{
0.1
}));
dpk_Vh
(
cell_id
,
i
)(
xj
[
cell_id
]
-
R1
{
0.1
}));
max_slope_error
=
std
::
max
(
max_slope_error
,
std
::
abs
(
reconstructed_slope
-
slope
[
i
]));
max_slope_error
=
std
::
max
(
max_slope_error
,
std
::
abs
(
reconstructed_slope
-
slope
[
i
]));
}
}
...
@@ -494,8 +500,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -494,8 +500,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
{
{
double
max_x_slope_error
=
0
;
double
max_x_slope_error
=
0
;
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
const
R3
reconstructed_slope
=
const
R3
reconstructed_slope
=
(
1
/
0.2
)
*
(
dpk_uh
[
cell_id
](
R2
{
0.1
,
0
}
+
xj
[
cell_id
])
-
(
1
/
0.2
)
*
(
dpk_uh
[
cell_id
](
R2
{
0.1
,
0
}
+
xj
[
cell_id
])
-
dpk_uh
[
cell_id
](
xj
[
cell_id
]
-
R2
{
0.1
,
0
}));
dpk_uh
[
cell_id
](
xj
[
cell_id
]
-
R2
{
0.1
,
0
}));
max_x_slope_error
=
std
::
max
(
max_x_slope_error
,
l2Norm
(
reconstructed_slope
-
R3
{
1.7
,
-
0.6
,
3.1
}));
max_x_slope_error
=
std
::
max
(
max_x_slope_error
,
l2Norm
(
reconstructed_slope
-
R3
{
1.7
,
-
0.6
,
3.1
}));
}
}
...
@@ -505,8 +511,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -505,8 +511,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
{
{
double
max_y_slope_error
=
0
;
double
max_y_slope_error
=
0
;
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
const
R3
reconstructed_slope
=
const
R3
reconstructed_slope
=
(
1
/
0.2
)
*
(
dpk_uh
[
cell_id
](
R2
{
0
,
0.1
}
+
xj
[
cell_id
])
-
(
1
/
0.2
)
*
(
dpk_uh
[
cell_id
](
R2
{
0
,
0.1
}
+
xj
[
cell_id
])
-
dpk_uh
[
cell_id
](
xj
[
cell_id
]
-
R2
{
0
,
0.1
}));
dpk_uh
[
cell_id
](
xj
[
cell_id
]
-
R2
{
0
,
0.1
}));
max_y_slope_error
=
std
::
max
(
max_y_slope_error
,
l2Norm
(
reconstructed_slope
-
R3
{
-
2.2
,
1.3
,
-
1.1
}));
max_y_slope_error
=
std
::
max
(
max_y_slope_error
,
l2Norm
(
reconstructed_slope
-
R3
{
-
2.2
,
1.3
,
-
1.1
}));
}
}
...
@@ -553,8 +559,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -553,8 +559,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
{
{
double
max_x_slope_error
=
0
;
double
max_x_slope_error
=
0
;
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
const
R2x2
reconstructed_slope
=
const
R2x2
reconstructed_slope
=
(
1
/
0.2
)
*
(
dpk_Ah
[
cell_id
](
R2
{
0.1
,
0
}
+
xj
[
cell_id
])
-
(
1
/
0.2
)
*
(
dpk_Ah
[
cell_id
](
R2
{
0.1
,
0
}
+
xj
[
cell_id
])
-
dpk_Ah
[
cell_id
](
xj
[
cell_id
]
-
R2
{
0.1
,
0
}));
dpk_Ah
[
cell_id
](
xj
[
cell_id
]
-
R2
{
0.1
,
0
}));
max_x_slope_error
=
max_x_slope_error
=
std
::
max
(
max_x_slope_error
,
frobeniusNorm
(
reconstructed_slope
-
R2x2
{
+
1.7
,
+
2.1
,
//
std
::
max
(
max_x_slope_error
,
frobeniusNorm
(
reconstructed_slope
-
R2x2
{
+
1.7
,
+
2.1
,
//
...
@@ -566,8 +572,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -566,8 +572,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
{
{
double
max_y_slope_error
=
0
;
double
max_y_slope_error
=
0
;
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
const
R2x2
reconstructed_slope
=
const
R2x2
reconstructed_slope
=
(
1
/
0.2
)
*
(
dpk_Ah
[
cell_id
](
R2
{
0
,
0.1
}
+
xj
[
cell_id
])
-
(
1
/
0.2
)
*
(
dpk_Ah
[
cell_id
](
R2
{
0
,
0.1
}
+
xj
[
cell_id
])
-
dpk_Ah
[
cell_id
](
xj
[
cell_id
]
-
R2
{
0
,
0.1
}));
dpk_Ah
[
cell_id
](
xj
[
cell_id
]
-
R2
{
0
,
0.1
}));
max_y_slope_error
=
max_y_slope_error
=
std
::
max
(
max_y_slope_error
,
frobeniusNorm
(
reconstructed_slope
-
R2x2
{
+
1.2
,
-
2.2
,
//
std
::
max
(
max_y_slope_error
,
frobeniusNorm
(
reconstructed_slope
-
R2x2
{
+
1.2
,
-
2.2
,
//
...
@@ -689,7 +695,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -689,7 +695,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
double
max_x_slope_error
=
0
;
double
max_x_slope_error
=
0
;
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
const
double
reconstructed_slope
=
const
double
reconstructed_slope
=
(
dpk_fh
[
cell_id
](
R3
{
0.1
,
0
,
0
}
+
xj
[
cell_id
])
-
dpk_fh
[
cell_id
](
xj
[
cell_id
]
-
R3
{
0.1
,
0
,
0
}))
/
0.2
;
(
dpk_fh
[
cell_id
](
R3
{
0.1
,
0
,
0
}
+
xj
[
cell_id
])
-
dpk_fh
[
cell_id
](
xj
[
cell_id
]
-
R3
{
0.1
,
0
,
0
}))
/
0.2
;
max_x_slope_error
=
std
::
max
(
max_x_slope_error
,
std
::
abs
(
reconstructed_slope
-
1.7
));
max_x_slope_error
=
std
::
max
(
max_x_slope_error
,
std
::
abs
(
reconstructed_slope
-
1.7
));
}
}
...
@@ -700,7 +707,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -700,7 +707,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
double
max_y_slope_error
=
0
;
double
max_y_slope_error
=
0
;
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
const
double
reconstructed_slope
=
const
double
reconstructed_slope
=
(
dpk_fh
[
cell_id
](
R3
{
0
,
0.1
,
0
}
+
xj
[
cell_id
])
-
dpk_fh
[
cell_id
](
xj
[
cell_id
]
-
R3
{
0
,
0.1
,
0
}))
/
0.2
;
(
dpk_fh
[
cell_id
](
R3
{
0
,
0.1
,
0
}
+
xj
[
cell_id
])
-
dpk_fh
[
cell_id
](
xj
[
cell_id
]
-
R3
{
0
,
0.1
,
0
}))
/
0.2
;
max_y_slope_error
=
std
::
max
(
max_y_slope_error
,
std
::
abs
(
reconstructed_slope
-
(
-
1.3
)));
max_y_slope_error
=
std
::
max
(
max_y_slope_error
,
std
::
abs
(
reconstructed_slope
-
(
-
1.3
)));
}
}
...
@@ -711,7 +719,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -711,7 +719,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
double
max_z_slope_error
=
0
;
double
max_z_slope_error
=
0
;
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
for
(
CellId
cell_id
=
0
;
cell_id
<
mesh
.
numberOfCells
();
++
cell_id
)
{
const
double
reconstructed_slope
=
const
double
reconstructed_slope
=
(
dpk_fh
[
cell_id
](
R3
{
0
,
0
,
0.1
}
+
xj
[
cell_id
])
-
dpk_fh
[
cell_id
](
xj
[
cell_id
]
-
R3
{
0
,
0
,
0.1
}))
/
0.2
;
(
dpk_fh
[
cell_id
](
R3
{
0
,
0
,
0.1
}
+
xj
[
cell_id
])
-
dpk_fh
[
cell_id
](
xj
[
cell_id
]
-
R3
{
0
,
0
,
0.1
}))
/
0.2
;
max_z_slope_error
=
std
::
max
(
max_z_slope_error
,
std
::
abs
(
reconstructed_slope
-
2.1
));
max_z_slope_error
=
std
::
max
(
max_z_slope_error
,
std
::
abs
(
reconstructed_slope
-
2.1
));
}
}
...
@@ -832,7 +841,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -832,7 +841,8 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
const
R2x2
reconstructed_slope
=
(
1
/
0.2
)
*
(
dpk_Ah
[
cell_id
](
R3
{
0.1
,
0
,
0
}
+
xj
[
cell_id
])
-
const
R2x2
reconstructed_slope
=
(
1
/
0.2
)
*
(
dpk_Ah
[
cell_id
](
R3
{
0.1
,
0
,
0
}
+
xj
[
cell_id
])
-
dpk_Ah
[
cell_id
](
xj
[
cell_id
]
-
R3
{
0.1
,
0
,
0
}));
dpk_Ah
[
cell_id
](
xj
[
cell_id
]
-
R3
{
0.1
,
0
,
0
}));
max_x_slope_error
=
std
::
max
(
max_x_slope_error
,
frobeniusNorm
(
reconstructed_slope
-
R2x2
{
+
1.7
,
2.1
,
//
max_x_slope_error
=
std
::
max
(
max_x_slope_error
,
frobeniusNorm
(
reconstructed_slope
-
R2x2
{
+
1.7
,
2.1
,
//
-
2.3
,
+
3.1
}));
-
2.3
,
+
3.1
}));
}
}
REQUIRE
(
parallel
::
allReduceMax
(
max_x_slope_error
)
==
Catch
::
Approx
(
0
).
margin
(
1E-13
));
REQUIRE
(
parallel
::
allReduceMax
(
max_x_slope_error
)
==
Catch
::
Approx
(
0
).
margin
(
1E-13
));
...
@@ -969,3 +979,5 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
...
@@ -969,3 +979,5 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
}
}
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment