libMesh
Public Member Functions | Private Member Functions | List of all members
SystemsTest Class Reference
Inheritance diagram for SystemsTest:
[legend]

Public Member Functions

 CPPUNIT_TEST_SUITE (SystemsTest)
 
 CPPUNIT_TEST (testProjectHierarchicEdge3)
 
 CPPUNIT_TEST (testProjectHierarchicQuad9)
 
 CPPUNIT_TEST (testProjectHierarchicTri6)
 
 CPPUNIT_TEST (testBlockRestrictedVarNDofs)
 
 CPPUNIT_TEST (testProjectHierarchicHex27)
 
 CPPUNIT_TEST (testProjectMeshFunctionHex27)
 
 CPPUNIT_TEST (testBoundaryProjectCube)
 
 CPPUNIT_TEST (testAssemblyWithDgFemContext)
 
 CPPUNIT_TEST (testDofCouplingWithVarGroups)
 
 CPPUNIT_TEST (testProjectMatrixEdge2)
 
 CPPUNIT_TEST (testProjectMatrixQuad4)
 
 CPPUNIT_TEST (testProjectMatrixTri3)
 
 CPPUNIT_TEST (testProjectMatrixHex8)
 
 CPPUNIT_TEST (testProjectMatrixTet4)
 
 CPPUNIT_TEST_SUITE_END ()
 
void setUp ()
 
void tearDown ()
 
void testProjectLine (const ElemType elem_type)
 
void testProjectSquare (const ElemType elem_type)
 
void testProjectCube (const ElemType elem_type)
 
void testProjectCubeWithMeshFunction (const ElemType elem_type)
 
void testBoundaryProjectCube ()
 
void testDofCouplingWithVarGroups ()
 
void testAssemblyWithDgFemContext ()
 
void testBlockRestrictedVarNDofs ()
 
void testProjectMatrix1D (const ElemType elem_type)
 
void testProjectMatrix2D (const ElemType elem_type)
 
void testProjectMatrix3D (const ElemType elem_type)
 
void testProjectHierarchicEdge3 ()
 
void testProjectHierarchicQuad9 ()
 
void testProjectHierarchicTri6 ()
 
void testProjectHierarchicHex27 ()
 
void testProjectMeshFunctionHex27 ()
 
void testProjectMatrixEdge2 ()
 
void testProjectMatrixQuad4 ()
 
void testProjectMatrixTri3 ()
 
void testProjectMatrixHex8 ()
 
void testProjectMatrixTet4 ()
 

Private Member Functions

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 &param)
 

Detailed Description

Definition at line 416 of file systems_test.C.

Member Function Documentation

◆ CPPUNIT_TEST() [1/14]

SystemsTest::CPPUNIT_TEST ( testAssemblyWithDgFemContext  )

◆ CPPUNIT_TEST() [2/14]

SystemsTest::CPPUNIT_TEST ( testBlockRestrictedVarNDofs  )

◆ CPPUNIT_TEST() [3/14]

SystemsTest::CPPUNIT_TEST ( testBoundaryProjectCube  )

◆ CPPUNIT_TEST() [4/14]

SystemsTest::CPPUNIT_TEST ( testDofCouplingWithVarGroups  )

◆ CPPUNIT_TEST() [5/14]

SystemsTest::CPPUNIT_TEST ( testProjectHierarchicEdge3  )

◆ CPPUNIT_TEST() [6/14]

SystemsTest::CPPUNIT_TEST ( testProjectHierarchicHex27  )

◆ CPPUNIT_TEST() [7/14]

SystemsTest::CPPUNIT_TEST ( testProjectHierarchicQuad9  )

◆ CPPUNIT_TEST() [8/14]

SystemsTest::CPPUNIT_TEST ( testProjectHierarchicTri6  )

◆ CPPUNIT_TEST() [9/14]

SystemsTest::CPPUNIT_TEST ( testProjectMatrixEdge2  )

◆ CPPUNIT_TEST() [10/14]

SystemsTest::CPPUNIT_TEST ( testProjectMatrixHex8  )

◆ CPPUNIT_TEST() [11/14]

SystemsTest::CPPUNIT_TEST ( testProjectMatrixQuad4  )

◆ CPPUNIT_TEST() [12/14]

SystemsTest::CPPUNIT_TEST ( testProjectMatrixTet4  )

◆ CPPUNIT_TEST() [13/14]

SystemsTest::CPPUNIT_TEST ( testProjectMatrixTri3  )

◆ CPPUNIT_TEST() [14/14]

SystemsTest::CPPUNIT_TEST ( testProjectMeshFunctionHex27  )

◆ CPPUNIT_TEST_SUITE()

SystemsTest::CPPUNIT_TEST_SUITE ( SystemsTest  )

◆ CPPUNIT_TEST_SUITE_END()

SystemsTest::CPPUNIT_TEST_SUITE_END ( )

◆ setUp()

void SystemsTest::setUp ( )
inline

Definition at line 510 of file systems_test.C.

511  {}

◆ tearDown()

void SystemsTest::tearDown ( )
inline

Definition at line 513 of file systems_test.C.

514  {}

◆ testAssemblyWithDgFemContext()

void SystemsTest::testAssemblyWithDgFemContext ( )
inline

Definition at line 956 of file systems_test.C.

957  {
959 
960  EquationSystems es(mesh);
961  System &sys = es.add_system<LinearImplicitSystem> ("test");
962 
963  // We must use a discontinuous variable type in this test or
964  // else the sparsity pattern will not be correct
965  sys.add_variable("u", FIRST, L2_LAGRANGE);
966 
968  5, 5, 5,
969  0., 1., 0., 1., 0., 1.,
970  HEX8);
971 
972  es.init();
974  sys.solve();
975 
976  // We don't actually assert anything in this test. We just want to check that
977  // the assembly and solve do not encounter any errors.
978  }

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.

981  {
983 
985  4,
986  4,
987  0,
988  0., 1.,
989  0., 1.,
990  0., 0.,
991  QUAD4);
992 
993  auto el_beg = mesh.elements_begin();
994  auto el_end = mesh.elements_end();
995  auto el = mesh.elements_begin();
996  for (; el != el_end; ++el)
997  if ((*el)->centroid()(0) <= 0.5 && (*el)->centroid()(1) <= 0.5)
998  (*el)->subdomain_id() = 0;
999  else
1000  (*el)->subdomain_id() = 1;
1001 
1003 
1004  // Create an equation systems object.
1005  EquationSystems equation_systems (mesh);
1006  ExplicitSystem& system =
1007  equation_systems.add_system<LinearImplicitSystem> ("test");
1008 
1009  std::set<subdomain_id_type> block0;
1010  std::set<subdomain_id_type> block1;
1011  block0.insert(0);
1012  block1.insert(1);
1013  auto u0 = system.add_variable ("u0", libMesh::FIRST, &block0);
1014  auto u1 = system.add_variable ("u1", libMesh::FIRST, &block1);
1015  equation_systems.init();
1016 
1017  std::vector<dof_id_type> u0_dofs;
1018  system.get_dof_map().local_variable_indices(u0_dofs, mesh, u0);
1019  std::vector<dof_id_type> u1_dofs;
1020  system.get_dof_map().local_variable_indices(u1_dofs, mesh, u1);
1021 
1022  std::set<dof_id_type> sys_u0_dofs;
1023  system.local_dof_indices(u0, sys_u0_dofs);
1024  std::set<dof_id_type> sys_u1_dofs;
1025  system.local_dof_indices(u1, sys_u1_dofs);
1026 
1027  // Get local indices from other processors too
1028  mesh.comm().allgather(u0_dofs);
1029  mesh.comm().allgather(u1_dofs);
1030  mesh.comm().set_union(sys_u0_dofs);
1031  mesh.comm().set_union(sys_u1_dofs);
1032 
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());
1039  }

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.

746  {
748 
749  // const boundary_id_type BOUNDARY_ID_MIN_Z = 0;
750  const boundary_id_type BOUNDARY_ID_MIN_Y = 1;
751  const boundary_id_type BOUNDARY_ID_MAX_X = 2;
752  const boundary_id_type BOUNDARY_ID_MAX_Y = 3;
753  const boundary_id_type BOUNDARY_ID_MIN_X = 4;
754  const boundary_id_type BOUNDARY_ID_MAX_Z = 5;
755  const boundary_id_type NODE_BOUNDARY_ID = 10;
756  const boundary_id_type EDGE_BOUNDARY_ID = 20;
757  const boundary_id_type SIDE_BOUNDARY_ID = BOUNDARY_ID_MIN_X;
758 
759  EquationSystems es(mesh);
760  System &sys = es.add_system<System> ("SimpleSystem");
761  unsigned int u_var = sys.add_variable("u", FIRST, LAGRANGE);
762 
764  3, 3, 3,
765  0., 1., 0., 1., 0., 1.,
766  HEX8);
767 
768  // Count the number of nodes on SIDE_BOUNDARY_ID
769  std::set<dof_id_type> projected_nodes_set;
770 
771  for (const auto & elem : mesh.element_ptr_range())
772  {
773  for (auto side : elem->side_index_range())
774  {
775  std::vector<boundary_id_type> vec_to_fill;
776  mesh.get_boundary_info().boundary_ids(elem, side, vec_to_fill);
777 
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())
780  {
781  for (unsigned int node_index=0; node_index<elem->n_nodes(); node_index++)
782  {
783  if( elem->is_node_on_side(node_index, side))
784  {
785  projected_nodes_set.insert(elem->node_id(node_index));
786  }
787  }
788  }
789  }
790  }
791 
792  // Also add some edge and node boundary IDs
793  for (const auto & elem : mesh.element_ptr_range())
794  {
795  unsigned int
796  side_max_x = 0, side_min_y = 0,
797  side_max_y = 0, side_max_z = 0;
798 
799  bool
800  found_side_max_x = false, found_side_max_y = false,
801  found_side_min_y = false, found_side_max_z = false;
802 
803  for (auto side : elem->side_index_range())
804  {
805  if (mesh.get_boundary_info().has_boundary_id(elem, side, BOUNDARY_ID_MAX_X))
806  {
807  side_max_x = side;
808  found_side_max_x = true;
809  }
810 
811  if (mesh.get_boundary_info().has_boundary_id(elem, side, BOUNDARY_ID_MIN_Y))
812  {
813  side_min_y = side;
814  found_side_min_y = true;
815  }
816 
817  if (mesh.get_boundary_info().has_boundary_id(elem, side, BOUNDARY_ID_MAX_Y))
818  {
819  side_max_y = side;
820  found_side_max_y = true;
821  }
822 
823  if (mesh.get_boundary_info().has_boundary_id(elem, side, BOUNDARY_ID_MAX_Z))
824  {
825  side_max_z = side;
826  found_side_max_z = true;
827  }
828  }
829 
830  // If elem has sides on boundaries
831  // BOUNDARY_ID_MAX_X, BOUNDARY_ID_MAX_Y, BOUNDARY_ID_MAX_Z
832  // then let's set a node boundary condition
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))
838  {
839  projected_nodes_set.insert(elem->node_id(n));
840  mesh.get_boundary_info().add_node(elem->node_ptr(n), NODE_BOUNDARY_ID);
841  }
842 
843  // If elem has sides on boundaries
844  // BOUNDARY_ID_MAX_X and BOUNDARY_ID_MIN_Y
845  // then let's set an edge boundary condition
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))
850  {
851  mesh.get_boundary_info().add_edge(elem, e, EDGE_BOUNDARY_ID);
852 
853  for (unsigned int node_index=0; node_index<elem->n_nodes(); node_index++)
854  {
855  if (elem->is_node_on_edge(node_index, e))
856  {
857  projected_nodes_set.insert(elem->node_id(node_index));
858  }
859  }
860  }
861  }
862 
863  es.init();
864 
865  sys.solution->add(1.0);
866 
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);
873  ZeroFunction<> zf;
874  sys.boundary_project_solution(boundary_ids, variables, &zf);
875 
876  // On a distributed mesh we may not have every node on every
877  // processor
878  TestCommWorld->set_union(projected_nodes_set);
879 
880  // We set the solution to be 1 everywhere and then zero on specific boundary
881  // nodes, so the final l1 norm of the solution is the difference between the
882  // number of nodes in the mesh and the number of nodes we zero on.
883  Real ref_l1_norm = static_cast<Real>(mesh.n_nodes()) - static_cast<Real>(projected_nodes_set.size());
884 
885  LIBMESH_ASSERT_FP_EQUAL(sys.solution->l1_norm(), ref_l1_norm, TOLERANCE*TOLERANCE);
886  }

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.

889  {
891 
893  1,
894  0,
895  0,
896  0., 1.,
897  0., 0.,
898  0., 0.,
899  EDGE2);
900 
901  Point new_point_a(2.);
902  Point new_point_b(3.);
903  Node* new_node_a = mesh.add_point( new_point_a );
904  Node* new_node_b = mesh.add_point( new_point_b );
905  Elem* new_edge_elem = mesh.add_elem (new Edge2);
906  new_edge_elem->set_node(0) = new_node_a;
907  new_edge_elem->set_node(1) = new_node_b;
908 
909  mesh.elem_ref(0).subdomain_id() = 10;
910  mesh.elem_ref(1).subdomain_id() = 10;
911 
912  // Add NodeElems for coupling purposes
913  Elem* node_elem_1 = mesh.add_elem (new NodeElem);
914  node_elem_1->set_node(0) = mesh.elem_ref(0).node_ptr(1);
915  Elem* node_elem_2 = mesh.add_elem (new NodeElem);
916  node_elem_2->set_node(0) = new_node_a;
917 
919 
920  // Create an equation systems object.
921  EquationSystems equation_systems (mesh);
922  LinearImplicitSystem & system =
923  equation_systems.add_system<LinearImplicitSystem> ("test");
924 
925  system.add_variable ("u", libMesh::FIRST);
926  system.add_variable ("v", libMesh::FIRST);
927  system.add_variable ("w", libMesh::FIRST);
928 
929  std::set<subdomain_id_type> theta_subdomains;
930  theta_subdomains.insert(10);
931  system.add_variable ("theta_x", libMesh::FIRST, &theta_subdomains);
932  system.add_variable ("theta_y", libMesh::FIRST, &theta_subdomains);
933  system.add_variable ("theta_z", libMesh::FIRST, &theta_subdomains);
934 
936 
937  AugmentSparsityOnNodes augment_sparsity(mesh);
938  system.get_dof_map().add_coupling_functor(augment_sparsity);
939 
940  // LASPACK GMRES + ILU defaults don't like this problem, but it's
941  // small enough to just use a simpler iteration.
944 
945  equation_systems.init ();
946 
947  system.solve();
948 
949  // We set the solution to be 1 everywhere, so the final l1 norm of the
950  // solution is the product of the number of variables and number of nodes.
951  Real ref_l1_norm = static_cast<Real>(mesh.n_nodes() * system.n_vars());
952 
953  LIBMESH_ASSERT_FP_EQUAL(system.solution->l1_norm(), ref_l1_norm, TOLERANCE*TOLERANCE);
954  }

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.

627  {
629 
630  EquationSystems es(mesh);
632  es.add_system<TransientExplicitSystem> ("SimpleSystem");
633 
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};
637 
638  sys.add_variable("u", THIRD, HIERARCHIC, &u_subdomains);
639  sys.add_variable("v", FIRST, LAGRANGE, &v_subdomains);
640  sys.add_variable("w", CONSTANT, MONOMIAL, &w_subdomains);
641 
643  3, 3, 3,
644  0., 1., 0., 1., 0., 1.,
645  elem_type);
646 
647  for (auto & elem : mesh.element_ptr_range())
648  elem->subdomain_id() = elem->id()/6;
649 
650  es.init();
651  TripleFunction tfunc;
652  sys.project_solution(&tfunc);
653  tfunc.offset = 10;
654  sys.project_vector(*sys.old_local_solution, &tfunc);
655  tfunc.offset = 20;
656  sys.project_vector(*sys.older_local_solution, &tfunc);
657 
658  std::unique_ptr<PointLocatorBase> locator = mesh.sub_point_locator();
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)
663  tripleValueTest(Point(x,y,z), sys, *locator,
664  u_subdomains, v_subdomains, w_subdomains,
665  es.parameters);
666 
667  #ifdef LIBMESH_ENABLE_AMR
668  for (auto & elem : mesh.element_ptr_range())
669  if ((elem->id()/2)%2)
670  elem->set_refinement_flag(Elem::REFINE);
671  es.reinit();
672 
673  locator = mesh.sub_point_locator();
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)
678  tripleValueTest(Point(x,y,z), sys, *locator,
679  u_subdomains, v_subdomains, w_subdomains,
680  es.parameters);
681  #endif
682  }

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.

685  {
686  // The source mesh needs to exist everywhere it's queried, so we
687  // use a ReplicatedMesh
689 
690  EquationSystems es(mesh);
691  System &sys = es.add_system<System> ("SimpleSystem");
692  sys.add_variable("u", THIRD, MONOMIAL);
693 
695  3, 3, 3,
696  0., 1., 0., 1., 0., 1.,
697  elem_type);
698 
699  es.init();
700  sys.project_solution(cubic_test, nullptr, es.parameters);
701 
702  std::vector<unsigned int> variables;
703  sys.get_all_variable_numbers(variables);
704  std::sort(variables.begin(),variables.end());
705 
706  std::unique_ptr< NumericVector<Number> > mesh_function_vector =
707  NumericVector<Number>::build(es.comm());
708  mesh_function_vector->init(sys.n_dofs(), false, SERIAL);
709  sys.solution->localize( *mesh_function_vector );
710 
711  MeshFunction mesh_function(es,
712  *mesh_function_vector,
713  sys.get_dof_map(),
714  variables);
715  mesh_function.init();
716 
717  // Make a second system and project onto it using a MeshFunction
718  Mesh proj_mesh(*TestCommWorld);
719  EquationSystems proj_es(proj_mesh);
720 
721  System &proj_sys = proj_es.add_system<System> ("ProjectionSystem");
722 
723  // use 3rd order again so we can expect exact results
724  proj_sys.add_variable("u", THIRD, HIERARCHIC);
725 
727  5, 5, 5,
728  0., 1., 0., 1., 0., 1.,
729  elem_type);
730 
731  proj_es.init();
732  proj_sys.project_solution(&mesh_function);
733 
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)
737  {
738  Point p(x,y,z);
739  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(proj_sys.point_value(0,p)),
740  libmesh_real(cubic_test(p,es.parameters,"","")),
742  }
743  }

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

Definition at line 1504 of file systems_test.C.

1504 { testProjectLine(EDGE3); }

References libMesh::EDGE3.

◆ testProjectHierarchicHex27()

void SystemsTest::testProjectHierarchicHex27 ( )
inline

Definition at line 1507 of file systems_test.C.

1507 { testProjectCube(HEX27); }

References libMesh::HEX27.

◆ testProjectHierarchicQuad9()

void SystemsTest::testProjectHierarchicQuad9 ( )
inline

Definition at line 1505 of file systems_test.C.

References libMesh::QUAD9.

◆ testProjectHierarchicTri6()

void SystemsTest::testProjectHierarchicTri6 ( )
inline

Definition at line 1506 of file systems_test.C.

1506 { testProjectSquare(TRI6); }

References libMesh::TRI6.

◆ testProjectLine()

void SystemsTest::testProjectLine ( const ElemType  elem_type)
inline

Definition at line 516 of file systems_test.C.

517  {
519 
520  EquationSystems es(mesh);
522  es.add_system<TransientExplicitSystem> ("SimpleSystem");
523 
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};
527 
528  sys.add_variable("u", THIRD, HIERARCHIC, &u_subdomains);
529  sys.add_variable("v", FIRST, LAGRANGE, &v_subdomains);
530  sys.add_variable("w", CONSTANT, MONOMIAL, &w_subdomains);
531 
533  6,
534  0., 1.,
535  elem_type);
536 
537  for (auto & elem : mesh.element_ptr_range())
538  elem->subdomain_id() = elem->id();
539 
540  es.init();
541  TripleFunction tfunc;
542  sys.project_solution(&tfunc);
543  tfunc.offset = 10;
544  sys.project_vector(*sys.old_local_solution, &tfunc);
545  tfunc.offset = 20;
546  sys.project_vector(*sys.older_local_solution, &tfunc);
547 
548  std::unique_ptr<PointLocatorBase> locator = mesh.sub_point_locator();
549  locator->enable_out_of_mesh_mode();
550  for (Real x = 0.1; x < 1; x += 0.2)
551  tripleValueTest(Point(x), sys, *locator,
552  u_subdomains, v_subdomains, w_subdomains,
553  es.parameters);
554 
555 #ifdef LIBMESH_ENABLE_AMR
556  for (auto & elem : mesh.element_ptr_range())
557  if ((elem->id()/2)%2)
558  elem->set_refinement_flag(Elem::REFINE);
559  es.reinit();
560 
561  locator = mesh.sub_point_locator();
562  locator->enable_out_of_mesh_mode();
563  for (Real x = 0.1; x < 1; x += 0.2)
564  tripleValueTest(Point(x), sys, *locator,
565  u_subdomains, v_subdomains, w_subdomains,
566  es.parameters);
567 #endif
568  }

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.

1045  {
1046  // Use ReplicatedMesh to get consistent child element node
1047  // numbering during refinement
1049 
1050  // fix the node numbering to resolve dof_id numbering issues in parallel tests
1051  mesh.allow_renumbering(false);
1052 
1053  // init a simple 1d system
1054  EquationSystems es(mesh);
1055  System &sys = es.add_system<System> ("SimpleSystem");
1056  sys.add_variable("u", FIRST, LAGRANGE);
1057 
1059  4, 0., 1.,
1060  elem_type);
1061 
1062  es.init();
1063 
1064  // static set of coarse nodes / order of fine grid nodes from x=0 to x=1 going left to right
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});
1067 
1068  // stash number of dofs on coarse grid for projection sizing
1069  int n_old_dofs = sys.n_dofs();
1070 
1071  // save old coarse dof_ids in order of coarse nodes
1072  std::map <dof_id_type, dof_id_type> node2dof_c;
1073  for ( const auto & node : mesh.node_ptr_range() )
1074  {
1075  dof_id_type cdof_id = node->dof_number(0,0,0);
1076  node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1077  }
1078 
1079  // refine the mesh so we can utilize old_dof_indices for projection_matrix
1080  MeshRefinement mr(mesh);
1081  mr.uniformly_refine(1);
1083 
1084  // fine node to dof map
1085  std::map <dof_id_type, dof_id_type> node2dof_f;
1086  for ( const auto & node : mesh.local_node_ptr_range() )
1087  {
1088  dof_id_type fdof_id = node->dof_number(0,0,0);
1089  node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1090  }
1091 
1092  // local and global projection_matrix sizes infos
1093  int n_new_dofs = sys.n_dofs();
1094  int n_new_dofs_local = sys.get_dof_map().n_dofs_on_processor(sys.processor_id());
1095  int ndofs_old_first = sys.get_dof_map().first_old_dof(sys.processor_id());
1096  int ndofs_old_end = sys.get_dof_map().end_old_dof(sys.processor_id());
1097  int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1098 
1099  // init and compute the projection matrix using GenericProjector
1100  std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1102  SparseMatrix<Number> & proj_mat = *proj_mat_ptr;
1103  proj_mat.init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1104  sys.projection_matrix(proj_mat);
1105  proj_mat.close();
1106 
1107  // init the gold standard projection matrix
1108  std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1110  SparseMatrix<Number> & gold_mat = *gold_mat_ptr;
1111  gold_mat.init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1112 
1113  // construct the gold projection matrix using static node numbering as reference info
1114  for ( const auto & node : mesh.local_node_ptr_range() )
1115  {
1116  dof_id_type node_id = node->id();
1117  dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1118 
1119  if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1120  { //direct inject coarse nodes
1121  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1122  {
1123  auto cdof_id = node2dof_c.find(node_id);
1124  gold_mat.set(fdof_id, cdof_id->second, 1.0);
1125  }
1126  }
1127  else
1128  { // new nodes with old_dof neighbor contributions
1129  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1130  {
1131  auto node_loc = std::find(node_order_f.begin(), node_order_f.end(), node_id);
1132  auto node_n = *std::next(node_loc, 1);
1133  auto node_p = *std::prev(node_loc, 1);
1134  auto dof_p = node2dof_c.find(node_p);
1135  auto dof_n = node2dof_c.find(node_n);
1136 
1137  gold_mat.set(fdof_id, dof_p->second, 0.5);
1138  gold_mat.set(fdof_id, dof_n->second, 0.5);
1139  }
1140  }
1141  } // end gold mat build
1142  gold_mat.close();
1143 
1144  // calculate relative difference norm between the two projection matrices
1145  Real gold_norm = gold_mat.linfty_norm();
1146  gold_mat.add(-1.0, proj_mat);
1147  Real diff_norm = gold_mat.linfty_norm();
1148  CPPUNIT_ASSERT(diff_norm/gold_norm < TOLERANCE*TOLERANCE);
1149  }

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.

1152  {
1153  // Use ReplicatedMesh to get consistent child element node
1154  // numbering during refinement
1156 
1157  // fix the node numbering to resolve dof_id numbering issues in parallel tests
1158  mesh.allow_renumbering(false);
1159 
1160  // init a simple 1d system
1161  EquationSystems es(mesh);
1162  System &sys = es.add_system<System> ("SimpleSystem");
1163  sys.add_variable("u", FIRST, LAGRANGE);
1164 
1165  if (elem_type == Utility::string_to_enum<ElemType>("QUAD4"))
1167  2, 2,
1168  0., 1., 0., 1.,
1169  elem_type);
1170  else if (elem_type == Utility::string_to_enum<ElemType>("TRI3"))
1172  1, 1,
1173  0., 1., 0., 1.,
1174  elem_type);
1175 
1176  es.init();
1177 
1178  // static sets of nodes and their neighbors
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;
1182 
1183  // fill neighbor maps based on static node numbering
1184  if (elem_type == Utility::string_to_enum<ElemType>("QUAD4"))
1185  {
1186  coarse_nodes.insert({0,1,2,3,4,5,6,7,8});
1187 
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}});
1200 
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}});
1205  }
1206  else if (elem_type == Utility::string_to_enum<ElemType>("TRI3"))
1207  {
1208  coarse_nodes.insert({0,1,2,3});
1209 
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}});
1215  }
1216 
1217  // stash number of dofs on coarse grid for projection sizing
1218  int n_old_dofs = sys.n_dofs();
1219 
1220  // save old coarse dof_ids in order of coarse nodes
1221  std::map <dof_id_type, dof_id_type> node2dof_c;
1222  for ( const auto & node : mesh.node_ptr_range() )
1223  {
1224  dof_id_type cdof_id = node->dof_number(0,0,0);
1225  node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1226  }
1227 
1228  // refine the mesh so we can utilize old_dof_indices for projection_matrix
1229  MeshRefinement mr(mesh);
1230  mr.uniformly_refine(1);
1232 
1233  // fine node to dof map
1234  std::map <dof_id_type, dof_id_type> node2dof_f;
1235  for ( const auto & node : mesh.local_node_ptr_range() )
1236  {
1237  dof_id_type fdof_id = node->dof_number(0,0,0);
1238  node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1239  }
1240 
1241  // local and global projection_matrix sizes infos
1242  int n_new_dofs = sys.n_dofs();
1243  int n_new_dofs_local = sys.get_dof_map().n_dofs_on_processor(sys.processor_id());
1244  int ndofs_old_first = sys.get_dof_map().first_old_dof(sys.processor_id());
1245  int ndofs_old_end = sys.get_dof_map().end_old_dof(sys.processor_id());
1246  int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1247 
1248  // init and compute the projection matrix using GenericProjector
1249  std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1251  SparseMatrix<Number> & proj_mat = *proj_mat_ptr;
1252  proj_mat.init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1253  sys.projection_matrix(proj_mat);
1254  proj_mat.close();
1255 
1256  // init the gold standard projection matrix
1257  std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1259  SparseMatrix<Number> & gold_mat = *gold_mat_ptr;
1260  gold_mat.init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1261 
1262  // construct the gold projection matrix using static node numbering as reference info
1263  for ( const auto & node : mesh.local_node_ptr_range() )
1264  {
1265  dof_id_type node_id = node->id();
1266  dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1267 
1268  if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1269  { // direct inject coarse nodes
1270  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1271  {
1272  auto cdof_id = node2dof_c.find(node_id);
1273  gold_mat.set(fdof_id, cdof_id->second, 1.0);
1274  }
1275  }
1276  else if ( side_nbr_nodes.find(node_id) != side_nbr_nodes.end() )
1277  { // new side nodes with old_dof neighbor contributions
1278  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1279  {
1280  auto node_nbrs = side_nbr_nodes.find(node_id);
1281  for (auto nbr : node_nbrs->second)
1282  {
1283  auto nbr_dof = node2dof_c.find(nbr);
1284  gold_mat.set(fdof_id, nbr_dof->second, 0.5);
1285  }
1286  }
1287  }
1288  else
1289  { // new interior nodes with old_dof neighbor contributions
1290  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1291  {
1292  auto node_nbrs = int_nbr_nodes.find(node_id);
1293  for (auto nbr : node_nbrs->second)
1294  {
1295  auto nbr_dof = node2dof_c.find(nbr);
1296  gold_mat.set(fdof_id, nbr_dof->second, 0.25);
1297  }
1298  }
1299  }
1300  } // end gold mat build
1301  gold_mat.close();
1302 
1303  // calculate relative difference norm between the two projection matrices
1304  Real gold_norm = gold_mat.linfty_norm();
1305  proj_mat.add(-1.0, gold_mat);
1306  Real diff_norm = proj_mat.linfty_norm();
1307  CPPUNIT_ASSERT(diff_norm/gold_norm < TOLERANCE*TOLERANCE);
1308  }

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.

1311  {
1312  // Use ReplicatedMesh to get consistent child element node
1313  // numbering during refinement
1315 
1316  // fix the node numbering to resolve dof_id numbering issues in parallel tests
1317  mesh.allow_renumbering(false);
1318 
1319  // init a simple 1d system
1320  EquationSystems es(mesh);
1321  System &sys = es.add_system<System> ("SimpleSystem");
1322  sys.add_variable("u", FIRST, LAGRANGE);
1323 
1324  if (elem_type == Utility::string_to_enum<ElemType>("HEX8"))
1326  1, 1, 1,
1327  0., 1., 0., 1., 0., 1.,
1328  elem_type);
1329  else if (elem_type == Utility::string_to_enum<ElemType>("TET4"))
1330  {
1331  // manually build a Tet4 element
1332  mesh.add_point( Point(0,0,0), 0 );
1333  mesh.add_point( Point(1,0,0), 1 );
1334  mesh.add_point( Point(0,1,0), 2 );
1335  mesh.add_point( Point(1./3.,1./3.,1), 3 );
1336 
1337  Elem * elem = new Tet4();
1338  elem->set_id(0);
1339  elem = mesh.add_elem(elem);
1340  elem->set_node(0) = mesh.node_ptr(0);
1341  elem->set_node(1) = mesh.node_ptr(1);
1342  elem->set_node(2) = mesh.node_ptr(2);
1343  elem->set_node(3) = mesh.node_ptr(3);
1344 
1346  }
1347  es.init();
1348 
1349  // static sets of nodes and their neighbors
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;
1354 
1355  if (elem_type == Utility::string_to_enum<ElemType>("HEX8"))
1356  {
1357  coarse_nodes.insert({0,1,2,3,4,5,6,7});
1358 
1359  // fill neighbor maps based on static node numbering
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}});
1372 
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}});
1379 
1380  int_nbr_nodes.insert({13, {0,1,2,3,4,5,6,7}});
1381  }
1382  else if (elem_type == Utility::string_to_enum<ElemType>("TET4"))
1383  {
1384  coarse_nodes.insert({0,1,2,3});
1385 
1386  // fill neighbor maps based on static node numbering
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}});
1393  }
1394 
1395  // stash number of dofs on coarse grid for projection sizing
1396  int n_old_dofs = sys.n_dofs();
1397 
1398  // save old coarse dof_ids in order of coarse nodes
1399  std::map <dof_id_type, dof_id_type> node2dof_c;
1400  for ( const auto & node : mesh.node_ptr_range() )
1401  {
1402  dof_id_type cdof_id = node->dof_number(0,0,0);
1403  node2dof_c.insert( std::pair<dof_id_type,dof_id_type>( node->id() , cdof_id) );
1404  }
1405 
1406  // refine the mesh so we can utilize old_dof_indices for projection_matrix
1407  MeshRefinement mr(mesh);
1408  mr.uniformly_refine(1);
1410 
1411  // fine node to dof map
1412  std::map <dof_id_type, dof_id_type> node2dof_f;
1413  for ( const auto & node : mesh.local_node_ptr_range() )
1414  {
1415  dof_id_type fdof_id = node->dof_number(0,0,0);
1416  node2dof_f.insert( std::pair<dof_id_type,dof_id_type>(node->id() , fdof_id) );
1417  }
1418 
1419  // local and global projection_matrix sizes infos
1420  int n_new_dofs = sys.n_dofs();
1421  int n_new_dofs_local = sys.get_dof_map().n_dofs_on_processor(sys.processor_id());
1422  int ndofs_old_first = sys.get_dof_map().first_old_dof(sys.processor_id());
1423  int ndofs_old_end = sys.get_dof_map().end_old_dof(sys.processor_id());
1424  int n_old_dofs_local = ndofs_old_end - ndofs_old_first;
1425 
1426  // init and compute the projection matrix using GenericProjector
1427  std::unique_ptr<SparseMatrix<Number> > proj_mat_ptr =
1429  SparseMatrix<Number> & proj_mat = *proj_mat_ptr;
1430  proj_mat.init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1431  sys.projection_matrix(proj_mat);
1432  proj_mat.close();
1433 
1434  // init the gold standard projection matrix
1435  std::unique_ptr<SparseMatrix<Number> > gold_mat_ptr =
1437  SparseMatrix<Number> & gold_mat = *gold_mat_ptr;
1438  gold_mat.init(n_new_dofs, n_old_dofs, n_new_dofs_local, n_old_dofs_local);
1439 
1440  // construct the gold projection matrix using static node numbering as reference info
1441  for ( const auto & node : mesh.local_node_ptr_range() )
1442  {
1443  dof_id_type node_id = node->id();
1444  dof_id_type fdof_id = (node2dof_f.find(node_id))->second;
1445 
1446  if (coarse_nodes.find(node_id) != coarse_nodes.end() )
1447  { // direct inject coarse nodes
1448  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1449  {
1450  auto cdof_id = node2dof_c.find(node_id);
1451  gold_mat.set(fdof_id, cdof_id->second, 1.0);
1452  }
1453  }
1454  else if ( side_nbr_nodes.find(node_id) != side_nbr_nodes.end() )
1455  { // new side nodes with old_dof neighbor contributions
1456  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1457  {
1458  auto node_nbrs = side_nbr_nodes.find(node_id);
1459  for (auto nbr : node_nbrs->second)
1460  {
1461  auto nbr_dof = node2dof_c.find(nbr);
1462  gold_mat.set(fdof_id, nbr_dof->second, 0.5);
1463  }
1464  }
1465  }
1466  else if ( face_nbr_nodes.find(node_id) != face_nbr_nodes.end() )
1467  { // new face nodes with old_dof neighbor contributions
1468  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1469  {
1470  auto node_nbrs = face_nbr_nodes.find(node_id);
1471  for (auto nbr : node_nbrs->second)
1472  {
1473  auto nbr_dof = node2dof_c.find(nbr);
1474  gold_mat.set(fdof_id, nbr_dof->second, 0.25);
1475  }
1476  }
1477  }
1478  else
1479  { // new interior nodes with old_dof neighbor contributions
1480  if (fdof_id >= gold_mat.row_start() && fdof_id < gold_mat.row_stop())
1481  {
1482  auto node_nbrs = int_nbr_nodes.find(node_id);
1483  for (auto nbr : node_nbrs->second)
1484  {
1485  auto nbr_dof = node2dof_c.find(nbr);
1486  gold_mat.set(fdof_id, nbr_dof->second, 0.125);
1487  }
1488  }
1489  }
1490  } // end gold mat build
1491  gold_mat.close();
1492 
1493  // calculate relative difference norm between the two projection matrices
1494  Real gold_norm = gold_mat.linfty_norm();
1495  proj_mat.add(-1.0, gold_mat);
1496  Real diff_norm = proj_mat.linfty_norm();
1497  CPPUNIT_ASSERT(diff_norm/gold_norm < TOLERANCE*TOLERANCE);
1498  }

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

Definition at line 1514 of file systems_test.C.

References libMesh::EDGE2.

◆ testProjectMatrixHex8()

void SystemsTest::testProjectMatrixHex8 ( )
inline

Definition at line 1517 of file systems_test.C.

References libMesh::HEX8.

◆ testProjectMatrixQuad4()

void SystemsTest::testProjectMatrixQuad4 ( )
inline

Definition at line 1515 of file systems_test.C.

References libMesh::QUAD4.

◆ testProjectMatrixTet4()

void SystemsTest::testProjectMatrixTet4 ( )
inline

Definition at line 1518 of file systems_test.C.

References libMesh::TET4.

◆ testProjectMatrixTri3()

void SystemsTest::testProjectMatrixTri3 ( )
inline

Definition at line 1516 of file systems_test.C.

References libMesh::TRI3.

◆ testProjectMeshFunctionHex27()

void SystemsTest::testProjectMeshFunctionHex27 ( )
inline

Definition at line 1508 of file systems_test.C.

References libMesh::HEX27.

◆ testProjectSquare()

void SystemsTest::testProjectSquare ( const ElemType  elem_type)
inline

Definition at line 570 of file systems_test.C.

571  {
573 
574  EquationSystems es(mesh);
576  es.add_system<TransientExplicitSystem> ("SimpleSystem");
577 
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};
581 
582  sys.add_variable("u", THIRD, HIERARCHIC, &u_subdomains);
583  sys.add_variable("v", FIRST, LAGRANGE, &v_subdomains);
584  sys.add_variable("w", CONSTANT, MONOMIAL, &w_subdomains);
585 
587  3, 3,
588  0., 1., 0., 1.,
589  elem_type);
590 
591  for (auto & elem : mesh.element_ptr_range())
592  elem->subdomain_id() = elem->id()/2;
593 
594  es.init();
595  TripleFunction tfunc;
596  sys.project_solution(&tfunc);
597  tfunc.offset = 10;
598  sys.project_vector(*sys.old_local_solution, &tfunc);
599  tfunc.offset = 20;
600  sys.project_vector(*sys.older_local_solution, &tfunc);
601 
602  std::unique_ptr<PointLocatorBase> locator = mesh.sub_point_locator();
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)
606  tripleValueTest(Point(x,y), sys, *locator,
607  u_subdomains, v_subdomains, w_subdomains,
608  es.parameters);
609 
610 #ifdef LIBMESH_ENABLE_AMR
611  for (auto & elem : mesh.element_ptr_range())
612  if ((elem->id()/2)%2)
613  elem->set_refinement_flag(Elem::REFINE);
614  es.reinit();
615 
616  locator = mesh.sub_point_locator();
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)
620  tripleValueTest(Point(x,y), sys, *locator,
621  u_subdomains, v_subdomains, w_subdomains,
622  es.parameters);
623 #endif
624  }

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()

void SystemsTest::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 param 
)
inlineprivate

Definition at line 459 of file systems_test.C.

466  {
467  const Elem * elem = locator(p);
468  subdomain_id_type sbd_id = elem ? elem->subdomain_id() : 0;
469  TestCommWorld->max(sbd_id);
470 
471  if (u_subdomains.count(sbd_id))
472  {
473  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(0,p)),
474  libmesh_real(cubic_test(p,param,"","")),
475  TOLERANCE*TOLERANCE*10);
476  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(0,p,sys.old_local_solution.get())),
477  libmesh_real(cubic_test(p,param,"","") + Number(10)),
478  TOLERANCE*TOLERANCE*100);
479  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(0,p,sys.older_local_solution.get())),
480  libmesh_real(cubic_test(p,param,"","") + Number(20)),
481  TOLERANCE*TOLERANCE*100);
482  }
483  if (v_subdomains.count(sbd_id))
484  {
485  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(1,p)),
486  libmesh_real(new_linear_test(p,param,"","")),
487  TOLERANCE*TOLERANCE*10);
488  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(1,p,sys.old_local_solution.get())),
489  libmesh_real(new_linear_test(p,param,"","") + Number(10)),
490  TOLERANCE*TOLERANCE*100);
491  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(1,p,sys.older_local_solution.get())),
492  libmesh_real(new_linear_test(p,param,"","") + Number(20)),
493  TOLERANCE*TOLERANCE*100);
494  }
495  if (w_subdomains.count(sbd_id))
496  {
497  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(2,p)),
498  libmesh_real(disc_thirds_test(p,param,"","")),
499  TOLERANCE*TOLERANCE*10);
500  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(2,p,sys.old_local_solution.get())),
501  libmesh_real(disc_thirds_test(p,param,"","") + Number(10)),
502  TOLERANCE*TOLERANCE*100);
503  LIBMESH_ASSERT_FP_EQUAL(libmesh_real(sys.point_value(2,p,sys.older_local_solution.get())),
504  libmesh_real(disc_thirds_test(p,param,"","") + Number(20)),
505  TOLERANCE*TOLERANCE*100);
506  }
507  }

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:
libMesh::SparseMatrix::close
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
libMesh::System
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:100
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::System::boundary_project_solution
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...
Definition: system_projection.C:1126
libMesh::System::n_vars
unsigned int n_vars() const
Definition: system.h:2155
libMesh::BoundaryInfo::boundary_ids
std::vector< boundary_id_type > boundary_ids(const Node *node) const
Definition: boundary_info.C:985
libMesh::MeshTools::Subdivision::next
static const unsigned int next[3]
A lookup table for the increment modulo 3 operation, for iterating through the three nodes per elemen...
Definition: mesh_subdivision_support.h:102
libMesh::Mesh
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
cubic_test
Number cubic_test(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: systems_test.C:330
libMesh::TransientSystem
Manages storage and variables for transient systems.
Definition: transient_system.h:57
libMesh::MeshBase::get_boundary_info
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:132
libMesh::MeshFunction::init
virtual void init() override
Override the FunctionBase::init() member function by calling our own and specifying the Trees::NODES ...
Definition: mesh_function.h:110
libMesh::HEX8
Definition: enum_elem_type.h:47
libMesh::BoundaryInfo::add_node
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
Definition: boundary_info.C:636
libMesh::SparseMatrix::init
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.
libMesh::libmesh_real
T libmesh_real(T a)
Definition: libmesh_common.h:166
libMesh::MeshFunction
This class provides function-like objects for data distributed over a mesh.
Definition: mesh_function.h:53
libMesh::JACOBI
Definition: enum_solver_type.h:46
libMesh::DofObject::set_id
dof_id_type & set_id()
Definition: dof_object.h:776
libMesh::MeshBase::elem_ref
virtual const Elem & elem_ref(const dof_id_type i) const
Definition: mesh_base.h:521
libMesh::IDENTITY_PRECOND
Definition: enum_preconditioner_type.h:34
SystemsTest::testProjectMatrix3D
void testProjectMatrix3D(const ElemType elem_type)
Definition: systems_test.C:1310
libMesh::SERIAL
Definition: enum_parallel_type.h:35
assemble_matrix_and_rhs
void assemble_matrix_and_rhs(EquationSystems &es, const std::string &system_name)
Definition: systems_test.C:109
libMesh::NumericVector::init
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.
libMesh::MeshTools::Generation::build_cube
void build_cube(UnstructuredMesh &mesh, const unsigned int nx=0, const unsigned int ny=0, const unsigned int nz=0, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const Real zmin=0., const Real zmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
Builds a (elements) cube.
Definition: mesh_generation.C:298
libMesh::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::SparseMatrix::linfty_norm
virtual Real linfty_norm() const =0
libMesh::LinearImplicitSystem::solve
virtual void solve() override
Assembles & solves the linear system A*x=b.
Definition: linear_implicit_system.C:108
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::DofMap::end_old_dof
dof_id_type end_old_dof(const processor_id_type proc) const
Definition: dof_map.h:715
libMesh::MeshBase::node_ptr
virtual const Node * node_ptr(const dof_id_type i) const =0
disc_thirds_test
Number disc_thirds_test(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: systems_test.C:356
libMesh::boundary_id_type
int8_t boundary_id_type
Definition: id_types.h:51
libMesh::System::local_dof_indices
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 ...
Definition: system.C:1259
libMesh::MeshBase::elements_begin
virtual element_iterator elements_begin()=0
Iterate over all the elements in the Mesh.
libMesh::SparseMatrix
Generic sparse matrix.
Definition: vector_fe_ex5.C:45
TripleFunction::offset
Number offset
Definition: systems_test.C:412
libMesh::TET4
Definition: enum_elem_type.h:45
libMesh::ReplicatedMesh
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
Definition: replicated_mesh.h:47
libMesh::NumericVector
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
Definition: vector_fe_ex5.C:43
TripleFunction
Definition: systems_test.C:369
libMesh::MeshBase::element_ptr_range
virtual SimpleRange< element_iterator > element_ptr_range()=0
libMesh::MeshRefinement
Implements (adaptive) mesh refinement algorithms for a MeshBase.
Definition: mesh_refinement.h:61
libMesh::MeshTools::Generation::build_square
void build_square(UnstructuredMesh &mesh, const unsigned int nx, const unsigned int ny, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 2D meshes.
Definition: mesh_generation.C:1501
libMesh::System::attach_assemble_function
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.
Definition: system.C:1755
libMesh::DofMap::distribute_dofs
void distribute_dofs(MeshBase &)
Distribute dofs on the current mesh.
Definition: dof_map.C:910
libMesh::HEX27
Definition: enum_elem_type.h:49
libMesh::DofMap::local_variable_indices
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...
Definition: dof_map.C:1084
libMesh::LinearSolver::set_solver_type
void set_solver_type(const SolverType st)
Sets the type of solver to use.
Definition: linear_solver.h:126
libMesh::LinearImplicitSystem::get_linear_solver
virtual LinearSolver< Number > * get_linear_solver() const override
Definition: linear_implicit_system.C:353
libMesh::MeshBase::node_ptr_range
virtual SimpleRange< node_iterator > node_ptr_range()=0
new_linear_test
Number new_linear_test(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: systems_test.C:343
libMesh::ParallelObject::processor_id
processor_id_type processor_id() const
Definition: parallel_object.h:106
libMesh::TransientSystem::older_local_solution
std::unique_ptr< NumericVector< Number > > older_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: transient_system.h:127
libMesh::System::add_variable
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.
Definition: system.C:1069
libMesh::MeshBase::local_node_ptr_range
virtual SimpleRange< node_iterator > local_node_ptr_range()=0
libMesh::MeshTools::Generation::build_line
void build_line(UnstructuredMesh &mesh, const unsigned int nx, const Real xmin=0., const Real xmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 1D meshes.
Definition: mesh_generation.C:1480
libMesh::QUAD4
Definition: enum_elem_type.h:41
TestCommWorld
libMesh::Parallel::Communicator * TestCommWorld
Definition: driver.C:111
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::NodeElem
The NodeElem is a point element, generally used as a side of a 1D element.
Definition: node_elem.h:37
libMesh::TRI3
Definition: enum_elem_type.h:39
libMesh::Node
A Node is like a Point, but with more information.
Definition: node.h:52
libMesh::CONSTANT
Definition: enum_order.h:41
libMesh::Tet4
The Tet4 is an element in 3D composed of 4 nodes.
Definition: cell_tet4.h:53
libMesh::ZeroFunction
ConstFunction that simply returns 0.
Definition: zero_function.h:36
libMesh::SparseMatrix::add
virtual void add(const numeric_index_type i, const numeric_index_type j, const T value)=0
Add value to the element (i,j).
SystemsTest::testProjectSquare
void testProjectSquare(const ElemType elem_type)
Definition: systems_test.C:570
libMesh::HIERARCHIC
Definition: enum_fe_family.h:37
libMesh::MONOMIAL
Definition: enum_fe_family.h:39
libMesh::EquationSystems
This is the EquationSystems class.
Definition: equation_systems.h:74
libMesh::Elem::set_node
virtual Node *& set_node(const unsigned int i)
Definition: elem.h:2059
libMesh::DofMap::n_dofs_on_processor
dof_id_type n_dofs_on_processor(const processor_id_type proc) const
Definition: dof_map.h:641
libMesh::MeshBase::n_nodes
virtual dof_id_type n_nodes() const =0
libMesh::TRI6
Definition: enum_elem_type.h:40
libMesh::ExplicitSystem
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems.
Definition: explicit_system.h:48
SystemsTest::testProjectMatrix1D
void testProjectMatrix1D(const ElemType elem_type)
Definition: systems_test.C:1044
libMesh::MeshBase::sub_point_locator
std::unique_ptr< PointLocatorBase > sub_point_locator() const
Definition: mesh_base.C:672
libMesh::System::solution
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1539
AugmentSparsityOnNodes
Definition: systems_test.C:32
SystemsTest::testProjectCube
void testProjectCube(const ElemType elem_type)
Definition: systems_test.C:626
libMesh::System::point_value
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
Definition: system.C:1971
libMesh::SparseMatrix::row_stop
virtual numeric_index_type row_stop() const =0
SystemsTest::testProjectMatrix2D
void testProjectMatrix2D(const ElemType elem_type)
Definition: systems_test.C:1151
libMesh::MeshBase::add_elem
virtual Elem * add_elem(Elem *e)=0
Add elem e to the end of the element array.
libMesh::Elem::subdomain_id
subdomain_id_type subdomain_id() const
Definition: elem.h:2069
libMesh::BoundaryInfo::add_edge
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.
Definition: boundary_info.C:707
libMesh::System::projection_matrix
void projection_matrix(SparseMatrix< Number > &proj_mat) const
This method creates a projection matrix which corresponds to the operation of project_vector between ...
Definition: system_projection.C:870
libMesh::MeshBase::elements_end
virtual element_iterator elements_end()=0
libMesh::EDGE3
Definition: enum_elem_type.h:36
libMesh::Edge2
The Edge2 is an element in 1D composed of 2 nodes.
Definition: edge_edge2.h:43
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::LinearSolver::set_preconditioner_type
void set_preconditioner_type(const PreconditionerType pct)
Sets the type of preconditioner to use.
Definition: linear_solver.C:108
libMesh::L2_LAGRANGE
Definition: enum_fe_family.h:41
libMesh::THIRD
Definition: enum_order.h:44
libMesh::MeshTools::Subdivision::prev
static const unsigned int prev[3]
A lookup table for the decrement modulo 3 operation, for iterating through the three nodes per elemen...
Definition: mesh_subdivision_support.h:108
libMesh::QUAD9
Definition: enum_elem_type.h:43
libMesh::System::get_dof_map
const DofMap & get_dof_map() const
Definition: system.h:2099
libMesh::System::n_dofs
dof_id_type n_dofs() const
Definition: system.C:150
libMesh::MeshBase::add_point
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.
libMesh::SparseMatrix::set
virtual void set(const numeric_index_type i, const numeric_index_type j, const T value)=0
Set the element (i,j) to value.
libMesh::LAGRANGE
Definition: enum_fe_family.h:36
SystemsTest::testProjectLine
void testProjectLine(const ElemType elem_type)
Definition: systems_test.C:516
libMesh::TestClass
Definition: id_types.h:33
libMesh::MeshBase::allow_renumbering
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use.
Definition: mesh_base.h:1025
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::MeshBase::prepare_for_use
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.
Definition: mesh_base.C:318
libMesh::TransientSystem::old_local_solution
std::unique_ptr< NumericVector< Number > > old_local_solution
All the values I need to compute my contribution to the simulation at hand.
Definition: transient_system.h:119
libMesh::LinearImplicitSystem
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
Definition: linear_implicit_system.h:55
libMesh::System::get_all_variable_numbers
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...
Definition: system.C:1240
libMesh::System::project_solution
void project_solution(FunctionBase< Number > *f, FunctionBase< Gradient > *g=nullptr) const
Projects arbitrary functions onto the current solution.
Definition: system_projection.C:950
libMesh::BoundaryInfo::has_boundary_id
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
Definition: boundary_info.C:972
libMesh::Elem::node_ptr
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:2009
libMesh::DofMap::first_old_dof
dof_id_type first_old_dof(const processor_id_type proc) const
Definition: dof_map.h:660
libMesh::System::solve
virtual void solve()
Solves the system.
Definition: system.h:334
SystemsTest::tripleValueTest
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 &param)
Definition: systems_test.C:459
libMesh::FIRST
Definition: enum_order.h:42
assembly_with_dg_fem_context
void assembly_with_dg_fem_context(EquationSystems &es, const std::string &)
Definition: systems_test.C:187
libMesh::EDGE2
Definition: enum_elem_type.h:35
SystemsTest::testProjectCubeWithMeshFunction
void testProjectCubeWithMeshFunction(const ElemType elem_type)
Definition: systems_test.C:684
libMesh::SparseMatrix::row_start
virtual numeric_index_type row_start() const =0
libMesh::DofMap::add_coupling_functor
void add_coupling_functor(GhostingFunctor &coupling_functor, bool to_mesh=true)
Adds a functor which can specify coupling requirements for creation of sparse matrices.
Definition: dof_map.C:1838