10#include <gtest/gtest.h>
11#include <yaml-cpp/yaml.h>
19class SingleBoundaryTest :
public ::testing::Test
22 SingleBoundaryTest(){};
24 virtual ~SingleBoundaryTest(){};
33 config[
"mesh"].push_back(Node(NodeType::Map));
34 config[
"mesh"][0][
"direction"] =
"x";
35 config[
"mesh"][1][
"direction"] =
"y";
36 config[
"mesh"][2][
"direction"] =
"z";
37 for (
unsigned int i = 0; i < 3; ++i)
39 config[
"mesh"][i][
"start"] =
"0.1";
40 config[
"mesh"][i][
"subDomains"].push_back(Node(NodeType::Map));
41 config[
"mesh"][i][
"subDomains"][0][
"end"] = 1.1;
42 config[
"mesh"][i][
"subDomains"][0][
"cells"] = 10;
43 config[
"mesh"][i][
"subDomains"][0][
"stretchRatio"] = 1.0;
46 config[
"flow"] = YAML::Node(NodeType::Map);
47 config[
"flow"][
"boundaryConditions"].push_back(Node(NodeType::Map));
48 config[
"flow"][
"boundaryConditions"][0][
"location"] =
"xMinus";
49 config[
"flow"][
"boundaryConditions"][1][
"location"] =
"xPlus";
50 config[
"flow"][
"boundaryConditions"][2][
"location"] =
"yMinus";
51 config[
"flow"][
"boundaryConditions"][3][
"location"] =
"yPlus";
52 config[
"flow"][
"boundaryConditions"][4][
"location"] =
"zMinus";
53 config[
"flow"][
"boundaryConditions"][5][
"location"] =
"zPlus";
55 for (
unsigned int i = 0; i < 4; ++i)
57 config[
"flow"][
"boundaryConditions"][i][
"u"][0] =
"DIRICHLET";
58 config[
"flow"][
"boundaryConditions"][i][
"u"][1] = 0.0;
59 config[
"flow"][
"boundaryConditions"][i][
"v"][0] =
"DIRICHLET";
60 config[
"flow"][
"boundaryConditions"][i][
"v"][1] = 0.0;
61 config[
"flow"][
"boundaryConditions"][i][
"w"][0] =
"DIRICHLET";
62 config[
"flow"][
"boundaryConditions"][i][
"w"][1] = 0.0;
64 config[
"flow"][
"boundaryConditions"][3][
"u"][1] = 1.0;
66 for (
unsigned int i = 4; i < 6; ++i)
68 config[
"flow"][
"boundaryConditions"][i][
"u"][0] =
"PERIODIC";
69 config[
"flow"][
"boundaryConditions"][i][
"u"][1] = 0.0;
70 config[
"flow"][
"boundaryConditions"][i][
"v"][0] =
"PERIODIC";
71 config[
"flow"][
"boundaryConditions"][i][
"v"][1] = 0.0;
72 config[
"flow"][
"boundaryConditions"][i][
"w"][0] =
"PERIODIC";
73 config[
"flow"][
"boundaryConditions"][i][
"w"][1] = 0.0;
82 virtual void TearDown(){};
89 ASSERT_EQ(3, boundary->dim);
92 MPI_Comm_size(PETSC_COMM_WORLD, &size);
93 if (size == 1) ASSERT_EQ(PETSC_TRUE, boundary->onThisProc);
95 ASSERT_EQ(0.0, boundary->value);
99int main(
int argc,
char **argv)
101 PetscErrorCode ierr, status;
103 ::testing::InitGoogleTest(&argc, argv);
104 ierr = PetscInitialize(&argc, &argv,
nullptr,
nullptr); CHKERRQ(ierr);
105 status = RUN_ALL_TESTS();
106 ierr = PetscFinalize(); CHKERRQ(ierr);
std::shared_ptr< boundary::SingleBoundaryBase > SingleBoundary
Definition of type petibm::type::SingleBoundary.
PetscErrorCode createSingleBoundary(const type::Mesh &mesh, const type::BCLoc &loc, const type::Field &field, const PetscReal &value, const type::BCType &bcType, type::SingleBoundary &singleBd)
Factory function for creating a SingleBoundary object.
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
PetscErrorCode createMesh(const MPI_Comm &comm, const YAML::Node &node, type::Mesh &mesh)
Factory function for creating a Mesh object.
Prototype of mesh::MeshBase, type::Mesh, and factory function.
A toolbox for building flow solvers.
Prototypes of parser functions.
Definition of the class SingleBoundaryBase.
int main(int argc, char **argv)
TEST_F(SingleBoundaryTest, init)