diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 8bd0b8c5..35819a0e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -20,6 +20,8 @@ Changelog](http://keepachangelog.com/en/1.0.0/). - Renamed getMfemSparseMatrix() to getJacobianSparseMatrix() and getCSRMatrix() to getJacobianCSRMatrix() to avoid confusion with the separate new MFEM interface. +- Logging refactor using SLIC macros. Lots of warnings were demoted to DEBUG level. +- Changed various computational geometry routines to return a FaceGeomError enum error handling ### Fixed - Allow null velocity and response pointers for various use cases diff --git a/src/tests/tribol_common_plane_gap_rate.cpp b/src/tests/tribol_common_plane_gap_rate.cpp index 599b5f00..4a9d54a1 100644 --- a/src/tests/tribol_common_plane_gap_rate.cpp +++ b/src/tests/tribol_common_plane_gap_rate.cpp @@ -341,6 +341,8 @@ TEST_F( CommonPlaneTest, constant_rate_penetration ) checkPressures( couplingScheme, pressure, 1.E-8, "rate" ); checkForceSense( couplingScheme ); // note: the kinematic and rate contributions are not separated + tribol::finalize(); + } // end test 'rate_penetration' TEST_F( CommonPlaneTest, constant_rate_separation ) @@ -436,6 +438,8 @@ TEST_F( CommonPlaneTest, constant_rate_separation ) checkPressures( couplingScheme, pressure, 1.E-8, "rate" ); checkForceSense( couplingScheme ); // note: the kinematic and rate contributions aren't separated + tribol::finalize(); + } // end test 'rate_separation' TEST_F( CommonPlaneTest, no_gap_constant_rate_penetration ) @@ -527,6 +531,8 @@ TEST_F( CommonPlaneTest, no_gap_constant_rate_penetration ) real rate_gap = velZ2 - velZ1; real pressure = (gap < 0. && rate_gap < 0.) ? penalty * rate_gap : 0.; checkPressures( couplingScheme, pressure, 1.E-8, "rate" ); + + tribol::finalize(); } TEST_F( CommonPlaneTest, percent_rate_penetration ) @@ -621,6 +627,8 @@ TEST_F( CommonPlaneTest, percent_rate_penetration ) checkPressures( couplingScheme, pressure, 1.E-8, "rate" ); checkForceSense( couplingScheme ); // note: the kinematic and rate contributions are not separated + tribol::finalize(); + } // end test 'rate_penetration' TEST_F( CommonPlaneTest, percent_rate_separation ) @@ -717,6 +725,8 @@ TEST_F( CommonPlaneTest, percent_rate_separation ) checkPressures( couplingScheme, pressure, 1.E-8, "rate" ); checkForceSense( couplingScheme ); // note: the kinematic and rate contributions aren't separated + tribol::finalize(); + } // end test 'rate_separation' TEST_F( CommonPlaneTest, no_gap_percent_rate_penetration ) @@ -808,6 +818,8 @@ TEST_F( CommonPlaneTest, no_gap_percent_rate_penetration ) real rate_gap = velZ2 - velZ1; real pressure = (gap < 0. && rate_gap < 0.) ? penalty * rate_gap : 0.; checkPressures( couplingScheme, pressure, 1.E-8, "rate" ); + + tribol::finalize(); } int main(int argc, char* argv[]) diff --git a/src/tests/tribol_common_plane_penalty.cpp b/src/tests/tribol_common_plane_penalty.cpp index 80458663..e39e6075 100644 --- a/src/tests/tribol_common_plane_penalty.cpp +++ b/src/tests/tribol_common_plane_penalty.cpp @@ -292,9 +292,6 @@ TEST_F( CommonPlaneTest, penetration_gap_check ) parameters.penalty_ratio = false; parameters.const_penalty = 1.0; - std::cout << "penetration gap check before slic test before tribolSetupAndUpdate()" << std::endl; - SLIC_INFO("slic test in penetration gap check before tribolSetupAndUpdate()"); - int test_mesh_update_err = this->m_mesh.tribolSetupAndUpdate( tribol::COMMON_PLANE, tribol::PENALTY, tribol::FRICTIONLESS, false, parameters ); @@ -311,6 +308,8 @@ TEST_F( CommonPlaneTest, penetration_gap_check ) compareGaps( couplingScheme, gap, 1.E-8, "kinematic_penetration" ); + tribol::finalize(); + } TEST_F( CommonPlaneTest, separation_gap_check ) @@ -372,6 +371,7 @@ TEST_F( CommonPlaneTest, separation_gap_check ) compareGaps( couplingScheme, gap, 1.E-8, "kinematic_separation" ); + tribol::finalize(); } TEST_F( CommonPlaneTest, constant_penalty_check ) @@ -438,6 +438,7 @@ TEST_F( CommonPlaneTest, constant_penalty_check ) checkPressures( couplingScheme, pressure, 1.E-8 ); checkForceSense( couplingScheme ); + tribol::finalize(); } TEST_F( CommonPlaneTest, element_penalty_check ) @@ -533,6 +534,7 @@ TEST_F( CommonPlaneTest, element_penalty_check ) checkPressures( couplingScheme, pressure, 1.E-8 ); checkForceSense( couplingScheme ); + tribol::finalize(); } TEST_F( CommonPlaneTest, tied_contact_check ) @@ -596,6 +598,7 @@ TEST_F( CommonPlaneTest, tied_contact_check ) checkPressures( couplingScheme, pressure, 1.E-8 ); checkForceSense( couplingScheme, true ); + tribol::finalize(); } int main(int argc, char* argv[]) diff --git a/src/tests/tribol_comp_geom.cpp b/src/tests/tribol_comp_geom.cpp index ffa70e76..818db297 100644 --- a/src/tests/tribol_comp_geom.cpp +++ b/src/tests/tribol_comp_geom.cpp @@ -122,6 +122,8 @@ TEST_F( CompGeomTest, common_plane_check ) couplingSchemeManager.getCoupling( 0 ); EXPECT_EQ( userSpecifiedNumOverlaps, couplingScheme->getNumActivePairs() ); + + tribol::finalize(); } TEST_F( CompGeomTest, single_mortar_check ) @@ -178,6 +180,7 @@ TEST_F( CompGeomTest, single_mortar_check ) EXPECT_EQ( userSpecifiedNumOverlaps, couplingScheme->getNumActivePairs() ); + tribol::finalize(); } TEST_F( CompGeomTest, poly_area_centroid_1 ) @@ -292,6 +295,213 @@ TEST_F( CompGeomTest, poly_area_centroid_2 ) EXPECT_LE( diff_mag, tol ); } +TEST_F( CompGeomTest, 2d_projections_1 ) +{ + int dim = 2; + int numVerts = 2; + real xy1[dim*numVerts]; + real xy2[dim*numVerts]; + + +// Notice how the face vertices are flipped between register mesh and the segment basis eval! + +//registerMesh() face 1 x: 1, 0.75, 0.744548 +//registerMesh() face 1 y: 1, 0, 0.0902704 +//registerMesh() face 1 x: 2, 0.744548, 0.75 +//registerMesh() face 1 y: 2, 0.0902704, 0 +//(x0,y0) and (x1,y1): (0.744548, 0.0902704), (0.75, 0). +//(px,py): (0.735935, 0.136655) +//SegmentBasis: phi is 1.51907 not between 0. and 1. +//(x0,y0) and (x1,y1): (0.75, 0), (0.744548, 0.0902704). +//(px,py): (0.735935, 0.136655) +//SegmentBasis: phi is 1.51907 not between 0. and 1. + + // TODO update to use these face coordinates from testing +// xy1[0] = 0.75; +// xy1[1] = 0. ; +// xy1[2] = 0.744548; +// xy1[3] = 0.0902704; +// +// xy2[0] = 0.744548; +// xy2[1] = 0.0902704; +// xy2[2] = 0.75; +// xy2[3] = 0.; + + // this geometry should be in contact + xy1[0] = 0.75; + xy1[1] = 0.; + xy1[2] = 0.727322; + xy1[3] = 0.183039; + + xy2[0] = 0.72705; + xy2[1] = 0.182971; + xy2[2] = 0.75; + xy2[3] = 0.; + + // compute face normal + real faceNormal1[dim]; + real faceNormal2[dim]; + + real lambdaX1 = xy1[2]-xy1[0]; + real lambdaY1 = xy1[3]-xy1[1]; + + faceNormal1[0] = lambdaY1; + faceNormal1[1] = -lambdaX1; + + real lambdaX2 = xy2[2]-xy2[0]; + real lambdaY2 = xy2[3]-xy2[1]; + + faceNormal2[0] = lambdaY2; + faceNormal2[1] = -lambdaX2; + + real cxf1[3] = {0., 0., 0.}; + real cxf2[3] = {0., 0., 0.}; + + tribol::VertexAvgCentroid( xy1, dim, numVerts, cxf1[0], cxf1[1], cxf1[2] ); + tribol::VertexAvgCentroid( xy2, dim, numVerts, cxf2[0], cxf2[1], cxf2[2] ); + + // average the vertex averaged centroids of each face to get a pretty good + // estimate of the common plane centroid + real cx[dim]; + cx[0] = 0.5*(cxf1[0] + cxf2[0]); + cx[1] = 0.5*(cxf1[1] + cxf2[1]); + + real cxProj1[3] = {0., 0., 0.}; + real cxProj2[3] = {0., 0., 0.}; + + tribol::ProjectPointToSegment( cx[0], cx[1], faceNormal1[0], faceNormal1[1], + cxf1[0], cxf1[1], cxProj1[0], cxProj1[1] ); + tribol::ProjectPointToSegment( cx[0], cx[1], faceNormal2[0], faceNormal2[1], + cxf2[0], cxf2[1], cxProj2[0], cxProj2[1] ); + + real diffx1 = std::abs(cxProj1[0] - 0.738595); + real diffy1 = std::abs(cxProj1[1] - 0.0915028); + real diffx2 = std::abs(cxProj2[0] - 0.738591); + real diffy2 = std::abs(cxProj2[1] - 0.0915022); + EXPECT_LE(diffx1, 1.e-6); + EXPECT_LE(diffy1, 1.e-6); + EXPECT_LE(diffx2, 1.e-6); + EXPECT_LE(diffy2, 1.e-6); + + // check with call to tribol::update() + tribol::CommType problem_comm = TRIBOL_COMM_WORLD; + tribol::initialize( 2, problem_comm ); + + real x1[numVerts]; + real y1[numVerts]; + real x2[numVerts]; + real y2[numVerts]; + + for (int i=0; iinit(); - + EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, aligned_mortar_2D ) @@ -276,6 +278,8 @@ TEST_F( CouplingSchemeTest, aligned_mortar_2D ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, mortar_weights_2D ) @@ -302,6 +306,8 @@ TEST_F( CouplingSchemeTest, mortar_weights_2D ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, single_mortar_3D_penalty ) @@ -336,6 +342,8 @@ TEST_F( CouplingSchemeTest, single_mortar_3D_penalty ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, common_plane_lagrange_multiplier ) @@ -388,6 +396,8 @@ TEST_F( CouplingSchemeTest, mortar_no_nodal_gaps_or_pressures ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, mortar_tied ) @@ -422,6 +432,8 @@ TEST_F( CouplingSchemeTest, mortar_tied ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, mortar_coulomb ) @@ -456,6 +468,8 @@ TEST_F( CouplingSchemeTest, mortar_coulomb ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, common_plane_tied ) @@ -486,6 +500,8 @@ TEST_F( CouplingSchemeTest, common_plane_tied ) bool isInit = scheme->init(); EXPECT_EQ( isInit, true ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, common_plane_coulomb ) @@ -516,6 +532,8 @@ TEST_F( CouplingSchemeTest, common_plane_coulomb ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, non_null_to_null_meshes ) @@ -663,11 +681,11 @@ TEST_F( CouplingSchemeTest, non_null_to_null_meshes ) EXPECT_EQ(tribol::update(1, 1., dt), 0); EXPECT_EQ(cs_null->getNumActivePairs(), 0); + tribol::finalize(); } TEST_F( CouplingSchemeTest, invalid_mesh_in_coupling_scheme ) { - // TODO finish this test tribol::CommType problem_comm = TRIBOL_COMM_WORLD; tribol::initialize( 3, problem_comm ); @@ -732,6 +750,8 @@ TEST_F( CouplingSchemeTest, invalid_mesh_in_coupling_scheme ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, finalize ) @@ -872,6 +892,8 @@ TEST_F( CouplingSchemeTest, null_velocity_kinematic_penalty ) bool isInit = scheme->init(); EXPECT_EQ( isInit, true ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, null_velocity_kinematic_and_rate_penalty ) @@ -910,6 +932,8 @@ TEST_F( CouplingSchemeTest, null_velocity_kinematic_and_rate_penalty ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, mortar_weights_null_response_pointers ) @@ -938,6 +962,8 @@ TEST_F( CouplingSchemeTest, mortar_weights_null_response_pointers ) bool isInit = scheme->init(); EXPECT_EQ( isInit, true ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, single_mortar_null_response_pointers ) @@ -966,6 +992,8 @@ TEST_F( CouplingSchemeTest, single_mortar_null_response_pointers ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, common_plane_null_response_pointers ) @@ -998,6 +1026,8 @@ TEST_F( CouplingSchemeTest, common_plane_null_response_pointers ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } TEST_F( CouplingSchemeTest, null_mesh_with_null_pointers ) @@ -1038,6 +1068,8 @@ TEST_F( CouplingSchemeTest, null_mesh_with_null_pointers ) bool isInit = scheme->init(); EXPECT_EQ( isInit, false ); + + tribol::finalize(); } int main(int argc, char* argv[]) @@ -1047,7 +1079,6 @@ int main(int argc, char* argv[]) ::testing::InitGoogleTest(&argc, argv); axom::slic::SimpleLogger logger; // create & initialize logger, - tribol::SimpleMPIWrapper wrapper(argc, argv); // initialize and finalize MPI, when applicable result = RUN_ALL_TESTS(); diff --git a/src/tests/tribol_enforcement_options.cpp b/src/tests/tribol_enforcement_options.cpp index f4702396..9018f6b2 100644 --- a/src/tests/tribol_enforcement_options.cpp +++ b/src/tests/tribol_enforcement_options.cpp @@ -53,6 +53,9 @@ class EnforcementOptionsTest : public ::testing::Test // Setup boiler plate data and register mesh, nodal response, and coupling scheme void SetupTest( tribol::TestMesh* mesh ) { + tribol::CommType problem_comm = TRIBOL_COMM_WORLD; + tribol::initialize( 3, problem_comm ); + //////////////////////////////////////////////// // setup simple non-null contacting test mesh // //////////////////////////////////////////////// @@ -161,9 +164,6 @@ class EnforcementOptionsTest : public ::testing::Test // Coupling schemes with errors TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_error ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -184,14 +184,13 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_error ) EXPECT_EQ( isInit, false ); + tribol::finalize(); + delete mesh; } TEST_F( EnforcementOptionsTest, penalty_kinematic_element_error ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -221,6 +220,8 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_element_error ) EXPECT_EQ( isInit, false ); + tribol::finalize(); + delete bulk_modulus_1; delete bulk_modulus_2; delete element_thickness_1; @@ -230,9 +231,6 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_element_error ) TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_constant_error ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -258,14 +256,13 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_constant_error ) EXPECT_EQ( isInit, false ); + tribol::finalize(); + delete mesh; } TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_percent_error_1 ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -291,14 +288,13 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_percent_error_1 EXPECT_EQ( isInit, false ); + tribol::finalize(); + delete mesh; } TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_percent_error_2 ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -324,6 +320,8 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_percent_error_2 EXPECT_EQ( isInit, false ); + tribol::finalize(); + delete mesh; } @@ -331,9 +329,6 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_percent_error_2 // Coupling schemes with no errors TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_pass ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -353,14 +348,13 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_pass ) EXPECT_EQ( isInit, true ); + tribol::finalize(); + delete mesh; } TEST_F( EnforcementOptionsTest, penalty_kinematic_element_pass ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -389,6 +383,8 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_element_pass ) EXPECT_EQ( isInit, true ); + tribol::finalize(); + delete bulk_modulus_1; delete bulk_modulus_2; delete element_thickness_1; @@ -398,9 +394,6 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_element_pass ) TEST_F( EnforcementOptionsTest, penalty_kinematic_element_invalid_element_input ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -429,6 +422,8 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_element_invalid_element_input EXPECT_EQ( isInit, false ); + tribol::finalize(); + delete bulk_modulus_1; delete bulk_modulus_2; delete element_thickness_1; @@ -438,9 +433,6 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_element_invalid_element_input TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_constant_pass ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -465,14 +457,13 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_constant_pass ) EXPECT_EQ( isInit, true ); + tribol::finalize(); + delete mesh; } TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_percent_pass ) { - tribol::CommType problem_comm = TRIBOL_COMM_WORLD; - tribol::initialize( 2, problem_comm ); - // Setup boiler plate test data etc. tribol::TestMesh* mesh = new tribol::TestMesh(); SetupTest(mesh); @@ -497,6 +488,8 @@ TEST_F( EnforcementOptionsTest, penalty_kinematic_constant_rate_percent_pass ) EXPECT_EQ( isInit, true ); + tribol::finalize(); + delete mesh; } @@ -507,7 +500,6 @@ int main(int argc, char* argv[]) ::testing::InitGoogleTest(&argc, argv); axom::slic::SimpleLogger logger; // create & initialize logger, - tribol::SimpleMPIWrapper wrapper(argc, argv); // initialize and finalize MPI, when applicable result = RUN_ALL_TESTS(); diff --git a/src/tests/tribol_mortar_data_geom.cpp b/src/tests/tribol_mortar_data_geom.cpp index a4394e4b..ad6f7251 100644 --- a/src/tests/tribol_mortar_data_geom.cpp +++ b/src/tests/tribol_mortar_data_geom.cpp @@ -166,7 +166,7 @@ TEST_F( MortarGeomTest, mortar_good_patch ) } // initialize - int err = Initialize( 3, true ); + int err = Initialize( 3 ); // setup simple coupling SimpleCouplingSetup( 3, @@ -280,7 +280,7 @@ TEST_F( MortarGeomTest, mortar_bad_patch ) } // initialize - int err = Initialize( 3, true ); + int err = Initialize( 3 ); // setup simple coupling SimpleCouplingSetup( 3, @@ -395,7 +395,7 @@ TEST_F( MortarGeomTest, mortar_ironing ) } // initialize - int err = Initialize( 3, true ); + int err = Initialize( 3 ); // setup simple coupling SimpleCouplingSetup( 3, @@ -554,7 +554,7 @@ TEST_F( MortarGeomTest, mortar_ironing_block_sub_mesh ) } // initialize - int err = Initialize( 3, true ); + int err = Initialize( 3 ); // setup simple coupling SimpleCouplingSetup( 3, diff --git a/src/tests/tribol_mortar_data_weights.cpp b/src/tests/tribol_mortar_data_weights.cpp index 60b1ffb2..edaa30bc 100644 --- a/src/tests/tribol_mortar_data_weights.cpp +++ b/src/tests/tribol_mortar_data_weights.cpp @@ -69,17 +69,15 @@ void TestMortarWeights( tribol::CouplingScheme const * cs, double exact_area, do EXPECT_EQ( csr_err, 0 ); - if (I == nullptr) - { - SLIC_ERROR("Mortar wts test, I is null."); - } + SLIC_ERROR_IF(I==nullptr, "Mortar wts test, I is null."); // get mortar node id offset to distinguish mortar from nonmortar column contributions if (mortarMesh.m_sortedSurfaceNodeIds == nullptr) { - SLIC_INFO("computeGapsFromSparseWts(): sorting unique mortar surface node ids."); + SLIC_DEBUG("computeGapsFromSparseWts(): sorting unique mortar surface node ids."); mortarMesh.sortSurfaceNodeIds(); } + int nodeOffset = mortarMesh.m_sortedSurfaceNodeIds[ mortarMesh.m_numSurfaceNodes-1 ] + 1; double area = 0.; @@ -91,21 +89,17 @@ void TestMortarWeights( tribol::CouplingScheme const * cs, double exact_area, do { area += wts[b]; - if ( J[b] < nodeOffset ) // nonmortar/mortar weight - { -// SLIC_INFO("nonmortar/mortar weight for nonmortar node, " << a << " and mortar node, " << J[b] << "."); - } - else // nonmortar/nonmortar weight - { -// SLIC_INFO("nonmortar/nonmortar weight for nonmortar node, " << a << " and mortar node, " << J[b] << "."); - } // end if-block + // nonmortar/mortar weight + //SLIC_DEBUG_IF(J[b] < nodeOffset, "nonmortar/mortar weight for nonmortar node, " << a << " and mortar node, " << J[b] << "."); + //nonmortar/nonmortar weight + //SLIC_DEBUG_IF(J[b] >= nodeOffset, "nonmortar/nonmortar weight for nonmortar node, " << a << " and mortar node, " << J[b] << "."); } // end loop over nonzero columns, I[a] } // end loop over matrix rows area /= 2.; - SLIC_INFO("area: " << area << "."); + SLIC_DEBUG("area: " << area << "."); double diff = std::abs( area - exact_area ); EXPECT_LE( diff, tol ); @@ -205,7 +199,7 @@ TEST_F( MortarSparseWtsTest, mortar_sphere ) i_ys.close(); i_zs.close(); - SLIC_INFO("After loading mesh data and constructing mfem vectors."); + SLIC_DEBUG("After loading mesh data and constructing mfem vectors."); // get pointers to mfem vector data int* ixm_data = this->v_ixm.GetData(); @@ -234,7 +228,7 @@ TEST_F( MortarSparseWtsTest, mortar_sphere ) } // initialize - int err = Initialize( 3, true ); + int err = Initialize( 3 ); // setup simple coupling SimpleCouplingSetup( 3, @@ -319,7 +313,7 @@ TEST_F( MortarSparseWtsTest, mortar_sphere_offset ) i_ys.close(); i_zs.close(); - SLIC_INFO("After loading mesh data and constructing mfem vectors."); + SLIC_DEBUG("After loading mesh data and constructing mfem vectors."); // get pointers to mfem vector data int* ixm_data = this->v_ixm.GetData(); @@ -348,7 +342,7 @@ TEST_F( MortarSparseWtsTest, mortar_sphere_offset ) } // initialize - int err = Initialize( 3, true ); + int err = Initialize( 3 ); // setup simple coupling SimpleCouplingSetup( 3, @@ -433,7 +427,7 @@ TEST_F( MortarSparseWtsTest, mortar_one_seg_rotated ) i_ys.close(); i_zs.close(); - SLIC_INFO("After loading mesh data and constructing mfem vectors."); + SLIC_DEBUG("After loading mesh data and constructing mfem vectors."); // get pointers to mfem vector data int* ixm_data = this->v_ixm.GetData(); @@ -462,7 +456,7 @@ TEST_F( MortarSparseWtsTest, mortar_one_seg_rotated ) } // initialize - int err = Initialize( 3, true ); + int err = Initialize( 3 ); // setup simple coupling SimpleCouplingSetup( 3, diff --git a/src/tests/tribol_mortar_force.cpp b/src/tests/tribol_mortar_force.cpp index 6946c429..4275ba7f 100644 --- a/src/tests/tribol_mortar_force.cpp +++ b/src/tests/tribol_mortar_force.cpp @@ -720,7 +720,6 @@ int main(int argc, char* argv[]) ::testing::InitGoogleTest(&argc, argv); axom::slic::SimpleLogger logger; // create & initialize logger, - tribol::SimpleMPIWrapper wrapper(argc, argv); // initialize and finalize MPI, when applicable result = RUN_ALL_TESTS(); diff --git a/src/tests/tribol_mortar_gap.cpp b/src/tests/tribol_mortar_gap.cpp index 166fdc46..1ca0042f 100644 --- a/src/tests/tribol_mortar_gap.cpp +++ b/src/tests/tribol_mortar_gap.cpp @@ -163,6 +163,9 @@ class MortarGapTest : public ::testing::Test } } + tribol::CommType problem_comm = TRIBOL_COMM_WORLD; + tribol::initialize( 3, problem_comm ); + const int mortarMeshId = 0; const int nonmortarMeshId = 1; @@ -226,6 +229,8 @@ class MortarGapTest : public ::testing::Test SLIC_ERROR("Unsupported contact method"); break; } + + tribol::finalize(); } protected: diff --git a/src/tests/tribol_mortar_jacobian.cpp b/src/tests/tribol_mortar_jacobian.cpp index e325f1fc..c72d4ede 100644 --- a/src/tests/tribol_mortar_jacobian.cpp +++ b/src/tests/tribol_mortar_jacobian.cpp @@ -187,7 +187,7 @@ class MortarJacTest : public ::testing::Test int tribol_update_err = tribol::update( 1, 1., dt ); EXPECT_EQ( tribol_update_err, 0 ); - + } protected: @@ -349,6 +349,8 @@ TEST_F( MortarJacTest, jac_input_test ) nonmortarMesh.m_nodalFields.m_node_pressure = nullptr; } + tribol::finalize(); + // delete the jacobian matrix delete jac; @@ -472,7 +474,6 @@ int main(int argc, char* argv[]) ::testing::InitGoogleTest(&argc, argv); axom::slic::SimpleLogger logger; // create & initialize logger, - tribol::SimpleMPIWrapper wrapper(argc, argv); // initialize and finalize MPI, when applicable result = RUN_ALL_TESTS(); diff --git a/src/tests/tribol_mortar_lm_patch_test.cpp b/src/tests/tribol_mortar_lm_patch_test.cpp index b273b933..cee9cffd 100644 --- a/src/tests/tribol_mortar_lm_patch_test.cpp +++ b/src/tests/tribol_mortar_lm_patch_test.cpp @@ -240,12 +240,9 @@ void MortarLMPatchTest::computeContactSolution( int nMortarElemsX, int nMortarEl jac.ToDenseMatrix(dJac); int rank = dJac.Rank(1.e-15); - SLIC_INFO( "Matrix rank: " << rank ); + SLIC_DEBUG( "Matrix rank: " << rank ); - if (rank < numRows) - { - SLIC_ERROR("Jacobian rank (" << rank << ") less than row dimension (" << numRows << ")" ); - } + SLIC_ERROR_IF(rankm_mesh.fz2[ offset + i ]; } pressure_rel_error = nonmortarForceSum; - SLIC_INFO("NODAL FORCE SUM (NONMORTAR, TRIBOL RESIDUALS): " << nonmortarForceSum); + SLIC_DEBUG("NODAL FORCE SUM (NONMORTAR, TRIBOL RESIDUALS): " << nonmortarForceSum); } // update nodal coordinates in separate stacked array. Keep original @@ -523,7 +520,7 @@ TEST_F( MortarLMPatchTest, single_mortar_uniform_patch ) } double press_tol = 1.e-2; // 0.02% error in pressure - SLIC_INFO( "press_rel_error: " << press_rel_error ); + SLIC_DEBUG( "press_rel_error: " << press_rel_error ); EXPECT_LE( std::abs(press_rel_error), press_tol ); } @@ -610,7 +607,7 @@ TEST_F( MortarLMPatchTest, single_mortar_nonuniform_mortar_fine_patch ) } double press_tol = 5.e-3; // 0.5% error in pressure - SLIC_INFO( "press_rel_error: " << press_rel_error ); + SLIC_DEBUG( "press_rel_error: " << press_rel_error ); EXPECT_LE( std::abs(press_rel_error), press_tol ); } @@ -694,7 +691,7 @@ TEST_F( MortarLMPatchTest, single_mortar_nonuniform_nonmortar_fine_patch ) } double press_tol = 1.e-7; - SLIC_INFO( "press_rel_error: " << press_rel_error ); + SLIC_DEBUG( "press_rel_error: " << press_rel_error ); EXPECT_LE( std::abs(press_rel_error), press_tol ); } @@ -778,7 +775,7 @@ TEST_F( MortarLMPatchTest, aligned_mortar_patch ) } double press_tol = 1.e-7; - SLIC_INFO( "press_rel_error: " << press_rel_error ); + SLIC_DEBUG( "press_rel_error: " << press_rel_error ); EXPECT_LE( std::abs(press_rel_error), press_tol ); } diff --git a/src/tests/tribol_mortar_sparse_weights.cpp b/src/tests/tribol_mortar_sparse_weights.cpp index 24d66c03..923f6975 100644 --- a/src/tests/tribol_mortar_sparse_weights.cpp +++ b/src/tests/tribol_mortar_sparse_weights.cpp @@ -72,15 +72,12 @@ void computeGapsFromSparseWts( tribol::CouplingScheme const * cs, real * gaps ) EXPECT_EQ( csr_err, 0 ); - if (I == nullptr) - { - SLIC_ERROR("Mortar wts test, I is null."); - } + SLIC_ERROR_IF(I==nullptr, "Mortar wts test, I is null."); // get mortar node id offset to distinguish mortar from nonmortar column contributions if (mortarMesh.m_sortedSurfaceNodeIds == nullptr) { - SLIC_INFO("computeGapsFromSparseWts(): sorting unique mortar surface node ids."); + SLIC_DEBUG("computeGapsFromSparseWts(): sorting unique mortar surface node ids."); mortarMesh.sortSurfaceNodeIds(); } int nodeOffset = mortarMesh.m_sortedSurfaceNodeIds[ mortarMesh.m_numSurfaceNodes-1 ] + 1; @@ -253,6 +250,8 @@ TEST_F( MortarSparseWtsTest, mortar_weights_uniform ) compareGaps( couplingScheme, gaps, 1.E-8 ); + tribol::finalize(); + delete [] gaps; } @@ -319,6 +318,8 @@ TEST_F( MortarSparseWtsTest, simple_api_mortar_weights_uniform ) compareGaps( couplingScheme, gaps, 1.E-8 ); + tribol::finalize(); + delete [] gaps; } @@ -386,6 +387,8 @@ TEST_F( MortarSparseWtsTest, mortar_weights_nonuniform_mortar_fine ) compareGaps( couplingScheme, gaps, 1.E-8 ); + tribol::finalize(); + delete [] gaps; } @@ -453,6 +456,8 @@ TEST_F( MortarSparseWtsTest, mortar_weights_nonuniform_nonmortar_fine ) compareGaps( couplingScheme, gaps, 1.E-8 ); + tribol::finalize(); + delete [] gaps; } diff --git a/src/tests/tribol_tet_mesh.cpp b/src/tests/tribol_tet_mesh.cpp index 63ec70ee..462f4dd3 100644 --- a/src/tests/tribol_tet_mesh.cpp +++ b/src/tests/tribol_tet_mesh.cpp @@ -148,7 +148,7 @@ TEST_F( TetMeshTest, build_and_check_mfem_tet_mesh ) // perform mfem mesh based sanity checks EXPECT_EQ( this->m_mesh.mfem_mesh->SpaceDimension(), 3 ); - SLIC_INFO("number of elements: " << this->m_mesh.mfem_mesh->GetNE() << "."); + SLIC_DEBUG("number of elements: " << this->m_mesh.mfem_mesh->GetNE() << "."); EXPECT_EQ( this->m_mesh.mfem_mesh->GetNE(), this->m_mesh.numMortarElements + this->m_mesh.numNonmortarElements ); EXPECT_EQ( this->m_mesh.mfem_mesh->GetNV(), this->m_mesh.numMortarNodes + this->m_mesh.numNonmortarNodes ); EXPECT_EQ( this->m_mesh.mfem_mesh->GetNFbyType(mfem::FaceType::Boundary), diff --git a/src/tests/tribol_timestep_vote.cpp b/src/tests/tribol_timestep_vote.cpp index 16e0dfa7..3232315a 100644 --- a/src/tests/tribol_timestep_vote.cpp +++ b/src/tests/tribol_timestep_vote.cpp @@ -140,6 +140,8 @@ TEST_F( CommonPlaneTest, zero_velocity_small_gap ) EXPECT_EQ( test_mesh_update_err, 0 ); EXPECT_EQ( parameters.dt, dt ); + + tribol::finalize(); } TEST_F( CommonPlaneTest, zero_velocity_large_gap ) @@ -224,6 +226,8 @@ TEST_F( CommonPlaneTest, zero_velocity_large_gap ) // very large. This is a case where the initial gap is just too large. // Tribol will print a message to screen if this is the case. EXPECT_EQ( parameters.dt, dt ); + + tribol::finalize(); } TEST_F( CommonPlaneTest, large_velocity_small_gap ) @@ -310,6 +314,7 @@ TEST_F( CommonPlaneTest, large_velocity_small_gap ) real dt_tol = 1.e-8; EXPECT_LT( dt_diff, dt_tol ); + tribol::finalize(); } TEST_F( CommonPlaneTest, large_velocity_large_gap ) @@ -396,6 +401,7 @@ TEST_F( CommonPlaneTest, large_velocity_large_gap ) real dt_tol = 1.e-8; EXPECT_LT( dt_diff, dt_tol ); + tribol::finalize(); } TEST_F( CommonPlaneTest, separation_velocity_small_gap ) @@ -478,6 +484,8 @@ TEST_F( CommonPlaneTest, separation_velocity_small_gap ) EXPECT_EQ( test_mesh_update_err, 0 ); EXPECT_EQ( parameters.dt, dt ); + + tribol::finalize(); } TEST_F( CommonPlaneTest, large_velocity_separation ) @@ -562,6 +570,8 @@ TEST_F( CommonPlaneTest, large_velocity_separation ) EXPECT_EQ( test_mesh_update_err, 0 ); EXPECT_EQ( parameters.dt, dt ); + + tribol::finalize(); } TEST_F( CommonPlaneTest, large_velocity_small_separation ) @@ -649,6 +659,8 @@ TEST_F( CommonPlaneTest, large_velocity_small_separation ) real dt_diff = std::abs(parameters.dt - 0.0007499999); real dt_tol = 1.e-8; EXPECT_LT( dt_diff, dt_tol ); + + tribol::finalize(); } int main(int argc, char* argv[]) diff --git a/src/tribol/CMakeLists.txt b/src/tribol/CMakeLists.txt index f4b350f3..1a2de408 100644 --- a/src/tribol/CMakeLists.txt +++ b/src/tribol/CMakeLists.txt @@ -16,7 +16,6 @@ endif() ## list of headers set(tribol_headers - common/logger.hpp common/Parameters.hpp interface/mfem_tribol.hpp diff --git a/src/tribol/common/Parameters.hpp b/src/tribol/common/Parameters.hpp index 8aaafb74..43cb239e 100644 --- a/src/tribol/common/Parameters.hpp +++ b/src/tribol/common/Parameters.hpp @@ -30,6 +30,19 @@ inline bool in_range( integer target, integer N ) constexpr integer ANY_MESH = -1; +/*! + * \brief Enumerates the logging level options + */ +enum LoggingLevel +{ + UNDEFINED, ///! Undefined + DEBUG, ///! Debug and higher + INFO, ///! Info and higher + WARNING, ///! Warning and higher + ERROR, ///! Errors only + NUM_LOGGING_LEVELS = ERROR +}; + /*! * \brief Enumerates the interface element types */ @@ -275,6 +288,19 @@ enum BasisEvalType NUM_BASIS_EVAL_TYPES = PHYSICAL }; +/*! + * \brief Enumerates face-pair computational geometry errors + */ +enum FaceGeomError +{ + NO_FACE_GEOM_ERROR, + FACE_ORIENTATION, + INVALID_INPUT, + DEGENERATE_OVERLAP, + FACE_INDEX_EXCEEDS_OVERLAP_VERTICES, + NUM_FACE_GEOM_ERRORS +}; + /*! * \brief Enumerates ContactMode errors */ diff --git a/src/tribol/common/logger.hpp b/src/tribol/common/logger.hpp deleted file mode 100644 index c5eb08d8..00000000 --- a/src/tribol/common/logger.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and -// other Tribol Project Developers. See the top-level LICENSE file for details. -// -// SPDX-License-Identifier: (MIT) - -#ifndef COMMON_LOGGER_HPP_ -#define COMMON_LOGGER_HPP_ - -#ifdef USE_SLIC - -#include "axom/slic.hpp" // for logging -#define TRIBOL_ASSERT( x ) SLIC_ASSERT(x) -#define TRIBOL_ERROR(x) SLIC_ERROR(x) -#else - -#define TRIBOL_ASSERT( x ) -#define TRIBOL_ERROR(x) - -#endif - -#endif /* COMMON_LOGGER_HPP_ */ diff --git a/src/tribol/common/types.hpp.in b/src/tribol/common/types.hpp.in index d4193a30..d5b5ea6d 100644 --- a/src/tribol/common/types.hpp.in +++ b/src/tribol/common/types.hpp.in @@ -76,17 +76,6 @@ using containerArray = std::vector; #define CONSTEXPRFUNC constexpr #endif -#ifdef TRIBOL_DEBUG -#define TRIBOL_DEBUG_LOG( msg ) \ - do { \ - std::ostringstream oss; \ - oss << msg; \ - std::cout << oss.str() << std::endl; \ - } while( false ) -#else -#define TRIBOL_DEBUG_LOG( msg ) do{}while(false) -#endif - #define TRIBOL_UNUSED_VAR AXOM_UNUSED_VAR #define TRIBOL_UNUSED_PARAM AXOM_UNUSED_PARAM diff --git a/src/tribol/geom/ContactPlane.cpp b/src/tribol/geom/ContactPlane.cpp index f00377e5..93806348 100644 --- a/src/tribol/geom/ContactPlane.cpp +++ b/src/tribol/geom/ContactPlane.cpp @@ -26,10 +26,12 @@ namespace tribol //------------------------------------------------------------------------------ // free functions //------------------------------------------------------------------------------ -bool CheckInterfacePair( InterfacePair& pair, - ContactMethod const cMethod, - ContactCase const TRIBOL_UNUSED_PARAM(cCase) ) +FaceGeomError CheckInterfacePair( InterfacePair& pair, + ContactMethod const cMethod, + ContactCase const TRIBOL_UNUSED_PARAM(cCase), + bool& inContact ) { + inContact = false; // note: will likely need the ContactCase for specialized // geometry check(s)/routine(s) @@ -46,29 +48,55 @@ bool CheckInterfacePair( InterfacePair& pair, // get instance of contact plane manager to store all contact plane data per cycle ContactPlaneManager& cpMgr = ContactPlaneManager::getInstance(); - bool full = (cMethod == COMMON_PLANE) ? false : true; + // set whether full overlap is to be used or not. Note: SINGLE_MORTAR and + // MORTAR_WEIGHTS drop into this 'case', so the method still needs to be checked + const bool full = (cMethod == COMMON_PLANE) ? false : true; + const bool interpenOverlap = (full) ? false : true; + const bool intermediatePlane = (cMethod == COMMON_PLANE) ? true : false; + real lenFrac = params.overlap_area_frac; + real areaFrac = lenFrac; // Perform contact plane specific computations (2D and 3D) if (params.dimension == 3) { - ContactPlane3D cpTemp = CheckFacePair( pair, cMethod, full ); + ContactPlane3D cpTemp( pair, areaFrac, interpenOverlap, intermediatePlane, 3 ); + FaceGeomError face_err = CheckFacePair( pair, full, cpTemp ); - if (cpTemp.m_inContact) + if (face_err != NO_FACE_GEOM_ERROR) + { + inContact = false; + } + else if (cpTemp.m_inContact) { cpMgr.addContactPlane( cpTemp ); - return true; + inContact = true; } + else + { + inContact = false; + } + return face_err; } else { - ContactPlane2D cpTemp = CheckEdgePair( pair, cMethod, full ); + ContactPlane2D cpTemp( pair, lenFrac, interpenOverlap, intermediatePlane, 2 ); + FaceGeomError edge_err = CheckEdgePair( pair, full, cpTemp ); - if (cpTemp.m_inContact) + if (edge_err != NO_FACE_GEOM_ERROR) + { + inContact = false; + } + else if (cpTemp.m_inContact) { cpMgr.addContactPlane( cpTemp ); - return true; + inContact = true; + } + else + { + inContact = false; } + return edge_err; } break; } @@ -83,13 +111,19 @@ bool CheckInterfacePair( InterfacePair& pair, if (params.dimension == 3) { + // TODO refactor to make consistent with CheckFacePair, SRW ContactPlane3D cpTemp = CheckAlignedFacePair( pair ); if (cpTemp.m_inContact) { cpMgr.addContactPlane( cpTemp ); - return true; + inContact = true; + } + else + { + inContact = false; } + return NO_FACE_GEOM_ERROR; } else { @@ -105,7 +139,7 @@ bool CheckInterfacePair( InterfacePair& pair, } } - return false; + return NO_FACE_GEOM_ERROR; // quiet compiler } // end CheckInterfacePair() @@ -459,18 +493,15 @@ ContactPlane3D::ContactPlane3D() } // end ContactPlane3D::ContactPlane3D() //------------------------------------------------------------------------------ -ContactPlane3D CheckFacePair( InterfacePair& pair, - ContactMethod const method, - bool fullOverlap ) +FaceGeomError CheckFacePair( InterfacePair& pair, + bool fullOverlap, + ContactPlane3D& cp ) { // Note: Checks #1-#4 are done in the binning // get instance of global parameters parameters_t& params = parameters_t::getInstance(); - // get fraction of largest face we keep for overlap area - real areaFrac = params.overlap_area_frac; - // alias variables off the InterfacePair. IndexType& meshId1 = pair.meshId1; IndexType& meshId2 = pair.meshId2; @@ -486,17 +517,6 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, // set overlap booleans based on input arguments and contact method bool interpenOverlap = (!fullOverlap) ? true : false; - bool intermediatePlane = (method == COMMON_PLANE) ? true : false; - - // check to make sure that mortar uses full overlap. This should not be needed -// if ( method == SINGLE_MORTAR || method == ALIGNED_MORTAR || method == MORTAR_WEIGHTS ) -// { -// fullOverlap = true; -// interpenOverlap = false; -// } - - // instantiate temporary contact plane to be returned by this routine - ContactPlane3D cp( pair, areaFrac, interpenOverlap, intermediatePlane, 3 ); // CHECK #5: check if the nodes of face2 interpenetrate the // plane defined by face1 AND vice-versa. For proximate faces @@ -510,17 +530,14 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, bool all = false; bool ls = FaceInterCheck( mesh1, mesh2, faceId1, faceId2, separationTol, all ); if (!ls) { -// SLIC_INFO("CheckFacePair: pair id, " << pair.pairId << " fails FaceInterCheck; not in contact."); cp.m_inContact = false; - return cp; + return NO_FACE_GEOM_ERROR; } // if all vertices of one face lie on the other side of the other face, per // FaceInterCheck computation, then use the full projection. if (all) { - TRIBOL_DEBUG_LOG( "switching from interpenOverlap to fullOverlap.\n" ); - fullOverlap = true; interpenOverlap = false; cp.m_interpenOverlap = interpenOverlap; @@ -532,17 +549,15 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, // compute cp normal and centroid cp.computeNormal(); // this routine handles common plane AND mortar - cp.computePlanePoint(); // this routine handles common plane AND mortar // project face nodes onto contact plane. Still do this for mortar. // The mortar face may not be exactly planar so we still need to project // the nodes onto the contact plane, which is defined by average normal of the - // mortar face. + // nonmortar face. real projX1[ mesh1.m_numNodesPerCell ]; real projY1[ mesh1.m_numNodesPerCell ]; real projZ1[ mesh1.m_numNodesPerCell ]; - real projX2[ mesh2.m_numNodesPerCell ]; real projY2[ mesh2.m_numNodesPerCell ]; real projZ2[ mesh2.m_numNodesPerCell ]; @@ -561,7 +576,6 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, // contact plane 2D coordinate system. real projeX1[ mesh1.m_numNodesPerCell ]; real projeY1[ mesh1.m_numNodesPerCell ]; - real projeX2[ mesh2.m_numNodesPerCell ]; real projeY2[ mesh2.m_numNodesPerCell ]; @@ -583,13 +597,10 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, // compute the overlap area tolerance cp.computeAreaTol(); - TRIBOL_DEBUG_LOG( "full area from checkPolyOverlap: " << cp.m_area << ".\n" ); - TRIBOL_DEBUG_LOG( "minimum area: " << cp.m_areaMin << ".\n" ); - if (cp.m_area == 0. || cp.m_area < cp.m_areaMin) { cp.m_inContact = false; - return cp; + return NO_FACE_GEOM_ERROR; } // CHECK #7: compute the required intersection with overlap polygon vertices @@ -603,22 +614,13 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, // compute the full intersection polygon vertex coordinates real* X1 = &projeX1[0]; real* Y1 = &projeY1[0]; - - // reorder the second face's vertices to be in CCW ordering - real X2[ mesh2.m_numNodesPerCell ]; - real Y2[ mesh2.m_numNodesPerCell ]; - - // set the first vertex the same - X2[0] = projeX2[0]; - Y2[0] = projeY2[0]; - - int k=1; - for (int i=(mesh2.m_numNodesPerCell-1); i>0; --i) - { - X2[k] = projeX2[i]; - Y2[k] = projeY2[i]; - ++k; - } + real* X2 = &projeX2[0]; + real* Y2 = &projeY2[0]; + + // assuming each face's vertices are ordered WRT that face's outward unit normal, + // reorder face 2 vertices to be consistent with face 1. DO NOT CALL POLYREORDER() + // to do this. + PolyReverse( X2, Y2, mesh2.m_numNodesPerCell ); // compute intersection polygon and area. Note, the polygon centroid // is stored from the previous intersection calc that just computes @@ -627,19 +629,22 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, axom::utilities::max( mesh1.m_faceRadius[ faceId1 ], mesh2.m_faceRadius[ faceId2 ] ); real len_tol = pos_tol; - Intersection2DPolygon( X1, Y1, mesh1.m_numNodesPerCell, - X2, Y2, mesh2.m_numNodesPerCell, - pos_tol, len_tol, &cp.m_polyLocX, - &cp.m_polyLocY, cp.m_numPolyVert, - cp.m_area ); + FaceGeomError inter_err = Intersection2DPolygon( X1, Y1, mesh1.m_numNodesPerCell, + X2, Y2, mesh2.m_numNodesPerCell, + pos_tol, len_tol, &cp.m_polyLocX, + &cp.m_polyLocY, cp.m_numPolyVert, + cp.m_area, false ); - TRIBOL_DEBUG_LOG( "full area from Intersection2DPolygon: " << cp.m_area << ".\n" ); + if (inter_err != NO_FACE_GEOM_ERROR) + { + cp.m_inContact = false; + return inter_err; + } if (cp.m_area < cp.m_areaMin) { - TRIBOL_DEBUG_LOG( "full area of overlap less than min after full-overlap calc.\n" ); cp.m_inContact = false; - return cp; + return NO_FACE_GEOM_ERROR; } } // end if (fullOverlap) @@ -655,28 +660,30 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, axom::utilities::max( mesh1.m_faceRadius[ faceId1 ], mesh2.m_faceRadius[ faceId2 ] )); - bool interpen = cp.computeLocalInterpenOverlap(); // same for mortar - - if (!interpen) + bool interpen = false; + FaceGeomError interpen_err = cp.computeLocalInterpenOverlap(interpen); // same for mortar + if (interpen_err != NO_FACE_GEOM_ERROR) { cp.m_inContact = false; - return cp; + return interpen_err; + } + else if (!interpen) + { + cp.m_inContact = false; + return NO_FACE_GEOM_ERROR; } // check new area to area tol if (cp.m_interpenArea == 0 || cp.m_interpenArea < cp.m_areaMin) { - TRIBOL_DEBUG_LOG( "interpen. area less than min after interpen. overlap calc.\n" ); cp.m_inContact = false; - return cp; + return NO_FACE_GEOM_ERROR; } // reassign area based on possible modification to the actual // intersection polygon. cp.m_area = cp.m_interpenArea; - TRIBOL_DEBUG_LOG( "interpen. area: " << cp.m_interpenArea << ".\n" ); - // compute the local vertex averaged centroid of overlapping polygon real z; VertexAvgCentroid( cp.m_polyLocX, cp.m_polyLocY, nullptr, @@ -689,22 +696,18 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, // have been set if (cp.m_polyLocX == nullptr || cp.m_polyLocY == nullptr) { - SLIC_WARNING("cp.m_polyLocX or cp.m_polyLocY not allocated"); + SLIC_ERROR("cp.m_polyLocX or cp.m_polyLocY not allocated"); } - TRIBOL_DEBUG_LOG( "number of intersection polygon vertices: " << cp.m_numPolyVert << ".\n" ); - // handle the case where the actual polygon with connectivity // and computed vertex coordinates becomes degenerate due to // either position tolerances (segment-segment intersections) // or length tolerances (intersecting polygon segment lengths) if (cp.m_numPolyVert < 3) { -// SLIC_INFO("CheckFacePair: pair id, " << pair.pairId << ", has number of overlap vertices less than 3."); - TRIBOL_DEBUG_LOG( "degenerate polygon intersection detected.\n" ); - SLIC_ASSERT(cp.m_numPolyVert < 3); + SLIC_DEBUG( "degenerate polygon intersection detected.\n" ); cp.m_inContact = false; - return cp; + return DEGENERATE_OVERLAP; } // Tranform local vertex coordinates to global coordinates for the @@ -724,7 +727,6 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, cp.m_polyZ[i] ); } - // TODO verify this is correct // check polygonal vertex ordering with common plane normal PolyReorderWithNormal( cp.m_polyX, cp.m_polyY, cp.m_polyZ, cp.m_numPolyVert, cp.m_nX, cp.m_nY, cp.m_nZ ); @@ -782,8 +784,6 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, axom::utilities::max( mesh1.m_faceRadius[ faceId1 ], mesh2.m_faceRadius[ faceId2 ] )); - TRIBOL_DEBUG_LOG( "contact plane gap: " << cp.m_gap << ".\n" ); - // The gap tolerance allows separation up to 50% the largest face-radius. // This is conservative and allows for possible over-inclusion. This is done // for the mortar method per testing. @@ -792,10 +792,8 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, mesh2.m_faceRadius[ faceId2 ] ); if (cp.m_gap > cp.m_gapTol) { -// SLIC_INFO("CheckFacePair: pair id, " << pair.pairId << ", has gap, " << cp.m_gap << ", less than gap tol."); - TRIBOL_DEBUG_LOG( "gap larger than gapTol.\n" ); cp.m_inContact = false; - return cp; + return NO_FACE_GEOM_ERROR; } // if fullOverlap is used, REPROJECT the overlapping polygon @@ -812,7 +810,7 @@ ContactPlane3D CheckFacePair( InterfacePair& pair, } cp.m_inContact = true; - return cp; + return NO_FACE_GEOM_ERROR; } // end CheckFacePair() @@ -1129,7 +1127,9 @@ void ContactPlane3D::computeAreaTol() parameters_t & parameters = parameters_t::getInstance(); if (m_areaFrac < parameters.overlap_area_frac ) { - SLIC_ERROR ( "ContactPlane3D::computeAreaTol the overlap area fraction too small or negative" ); + SLIC_DEBUG( "ContactPlane3D::computeAreaTol() the overlap area fraction too small or negative; " << + "setting to overlap_area_frac parameter." ); + m_areaFrac = parameters.overlap_area_frac; } MeshData& mesh1 = getCpMeshData( m_pair.meshId1 ); @@ -1361,7 +1361,7 @@ void ContactPlane3D::centroidGap( real scale ) } // end ContactPlane3D::centroidGap() //------------------------------------------------------------------------------ -bool ContactPlane3D::computeLocalInterpenOverlap() +FaceGeomError ContactPlane3D::computeLocalInterpenOverlap(bool& interpen) { // for each face, loop over current configuration segments and // determine the two (there should be at most two, or in the odd @@ -1371,6 +1371,7 @@ bool ContactPlane3D::computeLocalInterpenOverlap() // contact plane define the two new polygons whose intersection we // seek. + interpen = false; parameters_t & parameters = parameters_t::getInstance(); real xInter[4]; @@ -1437,9 +1438,14 @@ bool ContactPlane3D::computeLocalInterpenOverlap() const real& y2 = mesh.m_positionY[fNodeIdB]; const real& z2 = mesh.m_positionZ[fNodeIdB]; + meshId = m_pair.meshId1; + fId = m_pair.pairIndex1; if (k > 2) { - SLIC_ERROR ("ContactPlane3D::computeInterpenOverlap : too many segment-plane intersections."); + SLIC_DEBUG("ContactPlane3D::computeInterpenOverlap(): too many segment-plane intersections; " << + "check for degenerate face " << fId << "on mesh " << meshId << "."); + interpen = false; + return DEGENERATE_OVERLAP; } // call segment-to-plane intersection routine @@ -1475,8 +1481,12 @@ bool ContactPlane3D::computeLocalInterpenOverlap() // if we haven't found intersection points, the planes are either separated or coplanar. // return - if (k < 2) return false; - + if (k < 2) + { + interpen = false; + return NO_FACE_GEOM_ERROR; + } + // count the number of vertices for the clipped portion of the i^th face that // interpenetrates the contact plane. numV[i] = k; @@ -1592,24 +1602,26 @@ bool ContactPlane3D::computeLocalInterpenOverlap() m_cX, m_cY, m_cZ, cfx2_loc, cfy2_loc, numV[1] ); - // reorder polygon local vertices in CCW orientation + // reorder potentially unordered set of vertices PolyReorder( cfx1_loc, cfy1_loc, numV[0] ); PolyReorder( cfx2_loc, cfy2_loc, numV[1] ); // call intersection routine to get intersecting polygon - - // first have to reorder the second face's projected local coordinates - // into CCW ordering. - real pos_tol = parameters.len_collapse_ratio * axom::utilities::max( mesh1.m_faceRadius[ m_pair.pairIndex1 ], mesh2.m_faceRadius[ m_pair.pairIndex2 ] ); real len_tol = pos_tol; - Intersection2DPolygon( cfx1_loc, cfy1_loc, numV[0], - cfx2_loc, cfy2_loc, numV[1], - pos_tol, len_tol, &m_polyLocX, - &m_polyLocY, m_numPolyVert, - m_interpenArea ); + FaceGeomError inter_err = Intersection2DPolygon( cfx1_loc, cfy1_loc, numV[0], + cfx2_loc, cfy2_loc, numV[1], + pos_tol, len_tol, &m_polyLocX, + &m_polyLocY, m_numPolyVert, + m_interpenArea, true ); + + if (inter_err != NO_FACE_GEOM_ERROR) + { + interpen = false; + return inter_err; + } // store the local intersection polygons on the contact plane object, // primarily for visualization @@ -1633,7 +1645,8 @@ bool ContactPlane3D::computeLocalInterpenOverlap() m_interpenPoly2Y[i] = cfy2_loc[i]; } - return true; + interpen = true; + return NO_FACE_GEOM_ERROR; } // end ContactPlane3D::computeLocalInterpenOverlap() @@ -1906,17 +1919,15 @@ ContactPlane2D::ContactPlane2D() } // end ContactPlane2D::ContactPlane2D() //------------------------------------------------------------------------------ -ContactPlane2D CheckEdgePair( InterfacePair& pair, - ContactMethod const method, - bool fullOverlap ) +FaceGeomError CheckEdgePair( InterfacePair& pair, + bool fullOverlap, + ContactPlane2D& cp ) { // Note: Checks #1-#4 are done in the binning // get instance of global parameters parameters_t& params = parameters_t::getInstance(); - real lenFrac = params.overlap_area_frac; - // alias variables off the InterfacePair IndexType& meshId1 = pair.meshId1; IndexType& meshId2 = pair.meshId2; @@ -1932,8 +1943,6 @@ ContactPlane2D CheckEdgePair( InterfacePair& pair, // instantiate temporary contact plane to be returned by this routine bool interpenOverlap = (!fullOverlap) ? true : false; - bool intermediatePlane = (method == COMMON_PLANE) ? true : false; - ContactPlane2D cp( pair, lenFrac, interpenOverlap, intermediatePlane, 2 ); // CHECK #5: check if edge2 vertices have passed through edge1, and // vice-versa. If both vertices have done so for either edge, we trigger @@ -1950,7 +1959,7 @@ ContactPlane2D CheckEdgePair( InterfacePair& pair, if (!ls) { cp.m_inContact = false; - return cp; + return NO_FACE_GEOM_ERROR; } // if all the vertices lie on the other side of edge1, then use full @@ -1967,13 +1976,11 @@ ContactPlane2D CheckEdgePair( InterfacePair& pair, // projected length of overlap. cp.computeNormal(); - cp.computePlanePoint(); // project each edge's nodes onto the contact segment. real projX1[ mesh1.m_numNodesPerCell ]; real projY1[ mesh1.m_numNodesPerCell ]; - real projX2[ mesh2.m_numNodesPerCell ]; real projY2[ mesh2.m_numNodesPerCell ]; @@ -1998,7 +2005,7 @@ ContactPlane2D CheckEdgePair( InterfacePair& pair, if (cp.m_area < cp.m_areaMin) { cp.m_inContact = false; - return cp; + return NO_FACE_GEOM_ERROR; } if (interpenOverlap) @@ -2007,11 +2014,17 @@ ContactPlane2D CheckEdgePair( InterfacePair& pair, cp.planePointAndCentroidGap( 2. * axom::utilities::max( mesh1.m_faceRadius[ edgeId1 ], mesh2.m_faceRadius[ edgeId2 ] )); - bool interpen = cp.computeLocalInterpenOverlap(); - if (!interpen) + bool interpen = false; + FaceGeomError interpen_err = cp.computeLocalInterpenOverlap(interpen); + if (interpen_err != NO_FACE_GEOM_ERROR) { cp.m_inContact = false; - return cp; + return interpen_err; + } + else if (!interpen) + { + cp.m_inContact = false; + return NO_FACE_GEOM_ERROR; } } @@ -2034,7 +2047,7 @@ ContactPlane2D CheckEdgePair( InterfacePair& pair, if (cp.m_gap > cp.m_gapTol) { cp.m_inContact = false; - return cp; + return NO_FACE_GEOM_ERROR; } // for the full overlap case we need to project the overlap segment @@ -2073,8 +2086,7 @@ ContactPlane2D CheckEdgePair( InterfacePair& pair, } cp.m_inContact = true; - - return cp; + return NO_FACE_GEOM_ERROR; } // end CheckEdgePair() @@ -2148,8 +2160,13 @@ void ContactPlane2D::computeAreaTol() { // Note: this code is the same as for ContactPlane3D, but maintain separate // routine for 2D treatment. - if (m_areaFrac < 1.E-12) { - SLIC_ERROR ( "ContactPlane2D::computeAreaTol the overlap area fraction too small or negative" ); + parameters_t & parameters = parameters_t::getInstance(); + + if (m_areaFrac < parameters.overlap_area_frac) + { + SLIC_DEBUG( "ContactPlane2D::computeAreaTol() the overlap area fraction too small or negative; " << + "setting to overlap_area_frac parameter." ); + m_areaFrac = parameters.overlap_area_frac; } MeshData& mesh1 = getCpMeshData( m_pair.meshId1 ); @@ -2163,13 +2180,14 @@ void ContactPlane2D::computeAreaTol() } // ContactPlane2D::computeAreaTol() //------------------------------------------------------------------------------ -bool ContactPlane2D::computeLocalInterpenOverlap() +FaceGeomError ContactPlane2D::computeLocalInterpenOverlap(bool& interpen) { // // Note: the contact plane has to be properly located prior to calling // this routine. // + interpen = false; parameters_t & parameters = parameters_t::getInstance(); // all edge-edge interactions suitable for an interpenetration overlap @@ -2212,11 +2230,9 @@ bool ContactPlane2D::computeLocalInterpenOverlap() // is marked true, but the SegmentIntersection2D returns false if (!edgeIntersect && !duplicatePoint) { - SLIC_DEBUG("CheckEdgePair: non-intersecting edges found in interpen " - << "overlap calculation. inter: {"<< xInter <<", " << yInter << "}"); m_interpenArea = 0.0; - return false; - + interpen = false; + return NO_FACE_GEOM_ERROR; } // check if a duplicate point (i.e. vertex) was registered. @@ -2225,7 +2241,8 @@ bool ContactPlane2D::computeLocalInterpenOverlap() if (duplicatePoint) { m_interpenArea = 0.0; - return false; + interpen = false; + return NO_FACE_GEOM_ERROR; } // project unique intersection point to the contact plane. @@ -2275,7 +2292,11 @@ bool ContactPlane2D::computeLocalInterpenOverlap() // Debug check the number of interpenetrating vertices if (k > 2) { - SLIC_ERROR("ContactPlane2D::computeLocalInterpenOverlap more than 2 interpenetrating vertices detected."); + SLIC_DEBUG("ContactPlane2D::computeLocalInterpenOverlap() more than 2 interpenetrating vertices detected; " << + "check for degenerate geometry for edges (" << edgeId1 << ", " << edgeId2 << ") on meshes (" << + mesh1.m_meshId << ", " << mesh2.m_meshId << ")."); + interpen = false; + return DEGENERATE_OVERLAP; } // now that we have marked the interpenetrating vertex of each edge, @@ -2343,7 +2364,8 @@ bool ContactPlane2D::computeLocalInterpenOverlap() m_cX = 0.5 * (m_segX[0] + m_segX[1]); m_cY = 0.5 * (m_segY[0] + m_segY[1]); - return true; + interpen = true; + return NO_FACE_GEOM_ERROR; } m_interpenG1X = nullptr; @@ -2353,7 +2375,8 @@ bool ContactPlane2D::computeLocalInterpenOverlap() m_interpenG1Z = nullptr; m_interpenG2Z = nullptr; - return false; + interpen = false; + return NO_FACE_GEOM_ERROR; } // end ContactPlane2D::computeLocalInterpenOverlap() @@ -2600,8 +2623,8 @@ void ContactPlane2D::checkSegOverlap( const real* const RESTRICT pX1, const real { parameters_t & parameters = parameters_t::getInstance(); - SLIC_ASSERT( nV1 != 2); - SLIC_ASSERT( nV2 != 2); + SLIC_ASSERT( nV1 == 2 ); + SLIC_ASSERT( nV2 == 2 ); // get mesh ids int mesh1Id = getCpMeshId(1); diff --git a/src/tribol/geom/ContactPlane.hpp b/src/tribol/geom/ContactPlane.hpp index 7e4bc2ea..540d0ee3 100644 --- a/src/tribol/geom/ContactPlane.hpp +++ b/src/tribol/geom/ContactPlane.hpp @@ -30,15 +30,17 @@ class ContactPlaneManager; * \param [in] pair interface pair containing pair related indices * \param [in] cMethod the Tribol contact method * \param [in] cCase the Tribol contact Case + * \param [in] inContact true if pair are in contact per CG routines * - * \return true if face-pair are interacting + * \return 0 if no error, non-zero (via FaceGeomError enum) otherwise * * \note will need the contact case for specialized geometry checks * */ -bool CheckInterfacePair( InterfacePair& pair, - ContactMethod const cMethod, - ContactCase const cCase ); +FaceGeomError CheckInterfacePair( InterfacePair& pair, + ContactMethod const cMethod, + ContactCase const cCase, + bool& inContact ); /*! * @@ -220,8 +222,12 @@ class ContactPlane /*! * \brief Compute the contact plane integral gap expression + * + * \param [in,out] interpen true if the two faces interpenetrate + * + * \return 0 if no error, non-zero (via FaceGeomError enum) otherwise */ - virtual bool computeLocalInterpenOverlap() = 0 ; + virtual FaceGeomError computeLocalInterpenOverlap(bool& interpen) = 0 ; /*! * \brief Copy the contact plane object @@ -558,8 +564,12 @@ class ContactPlane3D : public ContactPlane * \brief Computes the polygonal overlap between the portion of two * faces lying on the contact plane that are interpenetrating the contact * plane. + * + * \param [in,out] interpen true if the two faces interpenetrate + * + * \return 0 if no error, non-zero (via FaceGeomError enum) otherwise */ - virtual bool computeLocalInterpenOverlap(); + virtual FaceGeomError computeLocalInterpenOverlap(bool& interpen); /*! * \brief Copies one contact plane object's data to another @@ -659,8 +669,12 @@ class ContactPlane2D : public ContactPlane * \brief Computes the polygonal overlap between the portion of two * faces lying on the contact plane that are interpenetrating the contact * plane. + * + * \param [in,out] interpen true if the two faces interpenetrate + * + * \return 0 if no error, non-zero (via FaceGeomError enum) otherwise */ - virtual bool computeLocalInterpenOverlap(); + virtual FaceGeomError computeLocalInterpenOverlap(bool& interpen); /*! * \brief Copies one contact plane object's data to another @@ -688,15 +702,15 @@ class ContactPlane2D : public ContactPlane * \brief Checks if face-pair (3D) candidate is actual local contact interaction. * * \param [in] pair interface pair containing pair related indices - * \param [in] method contact method * \param [in] fullOverlap True if full overlap calculation is used, false if interpenetration calculation is used + * \param [in,out] cp contact plane object to be populated * - * \return 3D contact plane object with boolean indicating if face-pair form a local contact interaction + * \return 0 if no error, non-zero (via FaceGeomError enum) otherwise * */ -ContactPlane3D CheckFacePair( InterfacePair& pair, - ContactMethod const method, - bool fullOverlap ); +FaceGeomError CheckFacePair( InterfacePair& pair, + bool fullOverlap, + ContactPlane3D& cp ); /*! * \brief Checks if face-pair (3D) candidate is aligned and actual local contact interaction. @@ -712,15 +726,15 @@ ContactPlane3D CheckAlignedFacePair( InterfacePair& pair ); * \brief Checks if 2D edge-pair candidate is actual local contact interaction. * * \param [in] pair interface pair containing pair related indices - * \param [in] method contact method * \param [in] fullOverlap True if full overlap calculation is used, false if interpenetration calculation is used + * \param [in,out] cp contact plane object to be populated * - * \return 2D contact plane object with boolean indicating if edge-pair form a local contact interaction + * \return 0 if no error, non-zero (via FaceGeomError enum) otherwise * */ -ContactPlane2D CheckEdgePair( InterfacePair& pair, - ContactMethod const method, - bool fullOverlap ); +FaceGeomError CheckEdgePair( InterfacePair& pair, + bool fullOverlap, + ContactPlane2D& cp ); } diff --git a/src/tribol/geom/ContactPlaneManager.cpp b/src/tribol/geom/ContactPlaneManager.cpp index baa5fc79..161d3055 100644 --- a/src/tribol/geom/ContactPlaneManager.cpp +++ b/src/tribol/geom/ContactPlaneManager.cpp @@ -45,7 +45,7 @@ void ContactPlaneManager::resize( IndexType const newSize ) case 2: resize2D(); break; case 3: resize3D(); break; default: - SLIC_ERROR("ContactPlaneManager::resize incorrect problem dimension: " << m_spaceDim ); + SLIC_ERROR("ContactPlaneManager::resize(): incorrect problem dimension, " << m_spaceDim ); break; } @@ -206,7 +206,7 @@ void ContactPlaneManager::reserve( IndexType const newSize ) } else { - SLIC_ERROR("ContactPlaneManager::reserve, must set problem dimension."); + SLIC_ERROR("ContactPlaneManager::reserve(): must set problem dimension."); } return; @@ -571,7 +571,7 @@ void ContactPlaneManager::addContactPlane( const ContactPlane2D& cp ) // add dimension check if ( m_spaceDim == 3) { - SLIC_ASSERT("Cannot add 2D contact plane for 3D problem."); + SLIC_ERROR("Cannot add 2D contact plane for 3D problem."); return; } @@ -743,7 +743,8 @@ void ContactPlaneManager::getContactPlaneOverlapVerts( int const id, { if (numVerts != m_numPolyVert[id]) { - SLIC_ERROR("getContactPlaneOverlapVerts: input arg. numVerts != m_numPolyVert[id]"); + SLIC_ERROR("ContactPlaneManager::getContactPlaneOverlapVerts(): " << + "input arg. numVerts != m_numPolyVert[id]"); } // point to the appropriate overlap vertex coordinate diff --git a/src/tribol/geom/GeomUtilities.cpp b/src/tribol/geom/GeomUtilities.cpp index 47c23e5d..f3dfe1fe 100644 --- a/src/tribol/geom/GeomUtilities.cpp +++ b/src/tribol/geom/GeomUtilities.cpp @@ -14,8 +14,6 @@ #include #include -#include "tribol/common/logger.hpp" - namespace tribol { @@ -24,8 +22,8 @@ void ProjectPointToPlane( const real x, const real y, const real z, const real ox, const real oy, const real oz, real& px, real& py, real& pz ) { - // compute the vector from the origin point on the plane to the - // input point + // compute the vector from input point to be projected to + // the origin point on the plane real vx = x - ox; real vy = y - oy; real vz = z - oz; @@ -48,8 +46,8 @@ void ProjectPointToSegment( const real x, const real y, const real ox, const real oy, real& px, real& py ) { - // compute the vector from the origin point on the plane to the - // input point + // compute the vector from input point to be projected to + // the origin point on the plane real vx = x - ox; real vy = y - oy; @@ -330,10 +328,8 @@ void GlobalTo2DLocalCoords( const real* const RESTRICT pX, real* const RESTRICT pLY, int size ) { - if (pLX == nullptr || pLY == nullptr) - { - TRIBOL_ERROR ("GlobalTo2DLocalCoords: local coordinate pointers are null"); - } + SLIC_ERROR_IF(size > 0 && (pLX == nullptr || pLY == nullptr), + "GlobalTo2DLocalCoords: local coordinate pointers are null"); // loop over projected nodes for (int i=0; i= maxSegInter) { - SLIC_ERROR ("Intersection2DPolygon: number of segment intersections exceeds precomputed maximum."); + SLIC_DEBUG("Intersection2DPolygon: number of segment/segment intersections exceeds precomputed maximum; " << + "check for degenerate overlap."); + return DEGENERATE_OVERLAP; } intersect[interId] = SegmentIntersection2D( xA[vAID1], yA[vAID1], xA[vAID2], yA[vAID2], @@ -787,11 +769,9 @@ void Intersection2DPolygon( const real* const RESTRICT xA, if (numSegInter == 0 && numVBI == 0 && numVAI == 0) { area = 0.0; - return; + return NO_FACE_GEOM_ERROR; } - TRIBOL_DEBUG_LOG( "Intersection2DPolygon: number of segment intersections = " << numSegInter << ".\n" ); - // allocate temp intersection polygon vertex coordinate arrays to consist // of segment-segment intersections and number of interior points in A and B numPolyVert = numSegInter + numVAI + numVBI; @@ -816,9 +796,11 @@ void Intersection2DPolygon( const real* const RESTRICT xA, if (interiorVAId[i] != -1) { // debug - if (k > (numPolyVert)) + if (k > numPolyVert) { - TRIBOL_ERROR("Intersection2DPolygon: iterator k greater than numPolyVert (1)"); + SLIC_DEBUG("Intersection2DPolygon(): number of A vertices interior to B " << + "polygon exceeds total number of overlap vertices. Check interior vertex id values."); + return FACE_INDEX_EXCEEDS_OVERLAP_VERTICES; } polyXTemp[k] = xA[i]; @@ -832,9 +814,11 @@ void Intersection2DPolygon( const real* const RESTRICT xA, if (interiorVBId[i] != -1) { // debug - if (k > (numPolyVert)) + if (k > numPolyVert) { - TRIBOL_ERROR("Intersection2DPolygon: iterator k greater than numPolyVert (2)"); + SLIC_DEBUG("Intersection2DPolygon(): number of B vertices interior to A " << + "polygon exceeds total number of overlap vertices. Check interior vertex id values."); + return FACE_INDEX_EXCEEDS_OVERLAP_VERTICES; } polyXTemp[k] = xB[i]; @@ -843,19 +827,20 @@ void Intersection2DPolygon( const real* const RESTRICT xA, } } - // reorder the vertices in counter clockwise fashion + // order the unordered vertices (in counter clockwise fashion) PolyReorder( polyXTemp, polyYTemp, numPolyVert ); // check length of segs against tolerance and collapse short segments if necessary // This is where polyX and polyY get allocated. int numFinalVert = 0; - TRIBOL_DEBUG_LOG( "number of polygonal vertices (prior to CheckPolySegs call): " << numPolyVert << ".\n" ); - - CheckPolySegs( polyXTemp, polyYTemp, numPolyVert, - lenTol, polyX, polyY, numFinalVert ); + FaceGeomError segErr = CheckPolySegs( polyXTemp, polyYTemp, numPolyVert, + lenTol, polyX, polyY, numFinalVert ); - TRIBOL_DEBUG_LOG( "number of final polygonal vertices (after call to CheckPolySegs): " << numFinalVert << ".\n" ); + if (segErr != 0) + { + return segErr; + } numPolyVert = numFinalVert; @@ -863,7 +848,7 @@ void Intersection2DPolygon( const real* const RESTRICT xA, if (numPolyVert < 3) { area = 0.0; - return; + return NO_FACE_GEOM_ERROR; // don't return error here. We should tolerate 'collapsed' (zero area) overlaps } // compute the area of the polygon @@ -872,7 +857,7 @@ void Intersection2DPolygon( const real* const RESTRICT xA, area = 0.0; area = Area2DPolygon( xVert, yVert, numPolyVert ); - return; + return NO_FACE_GEOM_ERROR; } // end Intersection2DPolygon() @@ -926,15 +911,9 @@ bool Point2DInFace( const real xPoint, const real yPoint, const real xC, const real yC, const int numPolyVert ) { - if (numPolyVert < 3) - { - TRIBOL_ERROR ("Point2DInFace: number of face vertices is less than 3"); - } + SLIC_ERROR_IF(numPolyVert<3, "Point2DInFace: number of face vertices is less than 3"); - if (xPoly == nullptr || yPoly == nullptr) - { - TRIBOL_ERROR ("Point2DInFace: input pointer not set"); - } + SLIC_ERROR_IF(xPoly == nullptr || yPoly == nullptr, "Point2DInFace: input pointer not set"); // if face is triangle (numPolyVert), call Point2DInTri once if (numPolyVert == 3) @@ -1119,8 +1098,8 @@ bool SegmentIntersection2D( const real xA1, const real yA1, const real xB1, cons return false; } - #ifdef AXOM_DEBUG - + // TODO refine how these debug calculations are guarded + { // debug check to make sure the intersection coordinates derived from // each segment equation (scaled with tA and tB) are the same to some // tolerance @@ -1137,10 +1116,9 @@ bool SegmentIntersection2D( const real xA1, const real yA1, const real xB1, cons yDiff = (yDiff < 0.) ? -1.0 * yDiff : yDiff; real diffTol = 1.0E-3; - SLIC_ERROR_IF( xDiff > diffTol || yDiff > diffTol, + SLIC_DEBUG_IF( xDiff > diffTol || yDiff > diffTol, "SegmentIntersection2D(): Intersection coordinates are not equally derived." ); - - #endif + } // if we get here then it means we have an intersection point. // Find the minimum distance of the intersection point to any of the segment @@ -1203,8 +1181,6 @@ bool SegmentIntersection2D( const real xA1, const real yA1, const real xB1, cons { if (interior == nullptr || interior[idMin]) { - TRIBOL_DEBUG_LOG( "segment intersection duplicate vertex due to min distance.\n" ); - x = xMinVert; y = yMinVert; duplicate = true; @@ -1219,10 +1195,10 @@ bool SegmentIntersection2D( const real xA1, const real yA1, const real xB1, cons } // end SegmentIntersection2D() //------------------------------------------------------------------------------ -void CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, - const int numPoints, const real tol, - real* RESTRICT * RESTRICT xnew, real* RESTRICT * RESTRICT ynew, - int& numNewPoints ) +FaceGeomError CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, + const int numPoints, const real tol, + real* RESTRICT * RESTRICT xnew, real* RESTRICT * RESTRICT ynew, + int& numNewPoints ) { real newIDs[ numPoints ]; @@ -1246,8 +1222,6 @@ void CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, // check segment length against tolerance if (lambdaMag < tol) { - TRIBOL_DEBUG_LOG( "collapsing seg in CheckPolySegs with length: " << lambdaMag << ".\n" ); - // collapse second vertex to the first vertex of the current segment newIDs[ib] = i; } @@ -1275,10 +1249,10 @@ void CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, { if (newIDs[i] == i) { - // debug error if (k > numNewPoints) { - TRIBOL_ERROR("checkPolySegs: index into polyX/polyY exceeds allocated space"); + SLIC_DEBUG("checkPolySegs(): index into polyX/polyY exceeds allocated space"); + return FACE_INDEX_EXCEEDS_OVERLAP_VERTICES; } (*xnew)[k] = x[i]; @@ -1287,7 +1261,7 @@ void CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, } } - return; + return NO_FACE_GEOM_ERROR; } // end CheckPolySegs() @@ -1295,10 +1269,7 @@ void CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, void PolyReorder( real* const RESTRICT x, real* const RESTRICT y, const int numPoints ) { - if (numPoints < 3) - { - TRIBOL_ERROR ("PolyReorder: numPoints < 3."); - } + SLIC_ERROR_IF(numPoints<3, "PolyReorder: numPoints < 3."); real xC, yC, zC; real * z = nullptr; @@ -1423,10 +1394,7 @@ void PolyReorder( real* const RESTRICT x, real* const RESTRICT y, const int numP refy = y[newIDs[i+1]] - y[newIDs[i]]; refMag = magnitude( refx, refy ); -// if (refMag < 1.E-12) -// { -// SLIC_ERROR("PolyReorder: reference segment for link vector check is nearly zero length"); -// } +// SLIC_ERROR_IF(refMag < 1.E-12, "PolyReorder: reference segment for link vector check is nearly zero length"); // loop over link vectors of unassigned vertices int nextVertexID = 2+i; @@ -1474,6 +1442,26 @@ void PolyReorder( real* const RESTRICT x, real* const RESTRICT y, const int numP } // end PolyReorder() +//------------------------------------------------------------------------------ +void PolyReverse( real* const RESTRICT x, real* const RESTRICT y, const int numPoints ) +{ + real xtemp[ numPoints ]; + real ytemp[ numPoints ]; + for (int i=0; i0; --i) + { + x[k] = xtemp[i]; + y[k] = ytemp[i]; + ++k; + } +} + //------------------------------------------------------------------------------ void PolyReorderWithNormal( real* const RESTRICT x, real* const RESTRICT y, @@ -1647,11 +1635,15 @@ void Vertex2DOrderToCCW( const real* const RESTRICT x, const real* const RESTRIC real* RESTRICT xTemp, real* RESTRICT yTemp, const int numVert ) { - if (x == nullptr || y == nullptr || xTemp == nullptr || yTemp == nullptr) + if (numVert <= 0) { - TRIBOL_ERROR("Vertex2DOrderToCCW: must set pointers prior to call to routine."); + SLIC_DEBUG("Vertex2DOrderToCCW: numVert <= 0; returning."); + return; } + SLIC_ERROR_IF(x == nullptr || y == nullptr || xTemp == nullptr || yTemp == nullptr, + "Vertex2DOrderToCCW: must set pointers prior to call to routine."); + xTemp[0] = x[0]; yTemp[0] = y[0]; diff --git a/src/tribol/geom/GeomUtilities.hpp b/src/tribol/geom/GeomUtilities.hpp index 5258109e..2834a3d7 100644 --- a/src/tribol/geom/GeomUtilities.hpp +++ b/src/tribol/geom/GeomUtilities.hpp @@ -7,6 +7,7 @@ #define SRC_GEOM_GEOMUTILITIES_HPP_ #include "tribol/types.hpp" +#include "tribol/common/Parameters.hpp" namespace tribol { @@ -284,6 +285,8 @@ void PolyCentroid( const real* const RESTRICT x, * \param [in,out] numPolyVert number of vertices in intersection polygon * \param [in,out] area intersection polygon area * + * \return 0 if no error, >0 a face geom error + * * \pre length(xA), length(yA) >= numVertexA * \pre length(xB), length(yB) >= numVertexB * @@ -292,16 +295,17 @@ void PolyCentroid( const real* const RESTRICT x, * this memory when necessary. * */ -void Intersection2DPolygon( const real* const RESTRICT xA, - const real* const RESTRICT yA, - const int numVertexA, - const real* const RESTRICT xB, - const real* const RESTRICT yB, - const int numVertexB, - real posTol, real lenTol, - real* RESTRICT * RESTRICT polyX, - real* RESTRICT * RESTRICT polyY, - int& numPolyVert, real& area ); +FaceGeomError Intersection2DPolygon( const real* const RESTRICT xA, + const real* const RESTRICT yA, + const int numVertexA, + const real* const RESTRICT xB, + const real* const RESTRICT yB, + const int numVertexB, + real posTol, real lenTol, + real* RESTRICT * RESTRICT polyX, + real* RESTRICT * RESTRICT polyY, + int& numPolyVert, real& area, + bool orientCheck=true ); /*! * @@ -451,6 +455,8 @@ bool SegmentIntersection2D( const real xA1, const real yA1, const real xB1, cons * \param [in,out] ynew array of new y coordinates * \param [in,out] numNewPoints number of new points * + * \return 0 if no error, >0 a face geom error + * * \pre length(x), length(y) >= numPoints * * /note this routine checks the overlapping polygon segments. We may have two adjacent @@ -461,14 +467,14 @@ bool SegmentIntersection2D( const real xA1, const real yA1, const real xB1, cons * xnew and ynew values are set to x and y, respectively, and numNewPoints * equals numPoints. */ -void CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, - const int numPoints, const real tol, - real* RESTRICT * RESTRICT xnew, real* RESTRICT * RESTRICT ynew, - int& numNewPoints ); +FaceGeomError CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, + const int numPoints, const real tol, + real* RESTRICT * RESTRICT xnew, real* RESTRICT * RESTRICT ynew, + int& numNewPoints ); /*! * - * \brief reorders a set of vertices associated with a star convex polygon in + * \brief reorders a set of unordered vertices associated with a star convex polygon in * counter clockwise orientation * * \param [in,out] x array of local x vertex coordinates @@ -482,6 +488,19 @@ void CheckPolySegs( const real* const RESTRICT x, const real* const RESTRICT y, */ void PolyReorder( real* const RESTRICT x, real* const RESTRICT y, const int numPoints ); +/*! + * + * \brief reverses ordering of polygon vertices + * + * \param [in,out] x array of local x vertex coordinates + * \param [in,out] y array of local y vertex coordinates + * \param [in] numPoints number of vertices + * + * \pre length(x), length(y) >= numPoints + * + */ +void PolyReverse( real* const RESTRICT x, real* const RESTRICT y, const int numPoints ); + /*! * * \brief reorders, if necessary, an ordered set of polygonal vertices such that the diff --git a/src/tribol/integ/FE.cpp b/src/tribol/integ/FE.cpp index 33de9c79..3b6edb65 100644 --- a/src/tribol/integ/FE.cpp +++ b/src/tribol/integ/FE.cpp @@ -6,7 +6,6 @@ #include "tribol/utils/Math.hpp" #include "tribol/integ/FE.hpp" #include "tribol/geom/GeomUtilities.hpp" -#include "tribol/common/logger.hpp" #include "axom/slic.hpp" @@ -38,25 +37,10 @@ void GalerkinEval( const real* const RESTRICT x, FaceOrderType order_type, BasisEvalType basis_type, int dim, int galerkinDim, real* nodeVals, real* galerkinVal ) { - if (x == nullptr) - { - SLIC_ERROR("GalerkinEval(): input pointer, x, is NULL."); - } - - if (nodeVals == nullptr) - { - SLIC_ERROR("GalerkinEval(): input pointer, nodeVals, is NULL."); - } - - if (galerkinVal == nullptr) - { - SLIC_ERROR("GalerkinEval(): input/output pointer, galerkinVal, is NULL."); - } - - if (galerkinDim < 1) - { - SLIC_ERROR( "GalerkinEval(): scalar approximations not yet supported." ); - } + SLIC_ERROR_IF(x==nullptr, "GalerkinEval(): input pointer, x, is NULL."); + SLIC_ERROR_IF(nodeVals==nullptr, "GalerkinEval(): input pointer, nodeVals, is NULL."); + SLIC_ERROR_IF(galerkinVal==nullptr, "GalerkinEval(): input/output pointer, galerkinVal, is NULL."); + SLIC_ERROR_IF(galerkinDim<1, "GalerkinEval(): scalar approximations not yet supported." ); int numNodes = GetNumFaceNodes( dim, order_type ); switch (basis_type) @@ -92,7 +76,7 @@ void EvalBasis( const real* const RESTRICT x, } else { - TRIBOL_ERROR("EvalBasis: invalid numPoints argument."); + SLIC_ERROR("EvalBasis: invalid numPoints argument."); } return; } @@ -103,18 +87,12 @@ void SegmentBasis( const real* const RESTRICT x, const int numPoints, const int vertexId, real& phi ) { - if (numPoints != 2) - { - TRIBOL_ERROR("SegmentBasis: numPoints is " << numPoints - << " but should be 2."); - } + SLIC_ERROR_IF(numPoints != 2, "SegmentBasis: numPoints is " << numPoints << + " but should be 2."); // note, vertexId is the index, 0 or 1. - if (vertexId > numPoints-1) - { - TRIBOL_ERROR("SegmentBasis: vertexId is " << vertexId - << " but should be 0 or 1."); - } + SLIC_ERROR_IF(vertexId > numPoints-1, "SegmentBasis: vertexId is " << vertexId << + " but should be 0 or 1."); // compute length of segment real vx = x[numPoints*1] - x[numPoints*0]; @@ -127,14 +105,31 @@ void SegmentBasis( const real* const RESTRICT x, real magW = magnitude( wx, wy ); - phi = 1.0 / lambda * (lambda - magW); - - // debug - if (phi > 1.0 || phi < 0.0) - { - TRIBOL_ERROR("SegmentBasis: phi is " << phi - << " but needs to be between 0. and 1." ); - } + phi = 1.0 / lambda * (lambda - magW); // this calculation is inverted, (phi_a is actually phi_b and vice versa) + + // TODO verify this code as a bugfix to fix flipping of nodes a and b + // when evaluating basis. Suppress error for now. + //if (std::abs(lambda-magW)/lambda < 1.E-2) + //{ + // phi=1.; + //} + //else if (magW<1.e-5) + //{ + // phi=0.; + //} + //else + //{ + // //phi = 1.0 / lambda * (lambda - magW); // this calculation is inverted, (phi_a is actually phi_b and vice versa) + // // this will shift nodal contributions over one node + // phi = 1.0 / lambda * magW; + //} + + //if (phi > 1.0 || phi < 0.0) + //{ + // SLIC_INFO("(x0,y0) and (x1,y1): " << "(" << x[0] << ", " << x[1] << "), " << "(" << x[2] << ", " << x[3] << ")."); + // SLIC_INFO("(px,py): " << "(" << pX << ", " << pY << ")"); + //} + //SLIC_ERROR_IF(phi > 1.0 || phi < 0.0, "SegmentBasis: phi is " << phi << " not between 0. and 1." ); return; } @@ -144,10 +139,7 @@ void WachspressBasis( const real* const RESTRICT x, const real pX, const real pY, const real pZ, const int numPoints, const int vertexId, real& phi ) { - if (numPoints < 3) - { - TRIBOL_ERROR("WachspressBasis: numPoints < 3."); - } + SLIC_ERROR_IF(numPoints<3, "WachspressBasis: numPoints < 3."); // first compute the areas of all the triangles formed by the i-1,i,i+1 vertices. // These consist of all the numerators in the Wachspress formulation @@ -228,10 +220,9 @@ void WachspressBasis( const real* const RESTRICT x, phi = myWeight / weightSum; - // debug error statement if (phi <= 0. || phi > 1.) { - TRIBOL_ERROR("Wachspress Basis: phi is not between 0 and 1."); + SLIC_ERROR("Wachspress Basis: phi is not between 0 and 1."); } return; @@ -246,10 +237,7 @@ void InvIso( const real x[3], real xi[2] ) { - if (numNodes != 4) - { - TRIBOL_ERROR("InvIso: routine only for 4 node quads."); - } + SLIC_ERROR_IF(numNodes!=4, "InvIso: routine only for 4 node quads."); bool convrg = false; int kmax = 15; @@ -372,22 +360,15 @@ void InvIso( const real x[3], } } - if (!in_quad) - { - SLIC_ERROR("InvIso(): (xi,eta) coordinate does not lie " << + SLIC_ERROR_IF(!in_quad, "InvIso(): (xi,eta) coordinate does not lie " << "inside isoparametric quad."); - } -// SLIC_INFO("InvIso(): total iteration count, " << k ); return; } } - if (!convrg) - { - TRIBOL_ERROR("InvIso: Newtons method did not converge."); - } + SLIC_ERROR_IF(!convrg, "InvIso: Newtons method did not converge."); return; } @@ -461,7 +442,7 @@ void LinIsoTriShapeFunc( const real xi, phi = eta; break; default: - TRIBOL_ERROR("LinIsoTriShapeFunc: node id is not between 0 and 2."); + SLIC_ERROR("LinIsoTriShapeFunc: node id is not between 0 and 2."); break; } @@ -494,12 +475,14 @@ void LinIsoQuadShapeFunc( const real xi, eta_node = -1.; break; default: - TRIBOL_ERROR("LinIsoQuadShapeFunc: node id is not between 0 and 3."); + SLIC_ERROR("LinIsoQuadShapeFunc: node id is not between 0 and 3."); return; } phi = 0.25 * (1. + xi_node * xi) * ( 1. + eta_node * eta); + SLIC_ERROR_IF(phi > 1.0 || phi < 0.0, "LinIsoQuadShapeFunc: phi is " << phi << " not between 0. and 1." ); + return; } diff --git a/src/tribol/integ/Integration.cpp b/src/tribol/integ/Integration.cpp index 83a7d3e7..8faed791 100644 --- a/src/tribol/integ/Integration.cpp +++ b/src/tribol/integ/Integration.cpp @@ -10,7 +10,6 @@ #include "tribol/utils/Math.hpp" #include "tribol/integ/FE.hpp" #include "tribol/geom/GeomUtilities.hpp" -#include "tribol/common/logger.hpp" // axom includes #include "axom/slic.hpp" @@ -52,6 +51,8 @@ void EvalWeakFormIntegral< COMMON_PLANE, SINGLE_POINT > // project the overlap centroid to each face if (elem.dim == 3) { + // TODO we should probably project in the direction of the overlap normal + // As the faces become less coplanar we lose conservation of angular momentum ProjectPointToPlane( cx[0], cx[1], cx[2], elem.faceNormal1[0], elem.faceNormal1[1], @@ -68,6 +69,8 @@ void EvalWeakFormIntegral< COMMON_PLANE, SINGLE_POINT > } else { + // TODO we should probably project in the direction of the overlap normal + // As the faces become less coplanar we lose conservation of angular momentum ProjectPointToSegment( cx[0], cx[1], elem.faceNormal1[0], elem.faceNormal1[1], @@ -102,7 +105,7 @@ void TWBPolyInt( SurfaceContactElem const & elem, // check that the order, k, is either 2 or 3 if (k != 2 && k !=3) { - TRIBOL_ERROR("TWBPolyInt: input argument, k, must be 2 or 3."); + SLIC_ERROR("TWBPolyInt: input argument, k, must be 2 or 3."); return; } @@ -317,7 +320,7 @@ int NumTWBPointsPerTri( integer order ) case 3: return 6; default: - TRIBOL_ERROR("NumTWBPoints: integration rule order not supported."); + SLIC_ERROR("NumTWBPoints: integration rule order not supported."); break; } @@ -345,7 +348,7 @@ void GaussPolyIntTri( SurfaceContactElem const & elem, numTotalPoints = numTriPoints * elem.numPolyVert; break; default: - TRIBOL_ERROR("GaussPolyIntTri: only Gauss integration of order 2-4 is implemented."); + SLIC_ERROR("GaussPolyIntTri: only Gauss integration of order 2-4 is implemented."); return; } @@ -481,7 +484,7 @@ void GaussPolyIntQuad( SurfaceContactElem const & TRIBOL_UNUSED_PARAM(elem), numQuadPoints = 25; break; default: - TRIBOL_ERROR("GaussPolyIntQuad: only Gauss integration of order 2-5 is implemented."); + SLIC_ERROR("GaussPolyIntQuad: only Gauss integration of order 2-5 is implemented."); return; } diff --git a/src/tribol/interface/simple_tribol.cpp b/src/tribol/interface/simple_tribol.cpp index be6002d8..9f0cb3a5 100644 --- a/src/tribol/interface/simple_tribol.cpp +++ b/src/tribol/interface/simple_tribol.cpp @@ -7,7 +7,6 @@ // Tribol includes #include "tribol/interface/simple_tribol.hpp" -#include "tribol/common/logger.hpp" #include "tribol/common/Parameters.hpp" #include "tribol/types.hpp" @@ -34,15 +33,15 @@ namespace numerics = axom::numerics; int Initialize(const int dim, bool init_slic) { // initialize slic - if(init_slic) + if (init_slic) { axom::slic::finalize(); axom::slic::initialize(); std::string format = "[]: \n"; axom::slic::setLoggingMsgLevel( axom::slic::message::Info ); - + axom::slic::addStreamToAllMsgLevels( - new axom::slic::GenericOutputStream( &std::cout,format) ); + new axom::slic::GenericOutputStream( &std::cout,format ) ); } // Initialize tribol diff --git a/src/tribol/interface/tribol.cpp b/src/tribol/interface/tribol.cpp index 930d9101..bc11c8f9 100644 --- a/src/tribol/interface/tribol.cpp +++ b/src/tribol/interface/tribol.cpp @@ -6,7 +6,6 @@ #include "tribol.hpp" // Tribol includes -#include "tribol/common/logger.hpp" #include "tribol/common/Parameters.hpp" #include "tribol/types.hpp" @@ -96,9 +95,9 @@ void setPenaltyOptions( int couplingSchemeIndex, PenaltyConstraintType pen_enfrc CouplingSchemeManager& csManager = CouplingSchemeManager::getInstance(); // check to see if coupling scheme exists - SLIC_ERROR_IF( !csManager.hasCoupling( couplingSchemeIndex ), - "tribol::setPenaltyOptions(): call tribol::registerCouplingScheme() " << - "prior to calling this routine." ); + SLIC_ERROR_ROOT_IF( !csManager.hasCoupling( couplingSchemeIndex ), + "tribol::setPenaltyOptions(): call tribol::registerCouplingScheme() " << + "prior to calling this routine." ); // get access to coupling scheme CouplingScheme* couplingScheme = csManager.getCoupling(couplingSchemeIndex); @@ -110,7 +109,7 @@ void setPenaltyOptions( int couplingSchemeIndex, PenaltyConstraintType pen_enfrc // check that penalty enforcement option is valid if ( !in_range(pen_enfrc_option, NUM_PENALTY_OPTIONS) ) { - SLIC_WARNING( "tribol::setPenaltyOptions(): penalty enforcement option not available." ); + SLIC_WARNING_ROOT( "tribol::setPenaltyOptions(): penalty enforcement option not available." ); } else { @@ -121,7 +120,7 @@ void setPenaltyOptions( int couplingSchemeIndex, PenaltyConstraintType pen_enfrc // check that kinematic penalty calculation is valid if ( !in_range(kinematic_calc, NUM_KINEMATIC_PENALTY_CALCULATION) ) { - SLIC_WARNING( "tribol::setPenaltyOptions(): kinematic penalty calculation not available." ); + SLIC_WARNING_ROOT( "tribol::setPenaltyOptions(): kinematic penalty calculation not available." ); } else { @@ -132,7 +131,7 @@ void setPenaltyOptions( int couplingSchemeIndex, PenaltyConstraintType pen_enfrc // check that the rate penalty calculation is valid if ( !in_range(rate_calc, NUM_RATE_PENALTY_CALCULATION) ) { - SLIC_WARNING( "tribol::setPenaltyOptions(): rate penalty calculation not available." ); + SLIC_WARNING_ROOT( "tribol::setPenaltyOptions(): rate penalty calculation not available." ); } else { @@ -147,9 +146,9 @@ void setKinematicConstantPenalty( int meshId, double k ) { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), - "tribol::setKinematicConstantPenalty(): " << - "no mesh with id, " << meshId << "exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), + "tribol::setKinematicConstantPenalty(): " << + "no mesh with id, " << meshId << "exists."); registerRealElementField( meshId, KINEMATIC_CONSTANT_STIFFNESS, &k ); @@ -162,13 +161,13 @@ void setKinematicElementPenalty( int meshId, { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), - "tribol::setKinematicElementPenalty(): " << - "no mesh with id, " << meshId << "exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), + "tribol::setKinematicElementPenalty(): " << + "no mesh with id, " << meshId << "exists."); - SLIC_ERROR_IF(material_modulus == nullptr || element_thickness == nullptr, - "tribol::setKinematicElementPenalty() contains nullptrs for " << - "element_stiffness options."); + SLIC_ERROR_ROOT_IF(material_modulus == nullptr || element_thickness == nullptr, + "tribol::setKinematicElementPenalty() contains nullptrs for " << + "element_stiffness options."); registerRealElementField( meshId, BULK_MODULUS, material_modulus ); registerRealElementField( meshId, ELEMENT_THICKNESS, element_thickness ); @@ -180,8 +179,8 @@ void setRateConstantPenalty( int meshId, double r_k ) { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::setRateConstantPenalty(): " << - "no mesh with id, " << meshId << "exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::setRateConstantPenalty(): " << + "no mesh with id, " << meshId << "exists."); registerRealElementField( meshId, RATE_CONSTANT_STIFFNESS, &r_k ); @@ -192,8 +191,8 @@ void setRatePercentPenalty( int meshId, double r_p ) { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::setRatePercentPenalty(): " << - "no mesh with id, " << meshId << "exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::setRatePercentPenalty(): " << + "no mesh with id, " << meshId << "exists."); registerRealElementField( meshId, RATE_PERCENT_STIFFNESS, &r_p ); @@ -217,6 +216,12 @@ void setContactPenFrac( double frac ) void setContactAreaFrac( double frac ) { parameters_t & parameters = parameters_t::getInstance(); + if (frac < 1.e-12) + { + SLIC_DEBUG_ROOT("tribol::setContactAreaFrac(): area fraction too small or negative; " << + "setting to default 1.e-8."); + frac = 1.e-8; + } parameters.overlap_area_frac = frac; } @@ -225,9 +230,9 @@ void setPenaltyScale( int meshId, double scale ) { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), - "tribol::setPenaltyScale(): " << - "no mesh with id, " << meshId << "exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), + "tribol::setPenaltyScale(): " << + "no mesh with id, " << meshId << "exists."); MeshData & mesh = meshManager.GetMeshInstance( meshId ); if (scale > 1.e-6) @@ -239,9 +244,9 @@ void setPenaltyScale( int meshId, double scale ) // still set small penalty to allow for zeroing out kinematic penalty // enforcement allowing for rate only enforcement mesh.m_elemData.m_penalty_scale = scale; - SLIC_WARNING("tribol::setPenaltyScale(): input scale factor is " << - "close to zero or negative; kinematic contact may " << - "not be properly enforced."); + SLIC_WARNING_ROOT("tribol::setPenaltyScale(): input scale factor is " << + "close to zero or negative; kinematic contact may " << + "not be properly enforced."); } } // end setPenaltyScale() @@ -253,9 +258,9 @@ void setLagrangeMultiplierOptions( int couplingSchemeIndex, ImplicitEvalMode eva // get access to coupling scheme CouplingSchemeManager& csManager = CouplingSchemeManager::getInstance(); - SLIC_ERROR_IF( !csManager.hasCoupling( couplingSchemeIndex ), - "tribol::setLagrangeMultiplierOptions(): call tribol::registerCouplingScheme() " << - "prior to calling this routine." ); + SLIC_ERROR_ROOT_IF( !csManager.hasCoupling( couplingSchemeIndex ), + "tribol::setLagrangeMultiplierOptions(): call tribol::registerCouplingScheme() " << + "prior to calling this routine." ); CouplingScheme* couplingScheme = csManager.getCoupling(couplingSchemeIndex); @@ -313,7 +318,7 @@ void setOutputDirectory( const std::string& dir) // Create path if it doesn't already exist if(! axom::utilities::filesystem::pathExists(dir) ) { - SLIC_INFO("Creating output path '" << dir << "'"); + SLIC_INFO_ROOT("Creating output path '" << dir << "'"); axom::utilities::filesystem::makeDirsForPath(dir); } @@ -321,6 +326,25 @@ void setOutputDirectory( const std::string& dir) parameters.output_directory = dir; } +//------------------------------------------------------------------------------ +void setLoggingLevel( int csId, LoggingLevel log_level ) +{ + CouplingSchemeManager& csManager = CouplingSchemeManager::getInstance(); + SLIC_ERROR_IF(!csManager.hasCoupling(csId), "tribol::setLoggingLevel(): " << + "invalid CouplingScheme id."); + CouplingScheme* couplingScheme = csManager.getCoupling( csId ); + + if ( !in_range(log_level, NUM_LOGGING_LEVELS) ) + { + SLIC_INFO_ROOT("tribol::setLoggingLevel(): Logging level not an option; " << + "using 'warning' level."); + couplingScheme->setLoggingLevel( tribol::WARNING ); + } + else + { + couplingScheme->setLoggingLevel( log_level ); + } +} //------------------------------------------------------------------------------ void registerMesh( integer meshId, integer numCells, @@ -339,19 +363,21 @@ void registerMesh( integer meshId, static_cast< InterfaceElementType >(elementType) != LINEAR_TRIANGLE && static_cast< InterfaceElementType >(elementType) != LINEAR_QUAD) { - SLIC_WARNING("Mesh topology not supported for mesh id, " << meshId << "."); + SLIC_WARNING_ROOT("tribol::registerMesh(): mesh topology not supported " << + "for mesh id, " << meshId << "."); mesh.m_isValid = false; } const int dim = (z == nullptr) ? 2 : 3; - // check for null pointers for non-null meshes + // check for null pointers on ranks with non-null meshes if (numCells > 0) { if (x == nullptr || y == nullptr) { - SLIC_WARNING("Pointer to x or y-component mesh coordinate arrays are null pointers " << - " for mesh id, " << meshId << "."); + SLIC_WARNING_ROOT("tribol::registerMesh(): pointer to x or y-component " << + "mesh coordinate arrays are null pointers " << + " for mesh id, " << meshId << "."); mesh.m_isValid = false; } @@ -359,8 +385,8 @@ void registerMesh( integer meshId, { if (z == nullptr) { - SLIC_WARNING("Pointer to z-component mesh coordinates is null for " << - "mesh id, " << meshId << "."); + SLIC_WARNING_ROOT("tribol::registerMesh(): pointer to z-component " << + "mesh coordinates is null for mesh id, " << meshId << "."); mesh.m_isValid = false; } } @@ -403,7 +429,8 @@ void registerMesh( integer meshId, break; } default: - SLIC_WARNING("Element type not supported."); + SLIC_ERROR_ROOT("Element type not supported."); + break; } // end switch over element type // compute the number of unique surface nodes from the connectivity @@ -448,8 +475,8 @@ void registerNodalDisplacements( integer meshId, { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::registerNodalDisplacements(): " << - "no mesh with id, " << meshId << "exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::registerNodalDisplacements(): " << + "no mesh with id, " << meshId << "exists."); MeshData & mesh = meshManager.GetMeshInstance( meshId ); mesh.m_nodalFields.m_is_nodal_displacement_set = true; @@ -481,8 +508,8 @@ void registerNodalVelocities( integer meshId, { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::registerNodalVelocities(): " << - "no mesh with id, " << meshId << "exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::registerNodalVelocities(): " << + "no mesh with id, " << meshId << "exists."); MeshData & mesh = meshManager.GetMeshInstance( meshId ); mesh.m_nodalFields.m_is_velocity_set = true; @@ -514,8 +541,8 @@ void registerNodalResponse( integer meshId, { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::registerNodalResponse(): " << - "no mesh with id, " << meshId << "exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::registerNodalResponse(): " << + "no mesh with id, " << meshId << "exists."); MeshData & mesh = meshManager.GetMeshInstance( meshId ); mesh.m_nodalFields.m_is_nodal_response_set = true; @@ -542,12 +569,10 @@ void registerNodalResponse( integer meshId, int getJacobianSparseMatrix( mfem::SparseMatrix ** sMat, int csId ) { - if (*sMat != nullptr) - { - SLIC_WARNING("tribol::getMfemSparseMatrix(): sparse matrix pointer not null; " << - "nullifying now."); - *sMat = nullptr; - } + // note, SLIC_ERROR_ROOT_IF is not used here because it's possible not all ranks + // will have method (i.e. mortar) data. + SLIC_ERROR_IF(*sMat!=nullptr, "tribol::getMfemSparseMatrix(): " << + "sparse matrix pointer not null."); CouplingSchemeManager& csManager = CouplingSchemeManager::getInstance(); @@ -580,15 +605,15 @@ int getJacobianCSRMatrix( int** I, int** J, real** vals, int csId, // check to make sure input pointers are null if ( *I != nullptr || *J != nullptr || *vals != nullptr ) { - SLIC_WARNING("tribol::getCSRMatrix: input pointers not null, nullifying now."); - *I = nullptr; - *J = nullptr; - *vals = nullptr; + SLIC_WARNING("tribol::getJacobianCSRMatrix(): input pointers must be null."); + return 1; } CouplingSchemeManager& csManager = CouplingSchemeManager::getInstance(); - SLIC_ERROR_IF(!csManager.hasCoupling(csId), "tribol::getCSRMatrix(): invalid " << + // Note, SLIC_<>_ROOT macros are not here because it's possible not all ranks will have + // method data. + SLIC_ERROR_IF(!csManager.hasCoupling(csId), "tribol::getJacobianCSRMatrix(): invalid " << "CouplingScheme id."); CouplingScheme* couplingScheme = csManager.getCoupling( csId ); @@ -597,7 +622,7 @@ int getJacobianCSRMatrix( int** I, int** J, real** vals, int csId, { case ALIGNED_MORTAR: { - SLIC_WARNING("tribol::getCSRMatrix(): CSR format not currently implemented with " << + SLIC_WARNING("tribol::getJacobianCSRMatrix(): CSR format not currently implemented with " << "ALIGNED_MORTAR. Use MFEM sparse matrix registration."); return 1; } @@ -608,13 +633,13 @@ int getJacobianCSRMatrix( int** I, int** J, real** vals, int csId, } case SINGLE_MORTAR: { - SLIC_WARNING("tribol::getCSRMatrix(): CSR format not currently implemented with " + SLIC_WARNING("tribol::getJacobianCSRMatrix(): CSR format not currently implemented with " "SINGLE_MORTAR. Use MFEM sparse matrix registration."); return 1; } default: { - SLIC_WARNING("tribol::registerCSRMatrix(): method does not return matrix data; " << + SLIC_WARNING("tribol::getJacobianCSRMatrix(): method does not return matrix data; " << "invalid call."); return 1; } @@ -656,15 +681,15 @@ void registerMortarGaps( integer meshId, { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::registerMortarGaps(): " << - "no mesh with id " << meshId << " exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::registerMortarGaps(): " << + "no mesh with id " << meshId << " exists."); MeshData & mesh = meshManager.GetMeshInstance( meshId ); - if (gaps == nullptr) + if (gaps == nullptr && mesh.m_numCells > 0) { - SLIC_WARNING( "tribol::registerMortarGaps(): null pointer to data " << - "on mesh " << meshId << "."); + SLIC_WARNING( "tribol::registerMortarGaps(): null pointer to gap data " << + "on non-null mesh " << meshId << "."); mesh.m_isValid = false; } else @@ -681,15 +706,15 @@ void registerMortarPressures( integer meshId, { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::registerMortarPressures(): " << - "no mesh with id " << meshId << " exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::registerMortarPressures(): " << + "no mesh with id " << meshId << " exists."); MeshData & mesh = meshManager.GetMeshInstance( meshId ); - if (pressures == nullptr) + if (pressures == nullptr && mesh.m_numCells > 0) { - SLIC_WARNING( "tribol::registerMortarPressures(): null pointer to data " << - "on mesh " << meshId << "."); + SLIC_WARNING( "tribol::registerMortarPressures(): null pointer to pressure data " << + "on non-null mesh " << meshId << "."); mesh.m_isValid = false; } else @@ -707,14 +732,14 @@ void registerIntNodalField( integer meshId, { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::registerIntNodalField(): " << - "no mesh with id " << meshId << " exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::registerIntNodalField(): " << + "no mesh with id " << meshId << " exists."); switch (field) { case UNDEFINED_INT_NODAL_FIELD: default: - SLIC_WARNING("tribol::registerIntNodalField() not yet implemented."); + SLIC_ERROR_ROOT("tribol::registerIntNodalField() not yet implemented."); } // end switch over field } // end registerIntNodalField() @@ -727,7 +752,7 @@ void registerRealElementField( integer meshId, MeshManager & meshManager = MeshManager::getInstance(); SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::registerRealElementField(): " << - "no mesh with id " << meshId << " exists."); + "no mesh with id " << meshId << " exists."); MeshData & mesh = meshManager.GetMeshInstance( meshId ); @@ -837,8 +862,8 @@ void registerRealElementField( integer meshId, } default: { - SLIC_WARNING( "tribol::registerRealElementField(): the field argument " << - "on mesh " << meshId << " is not an accepted tribol real element field." ); + SLIC_ERROR( "tribol::registerRealElementField(): the field argument " << + "on mesh " << meshId << " is not an accepted tribol real element field." ); } } // end switch over field @@ -851,14 +876,14 @@ void registerIntElementField( integer meshId, { MeshManager & meshManager = MeshManager::getInstance(); - SLIC_ERROR_IF(!meshManager.hasMesh(meshId), "tribol::registerIntElementField(): " << - "no mesh with id " << meshId << " exists."); + SLIC_ERROR_ROOT_IF(!meshManager.hasMesh(meshId), "tribol::registerIntElementField(): " << + "no mesh with id " << meshId << " exists."); switch (field) { case UNDEFINED_INT_ELEMENT_FIELD: default: - SLIC_WARNING("tribol::registerIntElementField() not yet implemented."); + SLIC_ERROR_ROOT("tribol::registerIntElementField() not yet implemented."); } // end switch over field } // end registerIntElementField() @@ -907,8 +932,8 @@ void setInterfacePairs( integer couplingSchemeIndex, { CouplingSchemeManager& csManager = CouplingSchemeManager::getInstance(); - SLIC_ERROR_IF(!csManager.hasCoupling(couplingSchemeIndex), - "tribol::setInterfacePairs(): invalid coupling scheme index."); + SLIC_ERROR_ROOT_IF(!csManager.hasCoupling(couplingSchemeIndex), + "tribol::setInterfacePairs(): invalid coupling scheme index."); auto* couplingScheme = csManager.getCoupling(couplingSchemeIndex); auto* pairs = couplingScheme->getInterfacePairs(); @@ -961,17 +986,19 @@ integer update( integer cycle, real t, real &dt ) CouplingScheme* couplingScheme = csManager.getCoupling(csIndex); + // TODO verify that all validity logging is called by all ranks // initialize and check for valid coupling scheme if (!couplingScheme->init()) { + // TODO figure out if we want to call couplingScheme->apply() for null meshes if (couplingScheme->nullMeshes()) { continue; } else { - SLIC_WARNING("Skipping invalid CouplingScheme " << couplingScheme->getId() << ". " << - "Please see warnings."); + SLIC_WARNING_ROOT("tribol::update(): skipping invalid CouplingScheme " << + couplingScheme->getId() << "Please see warnings."); continue; } } diff --git a/src/tribol/interface/tribol.hpp b/src/tribol/interface/tribol.hpp index 846565e8..5ea42504 100644 --- a/src/tribol/interface/tribol.hpp +++ b/src/tribol/interface/tribol.hpp @@ -144,6 +144,15 @@ void setPlotOptions( enum VisType v_type ); */ void setOutputDirectory( const std::string& dir ); +/*! + * \brief Optionally sets the logging level per coupling scheme + * \param [in] csId coupling scheme id + * \param [in] log_level the desired logging level + * + * \note this overrides the logging level set in initialize(). + */ +void setLoggingLevel( int csId, LoggingLevel log_level ); + /// @} /// \name Contact Surface Registration Methods diff --git a/src/tribol/mesh/CouplingScheme.cpp b/src/tribol/mesh/CouplingScheme.cpp index 0bd0ae3a..a5ea5818 100644 --- a/src/tribol/mesh/CouplingScheme.cpp +++ b/src/tribol/mesh/CouplingScheme.cpp @@ -55,12 +55,12 @@ void CouplingSchemeErrors::printModeErrors() { case INVALID_MODE: { - SLIC_WARNING("The specified ContactMode is invalid."); + SLIC_WARNING_ROOT("The specified ContactMode is invalid."); break; } case NO_MODE_IMPLEMENTATION: { - SLIC_WARNING("The specified ContactMode has no implementation."); + SLIC_WARNING_ROOT("The specified ContactMode has no implementation."); break; } case NO_MODE_ERROR: @@ -79,12 +79,12 @@ void CouplingSchemeErrors::printCaseErrors() { case INVALID_CASE: { - SLIC_WARNING("The specified ContactCase is invalid."); + SLIC_WARNING_ROOT("The specified ContactCase is invalid."); break; } case NO_CASE_IMPLEMENTATION: { - SLIC_WARNING("The specified ContactCase has no implementation."); + SLIC_WARNING_ROOT("The specified ContactCase has no implementation."); break; } case NO_CASE_ERROR: @@ -103,38 +103,38 @@ void CouplingSchemeErrors::printMethodErrors() { case INVALID_METHOD: { - SLIC_WARNING("The specified ContactMethod is invalid."); + SLIC_WARNING_ROOT("The specified ContactMethod is invalid."); break; } case NO_METHOD_IMPLEMENTATION: { - SLIC_WARNING("The specified ContactMethod has no implementation."); + SLIC_WARNING_ROOT("The specified ContactMethod has no implementation."); break; } case DIFFERENT_FACE_TYPES: { - SLIC_WARNING("The specified ContactMethod does not support different face types."); + SLIC_WARNING_ROOT("The specified ContactMethod does not support different face types."); break; } case SAME_MESH_IDS: { - SLIC_WARNING("The specified ContactMethod cannot be used in coupling schemes with identical mesh IDs."); + SLIC_WARNING_ROOT("The specified ContactMethod cannot be used in coupling schemes with identical mesh IDs."); break; } case SAME_MESH_IDS_INVALID_DIM: { - SLIC_WARNING("The specified ContactMethod is not implemented for the problem dimension and " << + SLIC_WARNING_ROOT("The specified ContactMethod is not implemented for the problem dimension and " << "cannot be used in coupling schemes with identical mesh IDs."); break; } case INVALID_DIM: { - SLIC_WARNING("The specified ContactMethod is not implemented for the problem dimension."); + SLIC_WARNING_ROOT("The specified ContactMethod is not implemented for the problem dimension."); break; } case NULL_NODAL_RESPONSE: { - SLIC_WARNING("User must call tribol::registerNodalResponse() for each mesh to use this ContactMethod."); + SLIC_WARNING_ROOT("User must call tribol::registerNodalResponse() for each mesh to use this ContactMethod."); break; } case NO_METHOD_ERROR: @@ -153,17 +153,17 @@ void CouplingSchemeErrors::printModelErrors() { case INVALID_MODEL: { - SLIC_WARNING("The specified ContactModel is invalid."); + SLIC_WARNING_ROOT("The specified ContactModel is invalid."); break; } case NO_MODEL_IMPLEMENTATION: { - SLIC_WARNING("The specified ContactModel has no implementation."); + SLIC_WARNING_ROOT("The specified ContactModel has no implementation."); break; } case NO_MODEL_IMPLEMENTATION_FOR_REGISTERED_METHOD: { - SLIC_WARNING("The specified ContactModel has no implementation for the registered ContactMethod."); + SLIC_WARNING_ROOT("The specified ContactModel has no implementation for the registered ContactMethod."); break; } case NO_MODEL_ERROR: @@ -182,38 +182,38 @@ void CouplingSchemeErrors::printEnforcementErrors() { case INVALID_ENFORCEMENT: { - SLIC_WARNING("The specified EnforcementMethod is invalid."); + SLIC_WARNING_ROOT("The specified EnforcementMethod is invalid."); break; } case INVALID_ENFORCEMENT_FOR_REGISTERED_METHOD: { - SLIC_WARNING("The specified EnforcementMethod is invalid for the registered METHOD."); + SLIC_WARNING_ROOT("The specified EnforcementMethod is invalid for the registered METHOD."); break; } case INVALID_ENFORCEMENT_OPTION: { - SLIC_WARNING("The specified enforcement option is invalid."); + SLIC_WARNING_ROOT("The specified enforcement option is invalid."); break; } case OPTIONS_NOT_SET: { - SLIC_WARNING("User must call 'tribol::setOptions(..)' to set options for " << + SLIC_WARNING_ROOT("User must call 'tribol::setOptions(..)' to set options for " << "registered EnforcementMethod."); break; } case NO_ENFORCEMENT_IMPLEMENTATION: { - SLIC_WARNING("The specified enforcement option has no implementation."); + SLIC_WARNING_ROOT("The specified enforcement option has no implementation."); break; } case NO_ENFORCEMENT_IMPLEMENTATION_FOR_REGISTERED_METHOD: { - SLIC_WARNING("The specified enforcement option has no implementation for the registered ContactMethod."); + SLIC_WARNING_ROOT("The specified enforcement option has no implementation for the registered ContactMethod."); break; } case NO_ENFORCEMENT_IMPLEMENTATION_FOR_REGISTERED_OPTION: { - SLIC_WARNING("The specified enforcement option has no implementation for the specified EnforcementMethod."); + SLIC_WARNING_ROOT("The specified enforcement option has no implementation for the specified EnforcementMethod."); break; } case NO_ENFORCEMENT_ERROR: @@ -232,7 +232,7 @@ void CouplingSchemeErrors::printEnforcementDataErrors() { case ERROR_IN_REGISTERED_ENFORCEMENT_DATA: { - SLIC_WARNING("Error in registered enforcement data; see warnings."); + SLIC_WARNING_ROOT("Error in registered enforcement data; see warnings."); break; } case NO_ENFORCEMENT_DATA_ERROR: @@ -253,22 +253,22 @@ void CouplingSchemeInfo::printCaseInfo() { case SPECIFYING_NO_SLIDING_WITH_REGISTERED_MODE: { - SLIC_INFO("Overriding with ContactCase=NO_SLIDING with registered ContactMode."); + SLIC_DEBUG_ROOT("Overriding with ContactCase=NO_SLIDING with registered ContactMode."); break; } case SPECIFYING_NO_SLIDING_WITH_REGISTERED_METHOD: { - SLIC_INFO("Overriding with ContactCase=NO_SLIDING with registered ContactMethod."); + SLIC_DEBUG_ROOT("Overriding with ContactCase=NO_SLIDING with registered ContactMethod."); break; } case SPECIFYING_NONE_WITH_REGISTERED_METHOD: { - SLIC_INFO("Overriding with ContactCase=NO_CASE with registered ContactMethod."); + SLIC_DEBUG_ROOT("Overriding with ContactCase=NO_CASE with registered ContactMethod."); break; } case SPECIFYING_NONE_WITH_TWO_REGISTERED_MESHES: { - SLIC_INFO("ContactCase=AUTO not supported with two different meshes; overriding with ContactCase=NO_CASE."); + SLIC_DEBUG_ROOT("ContactCase=AUTO not supported with two different meshes; overriding with ContactCase=NO_CASE."); break; } case NO_CASE_INFO: @@ -287,7 +287,7 @@ void CouplingSchemeInfo::printEnforcementInfo() { case SPECIFYING_NULL_ENFORCEMENT_WITH_REGISTERED_METHOD: { - SLIC_INFO("Overriding with EnforcementMethod=NULL_ENFORCEMENT with registered ContactMethod."); + SLIC_DEBUG_ROOT("Overriding with EnforcementMethod=NULL_ENFORCEMENT with registered ContactMethod."); break; } case NO_ENFORCEMENT_INFO: @@ -324,25 +324,20 @@ CouplingScheme::CouplingScheme( integer couplingSchemeId, , m_methodData ( nullptr ) { // error sanity checks - SLIC_ERROR_IF( meshId1==ANY_MESH, "meshId1 cannot be set to ANY_MESH" ); - SLIC_ERROR_IF( !validMeshID( m_meshId1 ), "invalid meshId1=" << meshId1 ); - SLIC_ERROR_IF( !validMeshID( m_meshId2 ), "invalid meshId2=" << meshId2 ); - - SLIC_ERROR_IF( !in_range( contact_mode, NUM_CONTACT_MODES ), - "invalid contact_mode=" << contact_mode ); - SLIC_ERROR_IF( !in_range( contact_method, NUM_CONTACT_METHODS ), - "invalid contact_method=" << contact_method ); - SLIC_ERROR_IF( !in_range( contact_model, NUM_CONTACT_MODELS ), - "invalid contact_model=" << contact_model ); - SLIC_ERROR_IF( !in_range( enforcement_method, NUM_ENFORCEMENT_METHODS ), - "invalid enforcement_method=" << enforcement_method ); - SLIC_ERROR_IF( !in_range( binning_method, NUM_BINNING_METHODS ), - "invalid binning_method=" << binning_method ); - - // warning sanity checks - SLIC_WARNING_IF( !in_range( contact_case, NUM_CONTACT_CASES ), - "invalid contact_case=" << contact_case << "; " << - "Tribol will use 'AUTO'." ); + SLIC_ERROR_ROOT_IF( meshId1==ANY_MESH, "meshId1 cannot be set to ANY_MESH" ); + SLIC_ERROR_ROOT_IF( !validMeshID( m_meshId1 ), "invalid meshId1=" << meshId1 ); + SLIC_ERROR_ROOT_IF( !validMeshID( m_meshId2 ), "invalid meshId2=" << meshId2 ); + + SLIC_ERROR_ROOT_IF( !in_range( contact_mode, NUM_CONTACT_MODES ), + "invalid contact_mode=" << contact_mode ); + SLIC_ERROR_ROOT_IF( !in_range( contact_method, NUM_CONTACT_METHODS ), + "invalid contact_method=" << contact_method ); + SLIC_ERROR_ROOT_IF( !in_range( contact_model, NUM_CONTACT_MODELS ), + "invalid contact_model=" << contact_model ); + SLIC_ERROR_ROOT_IF( !in_range( enforcement_method, NUM_ENFORCEMENT_METHODS ), + "invalid enforcement_method=" << enforcement_method ); + SLIC_ERROR_ROOT_IF( !in_range( binning_method, NUM_BINNING_METHODS ), + "invalid binning_method=" << binning_method ); m_contactMode = static_cast( contact_mode ); m_contactCase = static_cast( contact_case ); @@ -360,6 +355,8 @@ CouplingScheme::CouplingScheme( integer couplingSchemeId, m_couplingSchemeInfo.cs_case_info = NO_CASE_INFO; m_couplingSchemeInfo.cs_enforcement_info = NO_ENFORCEMENT_INFO; + m_loggingLevel = UNDEFINED; + // STEP 0: create contact-pairs object associated with this coupling scheme m_interfacePairs = new InterfacePairs( ); @@ -379,7 +376,7 @@ bool CouplingScheme::isValidCouplingScheme() MeshManager & meshManager = MeshManager::getInstance(); if (!meshManager.hasMesh(this->m_meshId1) || !meshManager.hasMesh(this->m_meshId2)) { - SLIC_WARNING("Please register meshes for coupling scheme, " << this->m_id << "."); + SLIC_WARNING_ROOT("Please register meshes for coupling scheme, " << this->m_id << "."); return false; } @@ -389,24 +386,23 @@ bool CouplingScheme::isValidCouplingScheme() // check for invalid mesh topology matches in a coupling scheme if (mesh1.m_elementType != mesh2.m_elementType) { - SLIC_WARNING("Coupling scheme, " << this->m_id << ", does not support meshes with " << - "different surface element types."); + SLIC_WARNING_ROOT("Coupling scheme, " << this->m_id << ", does not support meshes with " << + "different surface element types."); mesh1.m_isValid = false; mesh2.m_isValid = false; } + // check for invalid meshes. A mesh could be deemed invalid when registered. if (!mesh1.m_isValid || !mesh2.m_isValid) { - SLIC_WARNING("Coupling scheme, " << this->m_id << ", does not have valid meshes."); return false; } - // return early for coupling schemes with one or both null meshes. These are no-op coupling schemes + // set boolean for null meshes if ( mesh1.m_numCells <= 0 || mesh2.m_numCells <= 0 ) { - SLIC_INFO("Coupling scheme, " << this->m_id << ", has null-mesh(es)."); this->m_nullMeshes = true; - return false; + valid = false; } // check valid contact mode. Not all modes have an implementation @@ -548,66 +544,69 @@ bool CouplingScheme::isValidMethod() MeshData & mesh2 = meshManager.GetMeshInstance( this->m_meshId2 ); integer dim = this->spatialDimension(); - // check all methods for basic validity issues - if ( this->m_contactMethod == ALIGNED_MORTAR || - this->m_contactMethod == MORTAR_WEIGHTS || - this->m_contactMethod == SINGLE_MORTAR ) + // check all methods for basic validity issues for non-null meshes + if (!this->m_nullMeshes) { - if (mesh1.m_numNodesPerCell != mesh2.m_numNodesPerCell) + if ( this->m_contactMethod == ALIGNED_MORTAR || + this->m_contactMethod == MORTAR_WEIGHTS || + this->m_contactMethod == SINGLE_MORTAR ) { - this->m_couplingSchemeErrors.cs_method_error = DIFFERENT_FACE_TYPES; - return false; - } - if( this->m_meshId1 == this->m_meshId2 ) - { - this->m_couplingSchemeErrors.cs_method_error = SAME_MESH_IDS; - if (dim != 3) + if (mesh1.m_numNodesPerCell != mesh2.m_numNodesPerCell) + { + this->m_couplingSchemeErrors.cs_method_error = DIFFERENT_FACE_TYPES; + return false; + } + if( this->m_meshId1 == this->m_meshId2 ) { - this->m_couplingSchemeErrors.cs_method_error = SAME_MESH_IDS_INVALID_DIM; + this->m_couplingSchemeErrors.cs_method_error = SAME_MESH_IDS; + if (dim != 3) + { + this->m_couplingSchemeErrors.cs_method_error = SAME_MESH_IDS_INVALID_DIM; + } + return false; } - return false; - } - if (dim != 3) + if (dim != 3) + { + this->m_couplingSchemeErrors.cs_method_error = INVALID_DIM; + return false; + } + } + else if ( this->m_contactMethod == COMMON_PLANE ) { - this->m_couplingSchemeErrors.cs_method_error = INVALID_DIM; - return false; - } - } - else if ( this->m_contactMethod == COMMON_PLANE ) - { - // check for different face types. This is not yet supported - if (mesh1.m_numNodesPerCell != mesh2.m_numNodesPerCell) + // check for different face types. This is not yet supported + if (mesh1.m_numNodesPerCell != mesh2.m_numNodesPerCell) + { + this->m_couplingSchemeErrors.cs_method_error = DIFFERENT_FACE_TYPES; + return false; + } + } // end switch on contact method + else { - this->m_couplingSchemeErrors.cs_method_error = DIFFERENT_FACE_TYPES; + // if we are here there may be a method with no implementation. + // See note at top of routine. + this->m_couplingSchemeErrors.cs_method_error = NO_METHOD_IMPLEMENTATION; return false; } - } // end switch on contact method - else - { - // if we are here there may be a method with no implementation. - // See note at top of routine. - this->m_couplingSchemeErrors.cs_method_error = NO_METHOD_IMPLEMENTATION; - return false; - } - if ( this->m_contactMethod == ALIGNED_MORTAR || - this->m_contactMethod == SINGLE_MORTAR || - this->m_contactMethod == COMMON_PLANE ) - { - if ( mesh1.m_numCells > 0 && !mesh1.m_nodalFields.m_is_nodal_response_set ) + if ( this->m_contactMethod == ALIGNED_MORTAR || + this->m_contactMethod == SINGLE_MORTAR || + this->m_contactMethod == COMMON_PLANE ) { - this->m_couplingSchemeErrors.cs_method_error = NULL_NODAL_RESPONSE; - return false; - } + if ( mesh1.m_numCells > 0 && !mesh1.m_nodalFields.m_is_nodal_response_set ) + { + this->m_couplingSchemeErrors.cs_method_error = NULL_NODAL_RESPONSE; + return false; + } - if ( mesh2.m_numCells > 0 && !mesh2.m_nodalFields.m_is_nodal_response_set ) - { - this->m_couplingSchemeErrors.cs_method_error = NULL_NODAL_RESPONSE; - return false; + if ( mesh2.m_numCells > 0 && !mesh2.m_nodalFields.m_is_nodal_response_set ) + { + this->m_couplingSchemeErrors.cs_method_error = NULL_NODAL_RESPONSE; + return false; + } + } - - } + } // end if-check on non-null meshes // TODO check for nodal displacements for methods that require this data @@ -798,52 +797,56 @@ int CouplingScheme::checkEnforcementData() this->m_couplingSchemeErrors.cs_enforcement_data_error = NO_ENFORCEMENT_DATA_ERROR; + // perform check for non-null meshes int err = 0; - switch (this->m_contactMethod) + if (!this->m_nullMeshes) { - case MORTAR_WEIGHTS: - // no-op for now - break; - case ALIGNED_MORTAR: - // don't break - case SINGLE_MORTAR: + switch (this->m_contactMethod) { - if (!mesh2.m_nodalFields.m_is_node_gap_set) // nonmortar side only - { - this->m_couplingSchemeErrors.cs_enforcement_data_error = ERROR_IN_REGISTERED_ENFORCEMENT_DATA; - err = 1; - } - - if (!mesh2.m_nodalFields.m_is_node_pressure_set) // nonmortar side only + case MORTAR_WEIGHTS: + // no-op for now + break; + case ALIGNED_MORTAR: + // don't break + case SINGLE_MORTAR: { - this->m_couplingSchemeErrors.cs_enforcement_data_error = ERROR_IN_REGISTERED_ENFORCEMENT_DATA; - err = 1; - } - break; - } - case COMMON_PLANE: - { - switch (this->m_enforcementMethod) + if (!mesh2.m_nodalFields.m_is_node_gap_set) // nonmortar side only + { + this->m_couplingSchemeErrors.cs_enforcement_data_error = ERROR_IN_REGISTERED_ENFORCEMENT_DATA; + err = 1; + } + + if (!mesh2.m_nodalFields.m_is_node_pressure_set) // nonmortar side only + { + this->m_couplingSchemeErrors.cs_enforcement_data_error = ERROR_IN_REGISTERED_ENFORCEMENT_DATA; + err = 1; + } + break; + } + case COMMON_PLANE: { - case PENALTY: + switch (this->m_enforcementMethod) { - PenaltyEnforcementOptions& pen_enfrc_options = this->m_enforcementOptions.penalty_options; - if (mesh1.checkPenaltyData( pen_enfrc_options ) != 0 || - mesh2.checkPenaltyData( pen_enfrc_options ) != 0) + case PENALTY: { - this->m_couplingSchemeErrors.cs_enforcement_data_error - = ERROR_IN_REGISTERED_ENFORCEMENT_DATA; - err = 1; - } - break; - } // end case PENALTY - default: - break; - } // end switch over enforcement method - } // end case COMMON_PLANE - default: - break; - } // end switch on method + PenaltyEnforcementOptions& pen_enfrc_options = this->m_enforcementOptions.penalty_options; + if (mesh1.checkPenaltyData( pen_enfrc_options ) != 0 || + mesh2.checkPenaltyData( pen_enfrc_options ) != 0) + { + this->m_couplingSchemeErrors.cs_enforcement_data_error + = ERROR_IN_REGISTERED_ENFORCEMENT_DATA; + err = 1; + } + break; + } // end case PENALTY + default: + break; + } // end switch over enforcement method + } // end case COMMON_PLANE + default: + break; + } // end switch on method + } // end if-check on non-null meshes return err; @@ -890,11 +893,12 @@ int CouplingScheme::apply( integer cycle, real t, real &dt ) // loop over number of interface pairs IndexType numPairs = m_interfacePairs->getNumPairs(); - SLIC_INFO("Coupling scheme " << m_id << " has " << numPairs << " pairs."); + SLIC_DEBUG("Coupling scheme " << m_id << " has " << numPairs << " pairs."); // loop over all pairs and perform geometry checks to see if they // are interacting int numActivePairs = 0; + int pair_err = 0; for (IndexType kp = 0; kp < numPairs; ++kp) { InterfacePair pair = m_interfacePairs->getInterfacePair(kp); @@ -902,10 +906,22 @@ int CouplingScheme::apply( integer cycle, real t, real &dt ) // call wrapper around the contact method/case specific // geometry checks to determine whether to include a pair // in the active set - bool interact = CheckInterfacePair( pair, m_contactMethod, - m_contactCase ); + bool interact = false; + FaceGeomError interact_err = CheckInterfacePair( pair, m_contactMethod, + m_contactCase, interact ); + - if (!interact) + // TODO refine how these errors are handled. Here we skip over face-pairs with errors. That is, + // they are not registered for contact, but we don't error out. + if (interact_err != NO_FACE_GEOM_ERROR) + { + pair_err = 1; + pair.inContact = false; + // TODO consider printing offending face(s) coordinates for debugging + SLIC_DEBUG("Face geometry error, " << static_cast(interact_err) << "for pair, " << kp << "."); + continue; + } + else if (!interact) { pair.inContact = false; } @@ -921,9 +937,17 @@ int CouplingScheme::apply( integer cycle, real t, real &dt ) } // end loop over pairs + // TODO refine how this logging is handled. This just detects an issue with a face-pair geometry + // (which has been skipped over for contact eligibility) and reports this warning. Do we want to + // error out, or let a user detect bad contact behavior, but with a contact interaction that still + // runs? + SLIC_WARNING_IF(pair_err!=0, "CouplingScheme::apply(): error with orientation, input, " << + "or invalid overlaps in CheckInterfacePair()."); + this->m_numActivePairs = numActivePairs; - SLIC_INFO("Number of active interface pairs: " << numActivePairs); + // aggregate across ranks for this coupling scheme? SRW + SLIC_DEBUG("Number of active interface pairs: " << numActivePairs); // wrapper around contact method, case, and // enforcement to apply the interface physics in both @@ -932,26 +956,29 @@ int CouplingScheme::apply( integer cycle, real t, real &dt ) // appropriate physics in the normal and tangential directions. int err = ApplyInterfacePhysics( this, cycle, t ); - if (err) - { - SLIC_WARNING("CouplingScheme::apply(): error in ApplyInterfacePhysics for " << + SLIC_WARNING_IF(err!=0, "CouplingScheme::apply(): error in ApplyInterfacePhysics for " << "coupling scheme, " << this->m_id << "."); - } // compute Tribol timestep vote on the coupling scheme - computeTimeStep(dt); - - if (dt > 0.) + if (err==0 && numActivePairs>0) { - SLIC_INFO( "The Tribol timestep vote is: " << dt ); + computeTimeStep(dt); } // write output writeInterfaceOutput( params.output_directory, params.vis_type, cycle, t ); + + if (err != 0 || pair_err != 0) + { + return 1; + } + else + { + return 0; + } - return err; } // end CouplingScheme::apply() //------------------------------------------------------------------------------ @@ -962,6 +989,8 @@ bool CouplingScheme::init() valid = this->isValidCouplingScheme(); if (valid) { + // set individual coupling scheme logging level + this->setSlicLoggingLevel(); this->allocateMethodData(); return true; } @@ -971,6 +1000,42 @@ bool CouplingScheme::init() } } //------------------------------------------------------------------------------ +void CouplingScheme::setSlicLoggingLevel() +{ + // set slic logging level for coupling schemes that have API modified logging levels + if (this->m_loggingLevel != UNDEFINED) + { + switch (this->m_loggingLevel) + { + case DEBUG: + { + axom::slic::setLoggingMsgLevel( axom::slic::message::Debug ); + break; + } + case INFO: + { + axom::slic::setLoggingMsgLevel( axom::slic::message::Info ); + break; + } + case WARNING: + { + axom::slic::setLoggingMsgLevel( axom::slic::message::Warning ); + break; + } + case ERROR: + { + axom::slic::setLoggingMsgLevel( axom::slic::message::Error ); + break; + } + default: + { + axom::slic::setLoggingMsgLevel( axom::slic::message::Warning ); + break; + } + } // end switch + } // end if +} +//------------------------------------------------------------------------------ void CouplingScheme::allocateMethodData() { // check for valid coupling schemes for those with non-null meshes. @@ -1356,8 +1421,8 @@ void CouplingScheme::computeCommonPlaneTimeStep(real &dt) dt1 = (dt1_check1) ? -alpha * delta1 / v1_dot_n1 : dt1; dt2 = (dt2_check1) ? -alpha * delta2 / v2_dot_n2 : dt2; - SLIC_ERROR_IF( dt1<0, "Common plane timestep vote for gap-check of face 1 is negative."); - SLIC_ERROR_IF( dt2<0, "Common plane timestep vote for gap-check of face 2 is negative."); + SLIC_ERROR_IF( dt1<0., "Common plane timestep vote for gap-check of face 1 is negative."); + SLIC_ERROR_IF( dt2<0., "Common plane timestep vote for gap-check of face 2 is negative."); dt_temp1 = axom::utilities::min(dt_temp1, axom::utilities::min(dt1, dt2)); @@ -1431,6 +1496,7 @@ void CouplingScheme::computeCommonPlaneTimeStep(real &dt) } // end case 2 } // end loop over interface pairs + // Can we output this message on root? SRW if (tiny_vel_msg) { SLIC_INFO( "tribol::computeCommonPlaneTimeStep(): initial mesh overlap is too large " << @@ -1462,6 +1528,7 @@ void CouplingScheme::writeInterfaceOutput( const std::string& dir, dim, cycle, t ); break; default : + // Can this be called on root? SRW SLIC_INFO( "CouplingScheme::writeInterfaceOutput(): " << "output routine not yet written for interface method. " ); break; diff --git a/src/tribol/mesh/CouplingScheme.hpp b/src/tribol/mesh/CouplingScheme.hpp index fce76eb5..963d83ac 100644 --- a/src/tribol/mesh/CouplingScheme.hpp +++ b/src/tribol/mesh/CouplingScheme.hpp @@ -333,6 +333,24 @@ class CouplingScheme const integer cycle, const real t ); + /*! + * \brief Sets the coupling scheme logging level member variable + * + * \param [in] log_level the LoggingLevel enum value + * + */ + void setLoggingLevel( const LoggingLevel log_level ) { m_loggingLevel = log_level; } + + /*! + * \brief Sets the SLIC logging level per the coupling scheme logging level + * + * \pre must call setLoggingLevel() first + * + */ + void setSlicLoggingLevel(); + + LoggingLevel getLoggingLevel() const { return m_loggingLevel; } + #ifdef BUILD_REDECOMP /** @@ -521,6 +539,8 @@ class CouplingScheme EnforcementMethod m_enforcementMethod; ///< Contact enforcement method BinningMethod m_binningMethod; ///< Contact binning method + LoggingLevel m_loggingLevel; ///< logging level enum for coupling scheme + bool m_fixedBinning; ///< True if using fixed binning for all cycles bool m_isBinned; ///< True if binning has occured bool m_isTied; ///< True if surfaces have been "tied" (Tied contact only) diff --git a/src/tribol/mesh/MeshData.cpp b/src/tribol/mesh/MeshData.cpp index 02ececbc..16d85d3b 100644 --- a/src/tribol/mesh/MeshData.cpp +++ b/src/tribol/mesh/MeshData.cpp @@ -5,7 +5,6 @@ #include "tribol/mesh/MeshData.hpp" #include "tribol/utils/Math.hpp" -#include "tribol/common/logger.hpp" #include #include @@ -633,7 +632,7 @@ void MeshData::computeNodalNormals( int const dim ) if (this->m_nX == nullptr || this->m_nY == nullptr) { - TRIBOL_ERROR("MeshData::computeNodalNormals: required face normals not computed."); + SLIC_ERROR("MeshData::computeNodalNormals: required face normals not computed."); } // allocate space for nodal normal array @@ -845,7 +844,6 @@ int MeshData::checkPenaltyData( PenaltyEnforcementOptions& p_enfrc_options ) { if (!this->m_elemData.isValidKinematicPenalty( p_enfrc_options )) { - SLIC_WARNING("Invalid Kinematic penalty data."); err = 1; } break; @@ -855,12 +853,10 @@ int MeshData::checkPenaltyData( PenaltyEnforcementOptions& p_enfrc_options ) { if (!this->m_elemData.isValidKinematicPenalty( p_enfrc_options )) { - SLIC_WARNING("Invalid Kinematic penalty data."); err = 1; } if (!this->m_elemData.isValidRatePenalty( p_enfrc_options )) { - SLIC_WARNING("Invalid Rate penalty data."); err = 1; } if (!this->m_nodalFields.m_is_velocity_set) diff --git a/src/tribol/mesh/MeshManager.hpp b/src/tribol/mesh/MeshManager.hpp index b0a11dcf..4484eba9 100644 --- a/src/tribol/mesh/MeshManager.hpp +++ b/src/tribol/mesh/MeshManager.hpp @@ -71,9 +71,6 @@ class MeshManager { if ( hasMesh( meshID ) ) { - TRIBOL_DEBUG_LOG( "MeshData::CreateMesh(): new mesh with id, " << meshID << - ", overwriting existing registered mesh with same id." ); - m_meshInstances.erase(meshID); } return m_meshInstances[meshID]; diff --git a/src/tribol/physics/AlignedMortar.cpp b/src/tribol/physics/AlignedMortar.cpp index cab67e26..f6882aba 100644 --- a/src/tribol/physics/AlignedMortar.cpp +++ b/src/tribol/physics/AlignedMortar.cpp @@ -19,7 +19,6 @@ #include "tribol/integ/FE.hpp" #include "tribol/utils/ContactPlaneOutput.hpp" #include "tribol/utils/Math.hpp" -#include "tribol/common/logger.hpp" #include #include @@ -68,12 +67,8 @@ void ComputeAlignedMortarWeights( SurfaceContactElem & elem ) int mortarNonmortarId = elem.numFaceVert * elem.numFaceVert + elem.numFaceVert * a + b; - #ifdef TRIBOL_DEBUG_LOG - if (nonmortarNonmortarId > elem.numWts || mortarNonmortarId > elem.numWts) - { - TRIBOL_ERROR("ComputeAlignedMortarWeights: integer ids for weights exceed elem.numWts"); - } - #endif /* TRIBOL_DEBUG_LOG */ + SLIC_ERROR_IF(nonmortarNonmortarId > elem.numWts || mortarNonmortarId > elem.numWts, + "ComputeAlignedMortarWeights: integer ids for weights exceed elem.numWts"); // compute nonmortar/nonmortar mortar weight elem.mortarWts[ nonmortarNonmortarId ] += integ.wts[ip] * phiNonmortarA * phiNonmortarB; @@ -91,32 +86,13 @@ void ComputeAlignedMortarWeights( SurfaceContactElem & elem ) template< > void ComputeNodalGap< ALIGNED_MORTAR >( SurfaceContactElem & elem ) { - // check to make sure mortar weights have been computed locally - // for the SurfaceContactElem object - #ifdef TRIBOL_DEBUG_LOG - if (elem.mortarWts == nullptr) - { - TRIBOL_ERROR("ComputeNodalGap< ALIGNED_MORTAR >: compute local weights on input struct first."); - } - #endif /* TRIBOL_DEBUG_LOG */ - // get mesh instance to store gaps on mesh data object MeshManager& meshManager = MeshManager::getInstance(); MeshData& nonmortarMesh = meshManager.GetMeshInstance( elem.meshId2 ); IndexType const * const nonmortarConn = nonmortarMesh.m_connectivity; - - #ifdef TRIBOL_DEBUG_LOG - // will populate local gaps on nonmortar face on nonmortar mesh data object - real* meshGaps = nonmortarMesh.m_nodalFields.m_node_gap; - if (meshGaps == nullptr) - { - TRIBOL_ERROR("ComputeNodalGap< ALIGNED_MORTAR >: allocate gaps on mesh data object."); - } - #endif /* TRIBOL_DEBUG_LOG */ - - // allocate local space for local gap computation on nonmortar face -// real localGaps[ elem.numFaceVert ]; + SLIC_ERROR_IF(nonmortarMesh.m_nodalFields.m_node_gap == nullptr, + "ComputeNodalGap< ALIGNED_MORTAR >: allocate gaps on mesh data object."); // compute gap contributions associated with face 2 on the SurfaceContactElem // (i.e. nonmortar surface) diff --git a/src/tribol/physics/CommonPlane.cpp b/src/tribol/physics/CommonPlane.cpp index 6785e820..f4107ccb 100644 --- a/src/tribol/physics/CommonPlane.cpp +++ b/src/tribol/physics/CommonPlane.cpp @@ -173,6 +173,8 @@ int ApplyNormal< COMMON_PLANE, PENALTY >( CouplingScheme const * cs ) parameters_t& parameters = parameters_t::getInstance(); integer const dim = parameters.dimension; + LoggingLevel logLevel = cs->getLoggingLevel(); + //////////////////////////////// // Grab pointers to mesh data // //////////////////////////////// @@ -233,10 +235,8 @@ int ApplyNormal< COMMON_PLANE, PENALTY >( CouplingScheme const * cs ) } // debug force sums - #ifdef TRIBOL_DEBUG_LOG - real dbg_sum_force1 {0.}; - real dbg_sum_force2 {0.}; - #endif /* TRIBOL_DEBUG_LOG */ + real dbg_sum_force1 {0.}; + real dbg_sum_force2 {0.}; ///////////////////////////////////////////// // kinematic penalty stiffness calculation // @@ -304,12 +304,10 @@ int ApplyNormal< COMMON_PLANE, PENALTY >( CouplingScheme const * cs ) // debug prints. Comment out for now, but keep for future common plane // debugging - #ifdef TRIBOL_DEBUG_LOG -// SLIC_INFO("gap: " << gap); -// SLIC_INFO("area: " << A); -// SLIC_INFO("penalty stiffness: " << penalty_stiff_per_area); -// SLIC_INFO("pressure: " << cpManager.m_pressure[ cpID ]); - #endif /* TRIBOL_DEBUG_LOG */ +// SLIC_DEBUG("gap: " << gap); +// SLIC_DEBUG("area: " << A); +// SLIC_DEBUG("penalty stiffness: " << penalty_stiff_per_area); +// SLIC_DEBUG("pressure: " << cpManager.m_pressure[ cpID ]); /////////////////////////////////////////// // create surface contact element struct // @@ -399,8 +397,11 @@ int ApplyNormal< COMMON_PLANE, PENALTY >( CouplingScheme const * cs ) IndexType node0 = nodalConnectivity1[ index1*numNodesPerFace + a ]; IndexType node1 = nodalConnectivity2[ index2*numNodesPerFace + a ]; - phi_sum_1 += phi1[a]; - phi_sum_2 += phi2[a]; + if (logLevel == DEBUG) + { + phi_sum_1 += phi1[a]; + phi_sum_2 += phi2[a]; + } const real nodal_force_x1 = force_x * phi1[a]; const real nodal_force_y1 = force_y * phi1[a]; @@ -410,14 +411,15 @@ int ApplyNormal< COMMON_PLANE, PENALTY >( CouplingScheme const * cs ) const real nodal_force_y2 = force_y * phi2[a]; const real nodal_force_z2 = force_z * phi2[a]; - #ifdef TRIBOL_DEBUG_LOG + if (logLevel == DEBUG) + { dbg_sum_force1 += magnitude( nodal_force_x1, nodal_force_y1, nodal_force_z1 ); dbg_sum_force2 += magnitude( nodal_force_x2, nodal_force_y2, nodal_force_z2 ); - #endif /* TRIBOL_DEBUG_LOG */ + } // accumulate contributions in host code's registered nodal force arrays fx1[ node0 ] -= nodal_force_x1; @@ -436,12 +438,10 @@ int ApplyNormal< COMMON_PLANE, PENALTY >( CouplingScheme const * cs ) // comment out debug logs; too much output during tests. Keep for easy // debugging if needed - #ifdef TRIBOL_DEBUG_LOG -// SLIC_INFO("force sum, side 1, pair " << kp << ": " << -dbg_sum_force1 ); -// SLIC_INFO("force sum, side 2, pair " << kp << ": " << dbg_sum_force2 ); -// SLIC_INFO("phi 1 sum: " << phi_sum_1 ); -// SLIC_INFO("phi 2 sum: " << phi_sum_2 ); - #endif /* TRIBOL_DEBUG_LOG */ + //SLIC_DEBUG("force sum, side 1, pair " << kp << ": " << -dbg_sum_force1 ); + //SLIC_DEBUG("force sum, side 2, pair " << kp << ": " << dbg_sum_force2 ); + //SLIC_DEBUG("phi 1 sum: " << phi_sum_1 ); + //SLIC_DEBUG("phi 2 sum: " << phi_sum_2 ); // increment contact plane id ++cpID; diff --git a/src/tribol/physics/Mortar.cpp b/src/tribol/physics/Mortar.cpp index 27f3513a..9eefb580 100644 --- a/src/tribol/physics/Mortar.cpp +++ b/src/tribol/physics/Mortar.cpp @@ -19,7 +19,6 @@ #include "tribol/integ/FE.hpp" #include "tribol/utils/ContactPlaneOutput.hpp" #include "tribol/utils/Math.hpp" -#include "tribol/common/logger.hpp" // Axom includes #include "axom/slic.hpp" @@ -95,12 +94,8 @@ void ComputeMortarWeights( SurfaceContactElem & elem ) LinIsoQuadShapeFunc( xi[0], xi[1], a, phiNonmortarA ); LinIsoQuadShapeFunc( xi[0], xi[1], b, phiNonmortarB ); - #ifdef TRIBOL_DEBUG_LOG - if (nonmortarNonmortarId > elem.numWts || mortarNonmortarId > elem.numWts) - { - TRIBOL_ERROR("ComputeMortarWts: integer ids for weights exceed elem.numWts"); - } - #endif /* TRIBOL_DEBUG_LOG */ + SLIC_ERROR_IF(nonmortarNonmortarId > elem.numWts || mortarNonmortarId > elem.numWts, + "ComputeMortarWts: integer ids for weights exceed elem.numWts"); // compute nonmortar/nonmortar mortar weight elem.mortarWts[ nonmortarNonmortarId ] += integ.wts[ip] * phiNonmortarA * phiNonmortarB; @@ -123,12 +118,7 @@ void ComputeNodalGap< SINGLE_MORTAR >( SurfaceContactElem & elem ) { // check to make sure mortar weights have been computed locally // for the SurfaceContactElem object - #ifdef TRIBOL_DEBUG_LOG - if (elem.mortarWts == nullptr) - { - TRIBOL_ERROR("ComputeNodalGap< SINGLE_MORTAR >: compute local weights on input struct first."); - } - #endif /* TRIBOL_DEBUG_LOG */ + SLIC_ERROR_IF(elem.mortarWts==nullptr, "ComputeNodalGap< SINGLE_MORTAR >: compute local weights on input struct first."); // get mesh instance to store gaps on mesh data object MeshManager& meshManager = MeshManager::getInstance(); @@ -136,15 +126,11 @@ void ComputeNodalGap< SINGLE_MORTAR >( SurfaceContactElem & elem ) IndexType const * const nonmortarConn = nonmortarMesh.m_connectivity; // will populate local gaps on nonmortar face on nonmortar mesh data object - if (nonmortarMesh.m_nodalFields.m_node_gap == nullptr) - { - SLIC_ERROR("ComputeNodalGap< SINGLE_MORTAR >: allocate gaps on mesh data object."); - } + SLIC_ERROR_IF(nonmortarMesh.m_nodalFields.m_node_gap == nullptr, + "ComputeNodalGap< SINGLE_MORTAR >: allocate gaps on mesh data object."); - if (nonmortarMesh.m_node_nX == nullptr || nonmortarMesh.m_node_nY == nullptr) - { - SLIC_ERROR("ComputeNodalGap< SINGLE_MORTAR >: allocate and compute nodal normals on mesh data object."); - } + SLIC_ERROR_IF(nonmortarMesh.m_node_nX == nullptr || nonmortarMesh.m_node_nY == nullptr, + "ComputeNodalGap< SINGLE_MORTAR >: allocate and compute nodal normals on mesh data object."); // compute gap contributions associated with face 2 on the SurfaceContactElem // (i.e. nonmortar surface) @@ -395,7 +381,8 @@ int ApplyNormal< SINGLE_MORTAR, LAGRANGE_MULTIPLIER >( CouplingScheme const * cs } else { - SLIC_ERROR("Unsupported Jacobian storage method."); + SLIC_WARNING("Unsupported Jacobian storage method."); + return 1; } //////////////////////////////////////////////////////////////// @@ -524,7 +511,8 @@ int ApplyNormal< SINGLE_MORTAR, LAGRANGE_MULTIPLIER >( CouplingScheme const * cs } else { - SLIC_ERROR("Unsupported Jacobian storage method."); + SLIC_WARNING("Unsupported Jacobian storage method."); + return 1; } } @@ -817,9 +805,12 @@ int GetMethodData< MORTAR_WEIGHTS >( CouplingScheme const * cs ) // Note: active nonmortar nodes (i.e. active gaps) are checked in this routine. const EnforcementOptions& enforcement_options = const_cast(cs->getEnforcementOptions()); const SparseMode sparse_mode = enforcement_options.lm_implicit_options.sparse_mode; - SLIC_ERROR_IF(sparse_mode == SparseMode::MFEM_ELEMENT_DENSE, - "GetMethodData() MFEM_ELEMENT_DENSE " << - "Unassembled element dense matrix output not implemented."); + if (sparse_mode == SparseMode::MFEM_ELEMENT_DENSE) + { + SLIC_WARNING( "GetMethodData() MFEM_ELEMENT_DENSE " << + "Unassembled element dense matrix output not implemented." ); + return 1; + } static_cast( cs->getMethodData() )->assembleMortarWts( elem, sparse_mode ); ++cpID; diff --git a/src/tribol/physics/Physics.cpp b/src/tribol/physics/Physics.cpp index 08df5a0b..ecf6fd26 100644 --- a/src/tribol/physics/Physics.cpp +++ b/src/tribol/physics/Physics.cpp @@ -31,6 +31,7 @@ int ApplyInterfacePhysics( CouplingScheme const * cs, int err_nrml = false; int err_tang = false; + int err_data = false; // switch over numerical method switch ( cs->getContactMethod() ) @@ -97,7 +98,7 @@ int ApplyInterfacePhysics( CouplingScheme const * cs, case MORTAR_WEIGHTS: // no enforcement for this method and no need to call visualization. - GetMethodData< MORTAR_WEIGHTS >( cs ); + err_data = GetMethodData< MORTAR_WEIGHTS >( cs ); break; default: @@ -107,22 +108,32 @@ int ApplyInterfacePhysics( CouplingScheme const * cs, } // end switch (method) + // error checking if ( err_nrml != 0 ) { - SLIC_INFO("ApplyInterfacePhysics: error in application of " << - "'normal' physics method for " << - "coupling scheme, " << cs->getId() << "."); + // note, not all ranks will get here if a rank has null-meshes + SLIC_WARNING("ApplyInterfacePhysics: error in application of " << + "'normal' physics method for " << + "coupling scheme, " << cs->getId() << "."); return err_nrml; } else if ( err_tang != 0 ) { - SLIC_INFO("ApplyInterfacePhysics: error in application of " << - "'tangential' physics method for " << - "coupling scheme, " << cs->getId() << "."); + // note, not all ranks will get here if a rank has null-meshes + SLIC_WARNING("ApplyInterfacePhysics: error in application of " << + "'tangential' physics method for " << + "coupling scheme, " << cs->getId() << "."); return err_tang; } + else if ( err_data != 0 ) + { + // note, not all ranks will get here if a rank has null-meshes + SLIC_WARNING("ApplyInterfacePhysics: error in call to " << + "GetMethodData for coupling scheme, " << cs->getId() << "."); + return err_data; + } else { // no error diff --git a/src/tribol/search/InterfacePairFinder.cpp b/src/tribol/search/InterfacePairFinder.cpp index 7f5f9a46..34100e20 100644 --- a/src/tribol/search/InterfacePairFinder.cpp +++ b/src/tribol/search/InterfacePairFinder.cpp @@ -364,10 +364,10 @@ class GridSearch m_grid.insert(m_meshBBoxes1[i], i); } - // OUtput some info for debugging + // Output some info for debugging if(true) { - SLIC_INFO("Implicit Grid info: " + SLIC_DEBUG("Implicit Grid info: " << "\n Mesh 1 bounding box (inflated): " << m_gridBBox << "\n Avg range: " << ranges << "\n Computed resolution: " << resolution ); @@ -378,7 +378,7 @@ class GridSearch bbox2.addBox( m_meshWrapper2.elementBoundingBox(i) ); } - SLIC_INFO( "Mesh 2 bounding box is: " << bbox2 ); + SLIC_DEBUG( "Mesh 2 bounding box is: " << bbox2 ); } } // end generateSpatialIndex() @@ -522,7 +522,7 @@ class GridSearch } } - SLIC_INFO("Coupling scheme has " << contactPairs->getNumPairs() + SLIC_DEBUG("Coupling scheme has " << contactPairs->getNumPairs() << " pairs." << " Expected " << numPairs << " = " << mesh1NumElems << " * " << mesh2NumElems << "."); diff --git a/src/tribol/utils/ContactPlaneOutput.cpp b/src/tribol/utils/ContactPlaneOutput.cpp index 0c90aafe..d3690037 100644 --- a/src/tribol/utils/ContactPlaneOutput.cpp +++ b/src/tribol/utils/ContactPlaneOutput.cpp @@ -98,6 +98,7 @@ void WriteContactPlaneMeshToVtk( const std::string& dir, const VisType v_type, overlaps = true; break; default : + // Can this be output on root? SRW overlaps = true; // set default for now; refactoring SLIC_INFO( "WriteInterfaceMeshToVtk: visualization type not supported." << " Printing overlaps only." ); diff --git a/src/tribol/utils/Math.cpp b/src/tribol/utils/Math.cpp index 47ad75ec..0fce80b4 100644 --- a/src/tribol/utils/Math.cpp +++ b/src/tribol/utils/Math.cpp @@ -86,7 +86,7 @@ int binary_search( const int * const array, { if (n == 0) { - SLIC_INFO("binary_search: n = 0 return infeasible index."); + SLIC_DEBUG("binary_search: n = 0 return infeasible index."); return -1; } else if (n == 1 && val == array[0]) @@ -95,7 +95,7 @@ int binary_search( const int * const array, } else if (n == 1 && val != array[0]) { - SLIC_INFO("binary_search: val is not equal to array[0] for n = 1."); + SLIC_DEBUG("binary_search: val is not equal to array[0] for n = 1."); return -1; } @@ -118,7 +118,7 @@ int binary_search( const int * const array, } } - SLIC_INFO("binary_search: could not locate value in provided array."); + SLIC_DEBUG("binary_search: could not locate value in provided array."); return -1; } diff --git a/src/tribol/utils/TestUtils.cpp b/src/tribol/utils/TestUtils.cpp index 82c5ed65..0c5cfcdf 100644 --- a/src/tribol/utils/TestUtils.cpp +++ b/src/tribol/utils/TestUtils.cpp @@ -773,9 +773,9 @@ void TestMesh::allocateAndSetVelocities( int meshId, real valX, real valY, real // Check that mesh ids are not the same. The TestMesh class was built around // testing the mortar method with Lagrange multiplier enforcement, which does not // support auto contact. - SLIC_WARNING_IF( this->mortarMeshId == this->nonmortarMeshId, - "TestMesh::allocateAndSetVelocities(): please set unique " << - "mortarMeshId and nonmortarMeshId prior to calling this routine."); + SLIC_ERROR_IF( this->mortarMeshId == this->nonmortarMeshId, + "TestMesh::allocateAndSetVelocities(): please set unique " << + "mortarMeshId and nonmortarMeshId prior to calling this routine."); // check to see if pointers have been set bool deleteVels = false; @@ -833,8 +833,8 @@ void TestMesh::allocateAndSetVelocities( int meshId, real valX, real valY, real "not a valid mesh id." ); } - SLIC_INFO_IF( deleteVels, "TestMesh::allocateAndSetVelocities(): " << - "a velocity array has been deleted and reallocated." ); + SLIC_DEBUG_IF( deleteVels, "TestMesh::allocateAndSetVelocities(): " << + "a velocity array has been deleted and reallocated." ); } // end TestMesh::allocateAndSetVelocities() @@ -844,9 +844,9 @@ void TestMesh::allocateAndSetBulkModulus( int meshId, real val ) // Check that mesh ids are the same. The TestMesh class was built around // testing the mortar method with Lagrange multiplier enforcement, which does // not support auto contact. - SLIC_WARNING_IF( this->mortarMeshId == this->nonmortarMeshId, - "TestMesh::allocateAndSetVelocities(): please set unique " << - "mortarMeshId and nonmortarMeshId prior to calling this routine."); + SLIC_ERROR_IF( this->mortarMeshId == this->nonmortarMeshId, + "TestMesh::allocateAndSetVelocities(): please set unique " << + "mortarMeshId and nonmortarMeshId prior to calling this routine."); // check to see if pointers have been set bool deleteData = false; @@ -876,8 +876,8 @@ void TestMesh::allocateAndSetBulkModulus( int meshId, real val ) "not a valid mesh id." ); } - SLIC_INFO_IF( deleteData, "TestMesh::allocateAndSetBulkModulus(): " << - "a bulk modulus array has been deleted and reallocated." ); + SLIC_DEBUG_IF( deleteData, "TestMesh::allocateAndSetBulkModulus(): " << + "a bulk modulus array has been deleted and reallocated." ); } // end TestMesh::allocateAndSetBulkModulus() @@ -912,8 +912,8 @@ void TestMesh::allocateAndSetElementThickness( int meshId, real t ) "not a valid mesh id." ); } - SLIC_INFO_IF( deleteData, "TestMesh::allocateAndSetElementThickness(): " << - "an element thickness array has been deleted and reallocated." ); + SLIC_DEBUG_IF( deleteData, "TestMesh::allocateAndSetElementThickness(): " << + "an element thickness array has been deleted and reallocated." ); } // end TestMesh::allocateAndSetElementThickness() @@ -1085,8 +1085,8 @@ int TestMesh::tribolSetupAndUpdate( ContactMethod method, { if (this->mortar_bulk_mod == nullptr) { - SLIC_INFO( "TestMesh::tribolSetupAndUpdate(): " << - "mortar_bulk_mod not set; registering default value." ); + SLIC_DEBUG_ROOT( "TestMesh::tribolSetupAndUpdate(): " << + "mortar_bulk_mod not set; registering default value." ); this->mortar_bulk_mod = new real[ this->numMortarFaces ]; for (int i=0; inumMortarFaces; ++i) { @@ -1095,8 +1095,8 @@ int TestMesh::tribolSetupAndUpdate( ContactMethod method, } if (this->mortar_element_thickness == nullptr) { - SLIC_INFO( "TestMesh::tribolSetupAndUpdate(): " << - "mortar_element_thickness not set; registering default value." ); + SLIC_DEBUG_ROOT( "TestMesh::tribolSetupAndUpdate(): " << + "mortar_element_thickness not set; registering default value." ); this->mortar_element_thickness = new real[ this->numMortarFaces ]; for (int i=0; inumMortarFaces; ++i) { @@ -1106,8 +1106,8 @@ int TestMesh::tribolSetupAndUpdate( ContactMethod method, if (this->nonmortar_bulk_mod == nullptr) { - SLIC_INFO( "TestMesh::tribolSetupAndUpdate(): " << - "nonmortar_bulk_mod not set; registering default value." ); + SLIC_DEBUG_ROOT( "TestMesh::tribolSetupAndUpdate(): " << + "nonmortar_bulk_mod not set; registering default value." ); this->nonmortar_bulk_mod = new real[ this->numNonmortarFaces ]; for (int i=0; inumNonmortarFaces; ++i) { @@ -1116,8 +1116,8 @@ int TestMesh::tribolSetupAndUpdate( ContactMethod method, } if (this->nonmortar_element_thickness == nullptr) { - SLIC_INFO( "TestMesh::tribolSetupAndUpdate(): " << - "nonmortar_element_thickness not set; registering default value." ); + SLIC_DEBUG_ROOT( "TestMesh::tribolSetupAndUpdate(): " << + "nonmortar_element_thickness not set; registering default value." ); this->nonmortar_element_thickness = new real[ this->numNonmortarFaces ]; for (int i=0; inumNonmortarFaces; ++i) { @@ -1174,6 +1174,8 @@ int TestMesh::tribolSetupAndUpdate( ContactMethod method, enforcement, BINNING_GRID ); + setLoggingLevel(csIndex, WARNING); + if (method == COMMON_PLANE && enforcement == PENALTY) { PenaltyConstraintType constraint_type = (params.constant_rate_penalty || params.percent_rate_penalty) @@ -1469,12 +1471,9 @@ void TestMesh::setupMfemMesh( bool fix_orientation ) SLIC_ERROR_IF( this->dim != 3, "TestMesh::setupMfemMesh(): Mfem meshes of dimension, " << this->dim << ", are not supported at this time." ); - SLIC_INFO( "Setting up 3D linear mfem mesh." ); - // construct new mfem mesh if (this->mfem_mesh != nullptr) { - SLIC_WARNING( "TestMesh::setupMfemMesh(): deleting previously constructed mesh." ); this->mfem_mesh->Clear(); } @@ -1482,8 +1481,6 @@ void TestMesh::setupMfemMesh( bool fix_orientation ) this->numTotalNodes, this->numTotalElements ); - SLIC_INFO("After calling mfem mesh constructor."); - // add mortar elements and vertices. Not sure if order of adding // elements matters, but adding vertices should probably correspond // to the global contiguous id system @@ -1586,8 +1583,6 @@ void TestMesh::setupMfemMesh( bool fix_orientation ) } } // end switch on surface cell type - SLIC_INFO( "3D linear mfem mesh finalized." ); - } // end setupMfemMesh() @@ -2101,4 +2096,4 @@ void ExplicitMechanics::Mult( } } -} // end of namespace "mfem_ext" \ No newline at end of file +} // end of namespace "mfem_ext"