diff --git a/examples/cube/cube_periodic_lexico.json b/examples/cube/cube_periodic_lexico.json new file mode 100644 index 000000000..b8f207b70 --- /dev/null +++ b/examples/cube/cube_periodic_lexico.json @@ -0,0 +1,68 @@ +{ + "Problem": + { + "Type": "Electrostatic", + "Verbose": 2, + "Output": "postpro" + }, + "Model": + { + "Mesh": "mesh/cube_lexico.mesh", + "L0": 1.0e-2 // cm + }, + "Domains": + { + "Materials": + [ + { + "Attributes": [1], + "Permittivity": 1.0 + } + ] + }, + "Boundaries": + { + "Periodic": + [ + { + "DonorAttributes": [3], + "ReceiverAttributes": [5], + "Direction": "X", + "Distance": 1.0e-2 // in L0 units + }, + { + "DonorAttributes": [2], + "ReceiverAttributes": [4], + "Direction": "Y", + "Distance": 1.0e-2 // in L0 units + } + ], + "Terminal": + [ + { + "Index": 1, + "Attributes": [1] + }, + { + "Index": 2, + "Attributes": [6] + } + ] + }, + "Solver": + { + "Order": 3, + "Device": "CPU", + "Electrostatic": + { + "Save": 2 + }, + "Linear": + { + "Type": "BoomerAMG", + "KSPType": "CG", + "Tol": 1.0e-8, + "MaxIts": 100 + } + } +} diff --git a/examples/cube/mesh/cube_lexico.mesh b/examples/cube/mesh/cube_lexico.mesh new file mode 100644 index 000000000..71def0cfd --- /dev/null +++ b/examples/cube/mesh/cube_lexico.mesh @@ -0,0 +1,312 @@ +MFEM mesh v1.0 + +# +# MFEM Geometry Types (see fem/geom.hpp): +# +# POINT = 0 +# SEGMENT = 1 +# TRIANGLE = 2 +# SQUARE = 3 +# TETRAHEDRON = 4 +# CUBE = 5 +# PRISM = 6 +# PYRAMID = 7 +# + +dimension +3 + +elements +64 +1 5 0 1 6 5 25 26 31 30 +1 5 1 2 7 6 26 27 32 31 +1 5 2 3 8 7 27 28 33 32 +1 5 3 4 9 8 28 29 34 33 +1 5 5 6 11 10 30 31 36 35 +1 5 6 7 12 11 31 32 37 36 +1 5 7 8 13 12 32 33 38 37 +1 5 8 9 14 13 33 34 39 38 +1 5 10 11 16 15 35 36 41 40 +1 5 11 12 17 16 36 37 42 41 +1 5 12 13 18 17 37 38 43 42 +1 5 13 14 19 18 38 39 44 43 +1 5 15 16 21 20 40 41 46 45 +1 5 16 17 22 21 41 42 47 46 +1 5 17 18 23 22 42 43 48 47 +1 5 18 19 24 23 43 44 49 48 +1 5 25 26 31 30 50 51 56 55 +1 5 26 27 32 31 51 52 57 56 +1 5 27 28 33 32 52 53 58 57 +1 5 28 29 34 33 53 54 59 58 +1 5 30 31 36 35 55 56 61 60 +1 5 31 32 37 36 56 57 62 61 +1 5 32 33 38 37 57 58 63 62 +1 5 33 34 39 38 58 59 64 63 +1 5 35 36 41 40 60 61 66 65 +1 5 36 37 42 41 61 62 67 66 +1 5 37 38 43 42 62 63 68 67 +1 5 38 39 44 43 63 64 69 68 +1 5 40 41 46 45 65 66 71 70 +1 5 41 42 47 46 66 67 72 71 +1 5 42 43 48 47 67 68 73 72 +1 5 43 44 49 48 68 69 74 73 +1 5 50 51 56 55 75 76 81 80 +1 5 51 52 57 56 76 77 82 81 +1 5 52 53 58 57 77 78 83 82 +1 5 53 54 59 58 78 79 84 83 +1 5 55 56 61 60 80 81 86 85 +1 5 56 57 62 61 81 82 87 86 +1 5 57 58 63 62 82 83 88 87 +1 5 58 59 64 63 83 84 89 88 +1 5 60 61 66 65 85 86 91 90 +1 5 61 62 67 66 86 87 92 91 +1 5 62 63 68 67 87 88 93 92 +1 5 63 64 69 68 88 89 94 93 +1 5 65 66 71 70 90 91 96 95 +1 5 66 67 72 71 91 92 97 96 +1 5 67 68 73 72 92 93 98 97 +1 5 68 69 74 73 93 94 99 98 +1 5 75 76 81 80 100 101 106 105 +1 5 76 77 82 81 101 102 107 106 +1 5 77 78 83 82 102 103 108 107 +1 5 78 79 84 83 103 104 109 108 +1 5 80 81 86 85 105 106 111 110 +1 5 81 82 87 86 106 107 112 111 +1 5 82 83 88 87 107 108 113 112 +1 5 83 84 89 88 108 109 114 113 +1 5 85 86 91 90 110 111 116 115 +1 5 86 87 92 91 111 112 117 116 +1 5 87 88 93 92 112 113 118 117 +1 5 88 89 94 93 113 114 119 118 +1 5 90 91 96 95 115 116 121 120 +1 5 91 92 97 96 116 117 122 121 +1 5 92 93 98 97 117 118 123 122 +1 5 93 94 99 98 118 119 124 123 + +boundary +96 +1 3 0 5 6 1 +1 3 1 6 7 2 +1 3 2 7 8 3 +1 3 3 8 9 4 +1 3 5 10 11 6 +1 3 6 11 12 7 +1 3 7 12 13 8 +1 3 8 13 14 9 +1 3 10 15 16 11 +1 3 11 16 17 12 +1 3 12 17 18 13 +1 3 13 18 19 14 +1 3 15 20 21 16 +1 3 16 21 22 17 +1 3 17 22 23 18 +1 3 18 23 24 19 +6 3 100 101 106 105 +6 3 101 102 107 106 +6 3 102 103 108 107 +6 3 103 104 109 108 +6 3 105 106 111 110 +6 3 106 107 112 111 +6 3 107 108 113 112 +6 3 108 109 114 113 +6 3 110 111 116 115 +6 3 111 112 117 116 +6 3 112 113 118 117 +6 3 113 114 119 118 +6 3 115 116 121 120 +6 3 116 117 122 121 +6 3 117 118 123 122 +6 3 118 119 124 123 +5 3 0 25 30 5 +5 3 5 30 35 10 +5 3 10 35 40 15 +5 3 15 40 45 20 +5 3 25 50 55 30 +5 3 30 55 60 35 +5 3 35 60 65 40 +5 3 40 65 70 45 +5 3 50 75 80 55 +5 3 55 80 85 60 +5 3 60 85 90 65 +5 3 65 90 95 70 +5 3 75 100 105 80 +5 3 80 105 110 85 +5 3 85 110 115 90 +5 3 90 115 120 95 +3 3 4 9 34 29 +3 3 9 14 39 34 +3 3 14 19 44 39 +3 3 19 24 49 44 +3 3 29 34 59 54 +3 3 34 39 64 59 +3 3 39 44 69 64 +3 3 44 49 74 69 +3 3 54 59 84 79 +3 3 59 64 89 84 +3 3 64 69 94 89 +3 3 69 74 99 94 +3 3 79 84 109 104 +3 3 84 89 114 109 +3 3 89 94 119 114 +3 3 94 99 124 119 +2 3 0 1 26 25 +2 3 25 26 51 50 +2 3 50 51 76 75 +2 3 75 76 101 100 +2 3 1 2 27 26 +2 3 26 27 52 51 +2 3 51 52 77 76 +2 3 76 77 102 101 +2 3 2 3 28 27 +2 3 27 28 53 52 +2 3 52 53 78 77 +2 3 77 78 103 102 +2 3 3 4 29 28 +2 3 28 29 54 53 +2 3 53 54 79 78 +2 3 78 79 104 103 +4 3 20 45 46 21 +4 3 45 70 71 46 +4 3 70 95 96 71 +4 3 95 120 121 96 +4 3 21 46 47 22 +4 3 46 71 72 47 +4 3 71 96 97 72 +4 3 96 121 122 97 +4 3 22 47 48 23 +4 3 47 72 73 48 +4 3 72 97 98 73 +4 3 97 122 123 98 +4 3 23 48 49 24 +4 3 48 73 74 49 +4 3 73 98 99 74 +4 3 98 123 124 99 + +vertices +125 +3 +0 0 0 +0.25 0 0 +0.5 0 0 +0.75 0 0 +1 0 0 +0 0.25 0 +0.25 0.25 0 +0.5 0.25 0 +0.75 0.25 0 +1 0.25 0 +0 0.5 0 +0.25 0.5 0 +0.5 0.5 0 +0.75 0.5 0 +1 0.5 0 +0 0.75 0 +0.25 0.75 0 +0.5 0.75 0 +0.75 0.75 0 +1 0.75 0 +0 1 0 +0.25 1 0 +0.5 1 0 +0.75 1 0 +1 1 0 +0 0 0.25 +0.25 0 0.25 +0.5 0 0.25 +0.75 0 0.25 +1 0 0.25 +0 0.25 0.25 +0.25 0.25 0.25 +0.5 0.25 0.25 +0.75 0.25 0.25 +1 0.25 0.25 +0 0.5 0.25 +0.25 0.5 0.25 +0.5 0.5 0.25 +0.75 0.5 0.25 +1 0.5 0.25 +0 0.75 0.25 +0.25 0.75 0.25 +0.5 0.75 0.25 +0.75 0.75 0.25 +1 0.75 0.25 +0 1 0.25 +0.25 1 0.25 +0.5 1 0.25 +0.75 1 0.25 +1 1 0.25 +0 0 0.5 +0.25 0 0.5 +0.5 0 0.5 +0.75 0 0.5 +1 0 0.5 +0 0.25 0.5 +0.25 0.25 0.5 +0.5 0.25 0.5 +0.75 0.25 0.5 +1 0.25 0.5 +0 0.5 0.5 +0.25 0.5 0.5 +0.5 0.5 0.5 +0.75 0.5 0.5 +1 0.5 0.5 +0 0.75 0.5 +0.25 0.75 0.5 +0.5 0.75 0.5 +0.75 0.75 0.5 +1 0.75 0.5 +0 1 0.5 +0.25 1 0.5 +0.5 1 0.5 +0.75 1 0.5 +1 1 0.5 +0 0 0.75 +0.25 0 0.75 +0.5 0 0.75 +0.75 0 0.75 +1 0 0.75 +0 0.25 0.75 +0.25 0.25 0.75 +0.5 0.25 0.75 +0.75 0.25 0.75 +1 0.25 0.75 +0 0.5 0.75 +0.25 0.5 0.75 +0.5 0.5 0.75 +0.75 0.5 0.75 +1 0.5 0.75 +0 0.75 0.75 +0.25 0.75 0.75 +0.5 0.75 0.75 +0.75 0.75 0.75 +1 0.75 0.75 +0 1 0.75 +0.25 1 0.75 +0.5 1 0.75 +0.75 1 0.75 +1 1 0.75 +0 0 1 +0.25 0 1 +0.5 0 1 +0.75 0 1 +1 0 1 +0 0.25 1 +0.25 0.25 1 +0.5 0.25 1 +0.75 0.25 1 +1 0.25 1 +0 0.5 1 +0.25 0.5 1 +0.5 0.5 1 +0.75 0.5 1 +1 0.5 1 +0 0.75 1 +0.25 0.75 1 +0.5 0.75 1 +0.75 0.75 1 +1 0.75 1 +0 1 1 +0.25 1 1 +0.5 1 1 +0.75 1 1 +1 1 1 diff --git a/palace/fem/libceed/restriction.cpp b/palace/fem/libceed/restriction.cpp index f63450aeb..03fac6ad8 100644 --- a/palace/fem/libceed/restriction.cpp +++ b/palace/fem/libceed/restriction.cpp @@ -22,6 +22,7 @@ void InitLexicoRestr(const mfem::FiniteElementSpace &fespace, const int P = fe.GetDof(); const mfem::TensorBasisElement *tfe = dynamic_cast(&fe); const mfem::Array &dof_map = tfe->GetDofMap(); + const bool dof_map_is_identity = dof_map.Size() == 0; const CeedInt comp_stride = (fespace.GetVDim() == 1 || fespace.GetOrdering() == mfem::Ordering::byVDIM) ? 1 @@ -56,7 +57,7 @@ void InitLexicoRestr(const mfem::FiniteElementSpace &fespace, "restriction."); for (int j = 0; j < P; j++) { - const int sdid = dof_map[j]; // signed + const int sdid = dof_map_is_identity ? j : dof_map[j]; // signed const int did = (sdid >= 0) ? sdid : -1 - sdid; const int sgid = dofs[did]; // signed const int gid = (sgid >= 0) ? sgid : -1 - sgid; @@ -381,7 +382,7 @@ void InitRestriction(const mfem::FiniteElementSpace &fespace, } const mfem::TensorBasisElement *tfe = dynamic_cast(fe); const bool vector = fe->GetRangeType() == mfem::FiniteElement::VECTOR; - const bool lexico = (tfe && tfe->GetDofMap().Size() > 0 && !vector && !is_interp); + const bool lexico = (tfe && !vector && !is_interp); if (lexico) { // Lexicographic ordering using dof_map.