Skip to content

Commit 1fcc9ae

Browse files
committed
Improve support for 2d meshes embedded in 3d space
1 parent 0e98f32 commit 1fcc9ae

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/error_estimation/exact_solution.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ void ExactSolution::_compute_error(std::string_view sys_name,
805805

806806
// Compute the value of the error at this quadrature point
807807
typename FEGenericBase<OutputShape>::OutputNumber exact_val(0);
808-
RawAccessor<typename FEGenericBase<OutputShape>::OutputNumber> exact_val_accessor( exact_val, dim );
808+
RawAccessor<typename FEGenericBase<OutputShape>::OutputNumber> exact_val_accessor( exact_val, n_vec_dim );
809809
if (_exact_values.size() > sys_num && _exact_values[sys_num])
810810
{
811811
for (unsigned int c = 0; c < n_vec_dim; c++)

src/fe/fe_interface.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ unsigned int FEInterface::n_vec_dim (const MeshBase & mesh,
26402640
{
26412641
//FIXME: We currently assume that the number of vector components is tied
26422642
// to the mesh dimension. This will break for mixed-dimension meshes.
2643-
return field_type(fe_type.family) == TYPE_VECTOR ? mesh.mesh_dimension() : 1;
2643+
return field_type(fe_type.family) == TYPE_VECTOR ? mesh.spatial_dimension() : 1;
26442644
}
26452645

26462646

src/mesh/mesh_modification.C

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ MeshTools::Modification::rotate (MeshBase & mesh,
349349
#if LIBMESH_DIM == 3
350350
const auto R = RealTensorValue::intrinsic_rotation_matrix(phi, theta, psi);
351351

352+
if (theta)
353+
mesh.set_spatial_dimension(3);
354+
352355
for (auto & node : mesh.node_ptr_range())
353356
{
354357
Point & pt = *node;

src/systems/equation_systems.C

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,10 @@ void EquationSystems::build_variable_names (std::vector<std::string> & var_names
481481

482482
// Here, we're assuming the number of vector components is the same
483483
// as the mesh dimension. Will break for mixed dimension meshes.
484-
unsigned int dim = this->get_mesh().mesh_dimension();
484+
unsigned int dim = this->get_mesh().spatial_dimension();
485485
unsigned int nv = n_scalar_vars + dim*n_vector_vars;
486486

487-
// We'd better not have more than dim*his->n_vars() (all vector variables)
487+
// We'd better not have more than dim*this->n_vars() (all vector variables)
488488
// Treat the NodeElem-only mesh case as dim=1
489489
libmesh_assert_less_equal ( nv, (dim > 0 ? dim : 1)*this->n_vars() );
490490

@@ -577,7 +577,7 @@ EquationSystems::build_parallel_solution_vector(const std::set<std::string> * sy
577577
// This function must be run on all processors at once
578578
parallel_object_only();
579579

580-
const unsigned int dim = _mesh.mesh_dimension();
580+
const unsigned int dim = _mesh.spatial_dimension();
581581
const dof_id_type max_nn = _mesh.max_node_id();
582582

583583
// allocate vector storage to hold
@@ -1063,7 +1063,7 @@ EquationSystems::find_variable_numbers
10631063
std::string name;
10641064

10651065
const std::vector<std::string> component_suffix = {"_x", "_y", "_z"};
1066-
unsigned int dim = _mesh.mesh_dimension();
1066+
unsigned int dim = _mesh.spatial_dimension();
10671067
libmesh_error_msg_if(dim > 3, "Invalid dim in find_variable_numbers");
10681068

10691069
// Now filter through the variables in each system and store the system index and their index
@@ -1215,7 +1215,7 @@ EquationSystems::build_parallel_elemental_solution_vector (std::vector<std::stri
12151215
// Even for the case where a variable is not active on any subdomain belonging to the
12161216
// processor, we still need to know this number to update 'var_ctr'.
12171217
const unsigned int n_comps =
1218-
(system.variable_type(var) == type[1]) ? _mesh.mesh_dimension() : 1;
1218+
(system.variable_type(var) == type[1]) ? _mesh.spatial_dimension() : 1;
12191219

12201220
// Loop over all elements in the mesh and index all components of the variable if it's active
12211221
for (const auto & elem : _mesh.active_local_element_ptr_range())

0 commit comments

Comments
 (0)