10#include <gtest/gtest.h>
11#include <yaml-cpp/yaml.h>
17class CartesianMeshTest3D :
public ::testing::Test
20 CartesianMeshTest3D(){};
22 virtual ~CartesianMeshTest3D(){};
30 config[
"mesh"].push_back(Node(NodeType::Map));
31 config[
"mesh"][0][
"direction"] =
"x";
32 config[
"mesh"][1][
"direction"] =
"y";
33 config[
"mesh"][2][
"direction"] =
"z";
34 for (
unsigned int i = 0; i < 3; ++i)
36 config[
"mesh"][i][
"start"] =
"0.1";
37 config[
"mesh"][i][
"subDomains"].push_back(Node(NodeType::Map));
38 config[
"mesh"][i][
"subDomains"][0][
"end"] = 1.1;
39 config[
"mesh"][i][
"subDomains"][0][
"cells"] = 10;
40 config[
"mesh"][i][
"subDomains"][0][
"stretchRatio"] = 1.0;
43 config[
"flow"] = YAML::Node(NodeType::Map);
44 config[
"flow"][
"boundaryConditions"].push_back(Node(NodeType::Map));
45 config[
"flow"][
"boundaryConditions"][0][
"location"] =
"xMinus";
46 config[
"flow"][
"boundaryConditions"][1][
"location"] =
"xPlus";
47 config[
"flow"][
"boundaryConditions"][2][
"location"] =
"yMinus";
48 config[
"flow"][
"boundaryConditions"][3][
"location"] =
"yPlus";
49 config[
"flow"][
"boundaryConditions"][4][
"location"] =
"zMinus";
50 config[
"flow"][
"boundaryConditions"][5][
"location"] =
"zPlus";
52 for (
unsigned int i = 0; i < 4; ++i)
54 config[
"flow"][
"boundaryConditions"][i][
"u"][0] =
"DIRICHLET";
55 config[
"flow"][
"boundaryConditions"][i][
"u"][1] = 0.0;
56 config[
"flow"][
"boundaryConditions"][i][
"v"][0] =
"DIRICHLET";
57 config[
"flow"][
"boundaryConditions"][i][
"v"][1] = 0.0;
58 config[
"flow"][
"boundaryConditions"][i][
"w"][0] =
"DIRICHLET";
59 config[
"flow"][
"boundaryConditions"][i][
"w"][1] = 0.0;
61 config[
"flow"][
"boundaryConditions"][3][
"u"][1] = 1.0;
63 for (
unsigned int i = 4; i < 6; ++i)
65 config[
"flow"][
"boundaryConditions"][i][
"u"][0] =
"PERIODIC";
66 config[
"flow"][
"boundaryConditions"][i][
"u"][1] = 0.0;
67 config[
"flow"][
"boundaryConditions"][i][
"v"][0] =
"PERIODIC";
68 config[
"flow"][
"boundaryConditions"][i][
"v"][1] = 0.0;
69 config[
"flow"][
"boundaryConditions"][i][
"w"][0] =
"PERIODIC";
70 config[
"flow"][
"boundaryConditions"][i][
"w"][1] = 0.0;
76 virtual void TearDown(){};
84 ASSERT_EQ(3, mesh->dim);
86 for (
unsigned int d = 0; d < 3; d++)
88 ASSERT_EQ(0.1, mesh->min[d]);
89 ASSERT_EQ(1.1, mesh->max[d]);
92 std::vector<PetscReal> n_exp(3);
95 for (
unsigned int d = 0; d < 3; d++) ASSERT_EQ(n_exp[d], mesh->n[0][d]);
98 for (
unsigned int d = 0; d < 3; d++) ASSERT_EQ(n_exp[d], mesh->n[1][d]);
100 n_exp = {10, 10, 10};
101 for (
unsigned int d = 0; d < 3; d++) ASSERT_EQ(n_exp[d], mesh->n[2][d]);
103 n_exp = {10, 10, 10};
104 for (
unsigned int d = 0; d < 3; d++) ASSERT_EQ(n_exp[d], mesh->n[3][d]);
106 n_exp = {11, 11, 11};
107 for (
unsigned int d = 0; d < 3; d++) ASSERT_EQ(n_exp[d], mesh->n[4][d]);
TEST_F(CartesianMeshTest3D, init3D)
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.