Definition at line 416 of file systems_test.C.
◆ CPPUNIT_TEST() [1/14]
◆ CPPUNIT_TEST() [2/14]
◆ CPPUNIT_TEST() [3/14]
◆ CPPUNIT_TEST() [4/14]
◆ CPPUNIT_TEST() [5/14]
◆ CPPUNIT_TEST() [6/14]
◆ CPPUNIT_TEST() [7/14]
◆ CPPUNIT_TEST() [8/14]
◆ CPPUNIT_TEST() [9/14]
◆ CPPUNIT_TEST() [10/14]
◆ CPPUNIT_TEST() [11/14]
◆ CPPUNIT_TEST() [12/14]
◆ CPPUNIT_TEST() [13/14]
◆ CPPUNIT_TEST() [14/14]
◆ CPPUNIT_TEST_SUITE()
◆ CPPUNIT_TEST_SUITE_END()
SystemsTest::CPPUNIT_TEST_SUITE_END |
( |
| ) |
|
◆ setUp()
void SystemsTest::setUp |
( |
| ) |
|
|
inline |
◆ tearDown()
void SystemsTest::tearDown |
( |
| ) |
|
|
inline |
◆ testAssemblyWithDgFemContext()
void SystemsTest::testAssemblyWithDgFemContext |
( |
| ) |
|
|
inline |
Definition at line 956 of file systems_test.C.
969 0., 1., 0., 1., 0., 1.,
References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), assembly_with_dg_fem_context(), libMesh::System::attach_assemble_function(), libMesh::MeshTools::Generation::build_cube(), libMesh::FIRST, libMesh::HEX8, libMesh::EquationSystems::init(), libMesh::L2_LAGRANGE, mesh, libMesh::System::solve(), and TestCommWorld.
◆ testBlockRestrictedVarNDofs()
void SystemsTest::testBlockRestrictedVarNDofs |
( |
| ) |
|
|
inline |
Definition at line 980 of file systems_test.C.
996 for (; el != el_end; ++el)
997 if ((*el)->centroid()(0) <= 0.5 && (*el)->centroid()(1) <= 0.5)
998 (*el)->subdomain_id() = 0;
1000 (*el)->subdomain_id() = 1;
1009 std::set<subdomain_id_type> block0;
1010 std::set<subdomain_id_type> block1;
1015 equation_systems.init();
1017 std::vector<dof_id_type> u0_dofs;
1019 std::vector<dof_id_type> u1_dofs;
1022 std::set<dof_id_type> sys_u0_dofs;
1024 std::set<dof_id_type> sys_u1_dofs;
1030 mesh.
comm().set_union(sys_u0_dofs);
1031 mesh.
comm().set_union(sys_u1_dofs);
1033 const std::size_t c9 = 9;
1034 const std::size_t c21 = 21;
1035 CPPUNIT_ASSERT_EQUAL(c9, u0_dofs.size());
1036 CPPUNIT_ASSERT_EQUAL(c21, u1_dofs.size());
1037 CPPUNIT_ASSERT_EQUAL(c9, sys_u0_dofs.size());
1038 CPPUNIT_ASSERT_EQUAL(c21, sys_u1_dofs.size());
References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshTools::Generation::build_cube(), libMesh::ParallelObject::comm(), libMesh::MeshBase::elements_begin(), libMesh::MeshBase::elements_end(), libMesh::FIRST, libMesh::System::get_dof_map(), libMesh::EquationSystems::init(), libMesh::System::local_dof_indices(), libMesh::DofMap::local_variable_indices(), mesh, libMesh::MeshBase::prepare_for_use(), libMesh::QUAD4, and TestCommWorld.
◆ testBoundaryProjectCube()
void SystemsTest::testBoundaryProjectCube |
( |
| ) |
|
|
inline |
Definition at line 745 of file systems_test.C.
765 0., 1., 0., 1., 0., 1.,
769 std::set<dof_id_type> projected_nodes_set;
773 for (
auto side : elem->side_index_range())
775 std::vector<boundary_id_type> vec_to_fill;
778 auto vec_it = std::find(vec_to_fill.begin(), vec_to_fill.end(), SIDE_BOUNDARY_ID);
779 if (vec_it != vec_to_fill.end())
781 for (
unsigned int node_index=0; node_index<elem->n_nodes(); node_index++)
783 if( elem->is_node_on_side(node_index, side))
785 projected_nodes_set.insert(elem->node_id(node_index));
796 side_max_x = 0, side_min_y = 0,
797 side_max_y = 0, side_max_z = 0;
800 found_side_max_x =
false, found_side_max_y =
false,
801 found_side_min_y =
false, found_side_max_z =
false;
803 for (
auto side : elem->side_index_range())
808 found_side_max_x =
true;
814 found_side_min_y =
true;
820 found_side_max_y =
true;
826 found_side_max_z =
true;
833 if (found_side_max_x && found_side_max_y && found_side_max_z)
834 for (
auto n : elem->node_index_range())
835 if (elem->is_node_on_side(n, side_max_x) &&
836 elem->is_node_on_side(n, side_max_y) &&
837 elem->is_node_on_side(n, side_max_z))
839 projected_nodes_set.insert(elem->node_id(n));
846 if (found_side_max_x && found_side_min_y)
847 for (
auto e : elem->edge_index_range())
848 if (elem->is_edge_on_side(e, side_max_x) &&
849 elem->is_edge_on_side(e, side_min_y))
853 for (
unsigned int node_index=0; node_index<elem->n_nodes(); node_index++)
855 if (elem->is_node_on_edge(node_index, e))
857 projected_nodes_set.insert(elem->node_id(node_index));
867 std::set<boundary_id_type> boundary_ids;
868 boundary_ids.insert(NODE_BOUNDARY_ID);
869 boundary_ids.insert(EDGE_BOUNDARY_ID);
870 boundary_ids.insert(SIDE_BOUNDARY_ID);
871 std::vector<unsigned int> variables;
872 variables.push_back(u_var);
883 Real ref_l1_norm = static_cast<Real>(
mesh.
n_nodes()) - static_cast<Real>(projected_nodes_set.size());
References libMesh::BoundaryInfo::add_edge(), libMesh::BoundaryInfo::add_node(), libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::BoundaryInfo::boundary_ids(), libMesh::System::boundary_project_solution(), libMesh::MeshTools::Generation::build_cube(), libMesh::MeshBase::element_ptr_range(), libMesh::FIRST, libMesh::MeshBase::get_boundary_info(), libMesh::BoundaryInfo::has_boundary_id(), libMesh::HEX8, libMesh::EquationSystems::init(), libMesh::LAGRANGE, mesh, libMesh::MeshBase::n_nodes(), libMesh::Real, libMesh::System::solution, TestCommWorld, and libMesh::TOLERANCE.
◆ testDofCouplingWithVarGroups()
void SystemsTest::testDofCouplingWithVarGroups |
( |
| ) |
|
|
inline |
Definition at line 888 of file systems_test.C.
901 Point new_point_a(2.);
902 Point new_point_b(3.);
906 new_edge_elem->
set_node(0) = new_node_a;
907 new_edge_elem->
set_node(1) = new_node_b;
916 node_elem_2->
set_node(0) = new_node_a;
929 std::set<subdomain_id_type> theta_subdomains;
930 theta_subdomains.insert(10);
945 equation_systems.init ();
References libMesh::DofMap::add_coupling_functor(), libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), assemble_matrix_and_rhs(), libMesh::System::attach_assemble_function(), libMesh::MeshTools::Generation::build_cube(), libMesh::EDGE2, libMesh::MeshBase::elem_ref(), libMesh::FIRST, libMesh::System::get_dof_map(), libMesh::LinearImplicitSystem::get_linear_solver(), libMesh::IDENTITY_PRECOND, libMesh::EquationSystems::init(), libMesh::JACOBI, mesh, libMesh::MeshBase::n_nodes(), libMesh::System::n_vars(), libMesh::Elem::node_ptr(), libMesh::MeshBase::prepare_for_use(), libMesh::Real, libMesh::Elem::set_node(), libMesh::LinearSolver< T >::set_preconditioner_type(), libMesh::LinearSolver< T >::set_solver_type(), libMesh::System::solution, libMesh::LinearImplicitSystem::solve(), libMesh::Elem::subdomain_id(), TestCommWorld, and libMesh::TOLERANCE.
◆ testProjectCube()
void SystemsTest::testProjectCube |
( |
const ElemType |
elem_type | ) |
|
|
inline |
Definition at line 626 of file systems_test.C.
634 std::set<subdomain_id_type> u_subdomains {0, 1, 4, 5},
635 v_subdomains {1, 2, 3, 4},
636 w_subdomains {0, 1, 2, 3, 4};
644 0., 1., 0., 1., 0., 1.,
648 elem->subdomain_id() = elem->id()/6;
652 sys.project_solution(&tfunc);
659 locator->enable_out_of_mesh_mode();
660 for (
Real x = 0.1; x < 1; x += 0.2)
661 for (
Real y = 0.1; y < 1; y += 0.2)
662 for (
Real z = 0.1; z < 1; z += 0.2)
664 u_subdomains, v_subdomains, w_subdomains,
667 #ifdef LIBMESH_ENABLE_AMR
669 if ((elem->id()/2)%2)
670 elem->set_refinement_flag(Elem::REFINE);
674 locator->enable_out_of_mesh_mode();
675 for (
Real x = 0.1; x < 1; x += 0.2)
676 for (
Real y = 0.1; y < 1; y += 0.2)
677 for (
Real z = 0.1; z < 1; z += 0.2)
679 u_subdomains, v_subdomains, w_subdomains,
References libMesh::EquationSystems::add_system(), libMesh::MeshTools::Generation::build_cube(), libMesh::CONSTANT, libMesh::MeshBase::element_ptr_range(), libMesh::FIRST, libMesh::HIERARCHIC, libMesh::EquationSystems::init(), libMesh::LAGRANGE, mesh, libMesh::MONOMIAL, TripleFunction::offset, libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, libMesh::EquationSystems::parameters, libMesh::Real, libMesh::Elem::REFINE, libMesh::EquationSystems::reinit(), libMesh::MeshBase::sub_point_locator(), TestCommWorld, and libMesh::THIRD.
◆ testProjectCubeWithMeshFunction()
void SystemsTest::testProjectCubeWithMeshFunction |
( |
const ElemType |
elem_type | ) |
|
|
inline |
Definition at line 684 of file systems_test.C.
696 0., 1., 0., 1., 0., 1.,
702 std::vector<unsigned int> variables;
704 std::sort(variables.begin(),variables.end());
706 std::unique_ptr< NumericVector<Number> > mesh_function_vector =
709 sys.
solution->localize( *mesh_function_vector );
712 *mesh_function_vector,
715 mesh_function.
init();
721 System &proj_sys = proj_es.add_system<
System> (
"ProjectionSystem");
728 0., 1., 0., 1., 0., 1.,
734 for (
Real x = 0.1; x < 1; x += 0.2)
735 for (
Real y = 0.1; y < 1; y += 0.2)
736 for (
Real z = 0.1; z < 1; z += 0.2)
References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::NumericVector< T >::build(), libMesh::MeshTools::Generation::build_cube(), libMesh::ParallelObject::comm(), cubic_test(), libMesh::System::get_all_variable_numbers(), libMesh::System::get_dof_map(), libMesh::HIERARCHIC, libMesh::MeshFunction::init(), libMesh::EquationSystems::init(), libMesh::libmesh_real(), mesh, libMesh::MONOMIAL, libMesh::System::n_dofs(), libMesh::EquationSystems::parameters, libMesh::System::point_value(), libMesh::System::project_solution(), libMesh::Real, libMesh::SERIAL, libMesh::System::solution, TestCommWorld, libMesh::THIRD, and libMesh::TOLERANCE.
◆ testProjectHierarchicEdge3()
void SystemsTest::testProjectHierarchicEdge3 |
( |
| ) |
|
|
inline |
◆ testProjectHierarchicHex27()
void SystemsTest::testProjectHierarchicHex27 |
( |
| ) |
|
|
inline |
◆ testProjectHierarchicQuad9()
void SystemsTest::testProjectHierarchicQuad9 |
( |
| ) |
|
|
inline |
◆ testProjectHierarchicTri6()
void SystemsTest::testProjectHierarchicTri6 |
( |
| ) |
|
|
inline |
◆ testProjectLine()
void SystemsTest::testProjectLine |
( |
const ElemType |
elem_type | ) |
|
|
inline |
Definition at line 516 of file systems_test.C.
524 std::set<subdomain_id_type> u_subdomains {0, 1, 4, 5},
525 v_subdomains {1, 2, 3, 4},
526 w_subdomains {0, 1, 2, 3, 4};
538 elem->subdomain_id() = elem->id();
542 sys.project_solution(&tfunc);
549 locator->enable_out_of_mesh_mode();
550 for (
Real x = 0.1; x < 1; x += 0.2)
552 u_subdomains, v_subdomains, w_subdomains,
555 #ifdef LIBMESH_ENABLE_AMR
557 if ((elem->id()/2)%2)
558 elem->set_refinement_flag(Elem::REFINE);
562 locator->enable_out_of_mesh_mode();
563 for (
Real x = 0.1; x < 1; x += 0.2)
565 u_subdomains, v_subdomains, w_subdomains,
References libMesh::EquationSystems::add_system(), libMesh::MeshTools::Generation::build_line(), libMesh::CONSTANT, libMesh::MeshBase::element_ptr_range(), libMesh::FIRST, libMesh::HIERARCHIC, libMesh::EquationSystems::init(), libMesh::LAGRANGE, mesh, libMesh::MONOMIAL, TripleFunction::offset, libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, libMesh::EquationSystems::parameters, libMesh::Real, libMesh::Elem::REFINE, libMesh::EquationSystems::reinit(), libMesh::MeshBase::sub_point_locator(), TestCommWorld, and libMesh::THIRD.
◆ testProjectMatrix1D()
void SystemsTest::testProjectMatrix1D |
( |
const ElemType |
elem_type | ) |
|
|
inline |
Definition at line 1044 of file systems_test.C.
1065 std::set<dof_id_type> coarse_nodes({0,1,2,3,4});
1066 std::vector<dof_id_type> node_order_f({0,5,1,6,2,7,3,8,4});
1069 int n_old_dofs = sys.
n_dofs();
1072 std::map <dof_id_type, dof_id_type> node2dof_c;
1076 node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1081 mr.uniformly_refine(1);
1085 std::map <dof_id_type, dof_id_type> node2dof_f;
1089 node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1093 int n_new_dofs = sys.
n_dofs();
1097 int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1100 std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1103 proj_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1108 std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1111 gold_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1117 dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1119 if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1123 auto cdof_id = node2dof_c.find(node_id);
1124 gold_mat.
set(fdof_id, cdof_id->second, 1.0);
1131 auto node_loc = std::find(node_order_f.begin(), node_order_f.end(), node_id);
1134 auto dof_p = node2dof_c.find(node_p);
1135 auto dof_n = node2dof_c.find(node_n);
1137 gold_mat.
set(fdof_id, dof_p->second, 0.5);
1138 gold_mat.
set(fdof_id, dof_n->second, 0.5);
1146 gold_mat.
add(-1.0, proj_mat);
References libMesh::SparseMatrix< T >::add(), libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::allow_renumbering(), libMesh::SparseMatrix< T >::build(), libMesh::MeshTools::Generation::build_line(), libMesh::SparseMatrix< T >::close(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::end_old_dof(), libMesh::FIRST, libMesh::DofMap::first_old_dof(), libMesh::System::get_dof_map(), libMesh::EquationSystems::init(), libMesh::SparseMatrix< T >::init(), libMesh::LAGRANGE, libMesh::SparseMatrix< T >::linfty_norm(), libMesh::MeshBase::local_node_ptr_range(), mesh, libMesh::System::n_dofs(), libMesh::DofMap::n_dofs_on_processor(), libMesh::MeshTools::Subdivision::next, libMesh::MeshBase::node_ptr_range(), libMesh::MeshTools::Subdivision::prev, libMesh::ParallelObject::processor_id(), libMesh::System::projection_matrix(), libMesh::Real, libMesh::SparseMatrix< T >::row_start(), libMesh::SparseMatrix< T >::row_stop(), libMesh::SparseMatrix< T >::set(), TestCommWorld, libMesh::TOLERANCE, and libMesh::MeshRefinement::uniformly_refine().
◆ testProjectMatrix2D()
void SystemsTest::testProjectMatrix2D |
( |
const ElemType |
elem_type | ) |
|
|
inline |
Definition at line 1151 of file systems_test.C.
1165 if (elem_type == Utility::string_to_enum<ElemType>(
"QUAD4"))
1170 else if (elem_type == Utility::string_to_enum<ElemType>(
"TRI3"))
1179 std::set<dof_id_type> coarse_nodes;
1180 std::map<dof_id_type, std::vector<dof_id_type>> side_nbr_nodes;
1181 std::map<dof_id_type, std::vector<dof_id_type>> int_nbr_nodes;
1184 if (elem_type == Utility::string_to_enum<ElemType>(
"QUAD4"))
1186 coarse_nodes.insert({0,1,2,3,4,5,6,7,8});
1188 side_nbr_nodes.insert({9, {0,1}});
1189 side_nbr_nodes.insert({14, {1,2}});
1190 side_nbr_nodes.insert({11, {0,3}});
1191 side_nbr_nodes.insert({12, {1,4}});
1192 side_nbr_nodes.insert({16, {2,5}});
1193 side_nbr_nodes.insert({13, {3,4}});
1194 side_nbr_nodes.insert({17, {4,5}});
1195 side_nbr_nodes.insert({19, {3,6}});
1196 side_nbr_nodes.insert({20, {4,7}});
1197 side_nbr_nodes.insert({23, {5,8}});
1198 side_nbr_nodes.insert({21, {6,7}});
1199 side_nbr_nodes.insert({24, {7,8}});
1201 int_nbr_nodes.insert({10, {0,1,3,4}});
1202 int_nbr_nodes.insert({15, {1,2,4,5}});
1203 int_nbr_nodes.insert({18, {3,4,6,7}});
1204 int_nbr_nodes.insert({22, {4,5,7,8}});
1206 else if (elem_type == Utility::string_to_enum<ElemType>(
"TRI3"))
1208 coarse_nodes.insert({0,1,2,3});
1210 side_nbr_nodes.insert({4, {0,1}});
1211 side_nbr_nodes.insert({5, {0,3}});
1212 side_nbr_nodes.insert({6, {1,3}});
1213 side_nbr_nodes.insert({7, {0,2}});
1214 side_nbr_nodes.insert({8, {2,3}});
1218 int n_old_dofs = sys.
n_dofs();
1221 std::map <dof_id_type, dof_id_type> node2dof_c;
1225 node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1230 mr.uniformly_refine(1);
1234 std::map <dof_id_type, dof_id_type> node2dof_f;
1238 node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1242 int n_new_dofs = sys.
n_dofs();
1246 int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1249 std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1252 proj_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1257 std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1260 gold_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1266 dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1268 if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1272 auto cdof_id = node2dof_c.find(node_id);
1273 gold_mat.
set(fdof_id, cdof_id->second, 1.0);
1276 else if ( side_nbr_nodes.find(node_id) != side_nbr_nodes.end() )
1280 auto node_nbrs = side_nbr_nodes.find(node_id);
1281 for (
auto nbr : node_nbrs->second)
1283 auto nbr_dof = node2dof_c.find(nbr);
1284 gold_mat.
set(fdof_id, nbr_dof->second, 0.5);
1292 auto node_nbrs = int_nbr_nodes.find(node_id);
1293 for (
auto nbr : node_nbrs->second)
1295 auto nbr_dof = node2dof_c.find(nbr);
1296 gold_mat.
set(fdof_id, nbr_dof->second, 0.25);
1305 proj_mat.
add(-1.0, gold_mat);
References libMesh::SparseMatrix< T >::add(), libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::allow_renumbering(), libMesh::SparseMatrix< T >::build(), libMesh::MeshTools::Generation::build_square(), libMesh::SparseMatrix< T >::close(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::end_old_dof(), libMesh::FIRST, libMesh::DofMap::first_old_dof(), libMesh::System::get_dof_map(), libMesh::EquationSystems::init(), libMesh::SparseMatrix< T >::init(), libMesh::LAGRANGE, libMesh::SparseMatrix< T >::linfty_norm(), libMesh::MeshBase::local_node_ptr_range(), mesh, libMesh::System::n_dofs(), libMesh::DofMap::n_dofs_on_processor(), libMesh::MeshBase::node_ptr_range(), libMesh::ParallelObject::processor_id(), libMesh::System::projection_matrix(), libMesh::Real, libMesh::SparseMatrix< T >::row_start(), libMesh::SparseMatrix< T >::row_stop(), libMesh::SparseMatrix< T >::set(), TestCommWorld, libMesh::TOLERANCE, and libMesh::MeshRefinement::uniformly_refine().
◆ testProjectMatrix3D()
void SystemsTest::testProjectMatrix3D |
( |
const ElemType |
elem_type | ) |
|
|
inline |
Definition at line 1310 of file systems_test.C.
1324 if (elem_type == Utility::string_to_enum<ElemType>(
"HEX8"))
1327 0., 1., 0., 1., 0., 1.,
1329 else if (elem_type == Utility::string_to_enum<ElemType>(
"TET4"))
1350 std::set<dof_id_type> coarse_nodes;
1351 std::map<dof_id_type, std::vector<dof_id_type>> side_nbr_nodes;
1352 std::map<dof_id_type, std::vector<dof_id_type>> face_nbr_nodes;
1353 std::map<dof_id_type, std::vector<dof_id_type>> int_nbr_nodes;
1355 if (elem_type == Utility::string_to_enum<ElemType>(
"HEX8"))
1357 coarse_nodes.insert({0,1,2,3,4,5,6,7});
1360 side_nbr_nodes.insert({8, {0,1}});
1361 side_nbr_nodes.insert({10, {0,2}});
1362 side_nbr_nodes.insert({15, {1,3}});
1363 side_nbr_nodes.insert({18, {2,3}});
1364 side_nbr_nodes.insert({11, {0,4}});
1365 side_nbr_nodes.insert({16, {1,5}});
1366 side_nbr_nodes.insert({21, {3,7}});
1367 side_nbr_nodes.insert({20, {2,6}});
1368 side_nbr_nodes.insert({22, {4,5}});
1369 side_nbr_nodes.insert({24, {4,6}});
1370 side_nbr_nodes.insert({25, {5,7}});
1371 side_nbr_nodes.insert({26, {6,7}});
1373 face_nbr_nodes.insert({12, {0,1,4,5}});
1374 face_nbr_nodes.insert({9 , {0,1,2,3}});
1375 face_nbr_nodes.insert({14, {0,2,4,6}});
1376 face_nbr_nodes.insert({17, {1,3,5,7}});
1377 face_nbr_nodes.insert({19, {2,3,6,7}});
1378 face_nbr_nodes.insert({23, {4,5,6,7}});
1380 int_nbr_nodes.insert({13, {0,1,2,3,4,5,6,7}});
1382 else if (elem_type == Utility::string_to_enum<ElemType>(
"TET4"))
1384 coarse_nodes.insert({0,1,2,3});
1387 side_nbr_nodes.insert({4, {0,1}});
1388 side_nbr_nodes.insert({5, {0,2}});
1389 side_nbr_nodes.insert({6, {0,3}});
1390 side_nbr_nodes.insert({7, {1,2}});
1391 side_nbr_nodes.insert({8, {1,3}});
1392 side_nbr_nodes.insert({9, {2,3}});
1396 int n_old_dofs = sys.
n_dofs();
1399 std::map <dof_id_type, dof_id_type> node2dof_c;
1403 node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1408 mr.uniformly_refine(1);
1412 std::map <dof_id_type, dof_id_type> node2dof_f;
1416 node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1420 int n_new_dofs = sys.
n_dofs();
1424 int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1427 std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1430 proj_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1435 std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1438 gold_mat.
init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1444 dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1446 if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1450 auto cdof_id = node2dof_c.find(node_id);
1451 gold_mat.
set(fdof_id, cdof_id->second, 1.0);
1454 else if ( side_nbr_nodes.find(node_id) != side_nbr_nodes.end() )
1458 auto node_nbrs = side_nbr_nodes.find(node_id);
1459 for (
auto nbr : node_nbrs->second)
1461 auto nbr_dof = node2dof_c.find(nbr);
1462 gold_mat.
set(fdof_id, nbr_dof->second, 0.5);
1466 else if ( face_nbr_nodes.find(node_id) != face_nbr_nodes.end() )
1470 auto node_nbrs = face_nbr_nodes.find(node_id);
1471 for (
auto nbr : node_nbrs->second)
1473 auto nbr_dof = node2dof_c.find(nbr);
1474 gold_mat.
set(fdof_id, nbr_dof->second, 0.25);
1482 auto node_nbrs = int_nbr_nodes.find(node_id);
1483 for (
auto nbr : node_nbrs->second)
1485 auto nbr_dof = node2dof_c.find(nbr);
1486 gold_mat.
set(fdof_id, nbr_dof->second, 0.125);
1495 proj_mat.
add(-1.0, gold_mat);
References libMesh::SparseMatrix< T >::add(), libMesh::MeshBase::add_elem(), libMesh::MeshBase::add_point(), libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::allow_renumbering(), libMesh::SparseMatrix< T >::build(), libMesh::MeshTools::Generation::build_cube(), libMesh::SparseMatrix< T >::close(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::end_old_dof(), libMesh::FIRST, libMesh::DofMap::first_old_dof(), libMesh::System::get_dof_map(), libMesh::EquationSystems::init(), libMesh::SparseMatrix< T >::init(), libMesh::LAGRANGE, libMesh::SparseMatrix< T >::linfty_norm(), libMesh::MeshBase::local_node_ptr_range(), mesh, libMesh::System::n_dofs(), libMesh::DofMap::n_dofs_on_processor(), libMesh::MeshBase::node_ptr(), libMesh::MeshBase::node_ptr_range(), libMesh::MeshBase::prepare_for_use(), libMesh::ParallelObject::processor_id(), libMesh::System::projection_matrix(), libMesh::Real, libMesh::SparseMatrix< T >::row_start(), libMesh::SparseMatrix< T >::row_stop(), libMesh::SparseMatrix< T >::set(), libMesh::DofObject::set_id(), libMesh::Elem::set_node(), TestCommWorld, libMesh::TOLERANCE, and libMesh::MeshRefinement::uniformly_refine().
◆ testProjectMatrixEdge2()
void SystemsTest::testProjectMatrixEdge2 |
( |
| ) |
|
|
inline |
◆ testProjectMatrixHex8()
void SystemsTest::testProjectMatrixHex8 |
( |
| ) |
|
|
inline |
◆ testProjectMatrixQuad4()
void SystemsTest::testProjectMatrixQuad4 |
( |
| ) |
|
|
inline |
◆ testProjectMatrixTet4()
void SystemsTest::testProjectMatrixTet4 |
( |
| ) |
|
|
inline |
◆ testProjectMatrixTri3()
void SystemsTest::testProjectMatrixTri3 |
( |
| ) |
|
|
inline |
◆ testProjectMeshFunctionHex27()
void SystemsTest::testProjectMeshFunctionHex27 |
( |
| ) |
|
|
inline |
◆ testProjectSquare()
void SystemsTest::testProjectSquare |
( |
const ElemType |
elem_type | ) |
|
|
inline |
Definition at line 570 of file systems_test.C.
578 std::set<subdomain_id_type> u_subdomains {0, 1, 4, 5},
579 v_subdomains {1, 2, 3, 4},
580 w_subdomains {0, 1, 2, 3, 4};
592 elem->subdomain_id() = elem->id()/2;
596 sys.project_solution(&tfunc);
603 locator->enable_out_of_mesh_mode();
604 for (
Real x = 0.1; x < 1; x += 0.2)
605 for (
Real y = 0.1; y < 1; y += 0.2)
607 u_subdomains, v_subdomains, w_subdomains,
610 #ifdef LIBMESH_ENABLE_AMR
612 if ((elem->id()/2)%2)
613 elem->set_refinement_flag(Elem::REFINE);
617 locator->enable_out_of_mesh_mode();
618 for (
Real x = 0.1; x < 1; x += 0.2)
619 for (
Real y = 0.1; y < 1; y += 0.2)
621 u_subdomains, v_subdomains, w_subdomains,
References libMesh::EquationSystems::add_system(), libMesh::MeshTools::Generation::build_square(), libMesh::CONSTANT, libMesh::MeshBase::element_ptr_range(), libMesh::FIRST, libMesh::HIERARCHIC, libMesh::EquationSystems::init(), libMesh::LAGRANGE, mesh, libMesh::MONOMIAL, TripleFunction::offset, libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, libMesh::EquationSystems::parameters, libMesh::Real, libMesh::Elem::REFINE, libMesh::EquationSystems::reinit(), libMesh::MeshBase::sub_point_locator(), TestCommWorld, and libMesh::THIRD.
◆ tripleValueTest()
Definition at line 459 of file systems_test.C.
467 const Elem * elem = locator(p);
471 if (u_subdomains.count(sbd_id))
473 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(sys.point_value(0,p)),
483 if (v_subdomains.count(sbd_id))
485 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(sys.point_value(1,p)),
495 if (w_subdomains.count(sbd_id))
497 LIBMESH_ASSERT_FP_EQUAL(
libmesh_real(sys.point_value(2,p)),
References cubic_test(), disc_thirds_test(), libMesh::libmesh_real(), new_linear_test(), libMesh::TransientSystem< Base >::old_local_solution, libMesh::TransientSystem< Base >::older_local_solution, libMesh::Elem::subdomain_id(), TestCommWorld, and libMesh::TOLERANCE.
The documentation for this class was generated from the following file:
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
Manages consistently variables, degrees of freedom, and coefficient vectors.
void boundary_project_solution(const std::set< boundary_id_type > &b, const std::vector< unsigned int > &variables, FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr)
Projects arbitrary boundary functions onto a vector of degree of freedom values for the current syste...
unsigned int n_vars() const
std::vector< boundary_id_type > boundary_ids(const Node *node) const
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Number cubic_test(const Point &p, const Parameters &, const std::string &, const std::string &)
Manages storage and variables for transient systems.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
virtual void init() override
Override the FunctionBase::init() member function by calling our own and specifying the Trees::NODES ...
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
virtual void init(const numeric_index_type m, const numeric_index_type n, const numeric_index_type m_l, const numeric_index_type n_l, const numeric_index_type nnz=30, const numeric_index_type noz=10, const numeric_index_type blocksize=1)=0
Initialize SparseMatrix with the specified sizes.
This class provides function-like objects for data distributed over a mesh.
virtual const Elem & elem_ref(const dof_id_type i) const
void testProjectMatrix3D(const ElemType elem_type)
void assemble_matrix_and_rhs(EquationSystems &es, const std::string &system_name)
virtual void init(const numeric_index_type n, const numeric_index_type n_local, const bool fast=false, const ParallelType ptype=AUTOMATIC)=0
Change the dimension of the vector to n.
static const Real TOLERANCE
const Parallel::Communicator & comm() const
virtual Real linfty_norm() const =0
virtual void solve() override
Assembles & solves the linear system A*x=b.
dof_id_type end_old_dof(const processor_id_type proc) const
virtual const Node * node_ptr(const dof_id_type i) const =0
Number disc_thirds_test(const Point &p, const Parameters &, const std::string &, const std::string &)
void local_dof_indices(const unsigned int var, std::set< dof_id_type > &var_indices) const
Fills the std::set with the degrees of freedom on the local processor corresponding the the variable ...
virtual element_iterator elements_begin()=0
Iterate over all the elements in the Mesh.
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
virtual SimpleRange< element_iterator > element_ptr_range()=0
Implements (adaptive) mesh refinement algorithms for a MeshBase.
void attach_assemble_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in assembling the system matrix and RHS.
void distribute_dofs(MeshBase &)
Distribute dofs on the current mesh.
void local_variable_indices(std::vector< dof_id_type > &idx, const MeshBase &mesh, unsigned int var_num) const
Fills an array of those dof indices which belong to the given variable number and live on the current...
void set_solver_type(const SolverType st)
Sets the type of solver to use.
virtual LinearSolver< Number > * get_linear_solver() const override
virtual SimpleRange< node_iterator > node_ptr_range()=0
Number new_linear_test(const Point &p, const Parameters &, const std::string &, const std::string &)
processor_id_type processor_id() const
std::unique_ptr< NumericVector< Number > > older_local_solution
All the values I need to compute my contribution to the simulation at hand.
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
virtual SimpleRange< node_iterator > local_node_ptr_range()=0
libMesh::Parallel::Communicator * TestCommWorld
A Point defines a location in LIBMESH_DIM dimensional Real space.
The NodeElem is a point element, generally used as a side of a 1D element.
A Node is like a Point, but with more information.
The Tet4 is an element in 3D composed of 4 nodes.
ConstFunction that simply returns 0.
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value)=0
Add value to the element (i,j).
void testProjectSquare(const ElemType elem_type)
This is the EquationSystems class.
virtual Node *& set_node(const unsigned int i)
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
virtual dof_id_type n_nodes() const =0
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems.
void testProjectMatrix1D(const ElemType elem_type)
std::unique_ptr< PointLocatorBase > sub_point_locator() const
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
void testProjectCube(const ElemType elem_type)
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
virtual numeric_index_type row_stop() const =0
void testProjectMatrix2D(const ElemType elem_type)
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
subdomain_id_type subdomain_id() const
void add_edge(const dof_id_type elem, const unsigned short int edge, const boundary_id_type id)
Add edge edge of element number elem with boundary id id to the boundary information data structure.
void projection_matrix(SparseMatrix< Number > &proj_mat) const
This method creates a projection matrix which corresponds to the operation of project_vector between ...
virtual element_iterator elements_end()=0
The Edge2 is an element in 1D composed of 2 nodes.
This is the base class from which all geometric element types are derived.
void set_preconditioner_type(const PreconditionerType pct)
Sets the type of preconditioner to use.
const DofMap & get_dof_map() const
dof_id_type n_dofs() const
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id)=0
Add a new Node at Point p to the end of the vertex array, with processor_id procid.
virtual void set(const numeric_index_type i, const numeric_index_type j, const T value)=0
Set the element (i,j) to value.
void testProjectLine(const ElemType elem_type)
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void prepare_for_use(const bool skip_renumber_nodes_and_elements=false, const bool skip_find_neighbors=false)
Prepare a newly ecreated (or read) mesh for use.
std::unique_ptr< NumericVector< Number > > old_local_solution
All the values I need to compute my contribution to the simulation at hand.
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
void get_all_variable_numbers(std::vector< unsigned int > &all_variable_numbers) const
Fills all_variable_numbers with all the variable numbers for the variables that have been added to th...
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
const Node * node_ptr(const unsigned int i) const
dof_id_type first_old_dof(const processor_id_type proc) const
virtual void solve()
Solves the system.
void tripleValueTest(const Point &p, const TransientExplicitSystem &sys, const PointLocatorBase &locator, std::set< subdomain_id_type > &u_subdomains, std::set< subdomain_id_type > &v_subdomains, std::set< subdomain_id_type > &w_subdomains, const Parameters ¶m)
void assembly_with_dg_fem_context(EquationSystems &es, const std::string &)
void testProjectCubeWithMeshFunction(const ElemType elem_type)
virtual numeric_index_type row_start() const =0
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.