Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VirtualFluids
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iRMB
VirtualFluids
Commits
777ece1c
Commit
777ece1c
authored
4 years ago
by
peters
Committed by
Soeren Peters
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add more basic chimera tests.
parent
2e78e0d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!34
Add new library, which contains the calculation of the macroscopic quantities and a general cumulant computation. (Closes #13)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lbm/ChimeraTests.cpp
+105
-3
105 additions, 3 deletions
src/lbm/ChimeraTests.cpp
src/lbm/MacroscopicQuantitiesTests.cpp
+1
-1
1 addition, 1 deletion
src/lbm/MacroscopicQuantitiesTests.cpp
with
106 additions
and
4 deletions
src/lbm/ChimeraTests.cpp
+
105
−
3
View file @
777ece1c
#include
<gmock/gmock.h>
#include
"Chimera.h"
#include
"D3Q27.h"
/*
* InverseChimeraWithK
*/
TEST
(
ChimeraTest
,
forwardInverseChimeraWithK
)
{
real
mfa
=
1
;
...
...
@@ -23,3 +23,105 @@ TEST(ChimeraTest, forwardInverseChimeraWithK)
EXPECT_THAT
(
mfb
,
testing
::
DoubleEq
(
-
4.
));
// -(mfa + mfb + mfc + 1)
EXPECT_THAT
(
mfc
,
testing
::
DoubleEq
(
6.
));
// (mfa + mfc) + (mfa + mfb + mfc + 1)
}
TEST
(
ChimeraTest
,
backwardInverseChimeraWithK
)
{
// starting with the result values from the test above.
real
mfa
=
3.
;
real
mfb
=
-
4.
;
real
mfc
=
6.
;
const
real
vv
=
1.
;
const
real
v2
=
1.
;
const
real
K
=
1.
;
const
real
Kinverse
=
1
/
K
;
VF
::
LBM
::
backwardInverseChimeraWithK
(
mfa
,
mfb
,
mfc
,
vv
,
v2
,
K
,
Kinverse
);
// resulting in the start values from the test above.
EXPECT_THAT
(
mfa
,
testing
::
DoubleEq
(
1.
));
EXPECT_THAT
(
mfb
,
testing
::
DoubleEq
(
1.
));
EXPECT_THAT
(
mfc
,
testing
::
DoubleEq
(
1.
));
}
/*
* Chimera
*/
TEST
(
ChimeraTest
,
forwardChimera
)
{
real
mfa
=
1
;
real
mfb
=
1
;
real
mfc
=
1
;
const
real
vv
=
1.
;
const
real
v2
=
1.
;
VF
::
LBM
::
forwardChimera
(
mfa
,
mfb
,
mfc
,
vv
,
v2
);
EXPECT_THAT
(
mfa
,
testing
::
DoubleEq
(
3.
));
// mfa + mfb + mfc
EXPECT_THAT
(
mfb
,
testing
::
DoubleEq
(
-
3.
));
// -(mfa + mfb + mfc)
EXPECT_THAT
(
mfc
,
testing
::
DoubleEq
(
5.
));
// (mfa + mfc) + (mfa + mfb + mfc)
}
TEST
(
ChimeraTest
,
backwardChimera
)
{
// starting with the result values from the test above.
real
mfa
=
3.
;
real
mfb
=
-
3.
;
real
mfc
=
5.
;
const
real
vv
=
1.
;
const
real
v2
=
1.
;
VF
::
LBM
::
backwardChimera
(
mfa
,
mfb
,
mfc
,
vv
,
v2
);
// resulting in the start values from the test above.
EXPECT_THAT
(
mfa
,
testing
::
DoubleEq
(
1.
));
EXPECT_THAT
(
mfb
,
testing
::
DoubleEq
(
1.
));
EXPECT_THAT
(
mfc
,
testing
::
DoubleEq
(
1.
));
}
/*
* ChimeraWithK
*/
TEST
(
ChimeraTest
,
forwardChimeraWithK
)
{
real
mfa
=
1
;
real
mfb
=
1
;
real
mfc
=
1
;
const
real
vv
=
1.
;
const
real
v2
=
1.
;
const
real
K
=
1.
;
VF
::
LBM
::
forwardChimeraWithK
(
mfa
,
mfb
,
mfc
,
vv
,
v2
,
K
);
EXPECT_THAT
(
mfa
,
testing
::
DoubleEq
(
3.
));
// mfa + mfb + mfc
EXPECT_THAT
(
mfb
,
testing
::
DoubleEq
(
-
4.
));
// -(mfa + mfb + mfc)
EXPECT_THAT
(
mfc
,
testing
::
DoubleEq
(
6.
));
// (mfa + mfc) + (mfa + mfb + mfc)
}
TEST
(
ChimeraTest
,
backwardChimeraWithK
)
{
// starting with the result values from the test above.
real
mfa
=
3.
;
real
mfb
=
-
4.
;
real
mfc
=
6.
;
const
real
vv
=
1.
;
const
real
v2
=
1.
;
const
real
K
=
1.
;
VF
::
LBM
::
backwardChimeraWithK
(
mfa
,
mfb
,
mfc
,
vv
,
v2
,
K
);
// resulting in the start values from the test above.
EXPECT_THAT
(
mfa
,
testing
::
DoubleEq
(
1.
));
EXPECT_THAT
(
mfb
,
testing
::
DoubleEq
(
1.
));
EXPECT_THAT
(
mfc
,
testing
::
DoubleEq
(
1.
));
}
This diff is collapsed.
Click to expand it.
src/lbm/MacroscopicQuantitiesTests.cpp
+
1
−
1
View file @
777ece1c
...
...
@@ -31,7 +31,7 @@ TEST(MacroscopicQuantitiesTest, whenFsAreEqual_velocityInEachDirectionShouldBeZe
EXPECT_THAT
(
velocityX3
,
testing
::
DoubleEq
(
expected_velocity
));
}
TEST
(
MacroscopicQuantitiesTest
,
givenAllFsAreOne_when_Eis2_velocityInXShouldBeOne
)
TEST
(
MacroscopicQuantitiesTest
,
givenAllFsAreOne_when_Eis2_velocityInX
1
ShouldBeOne
)
{
f
[
VF
::
LBM
::
DIR
::
E
]
=
2.
;
...
...
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