From 9ab62349c64af2a89fa7b37fca5930b58bb36fc2 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Wed, 12 Jun 2019 18:03:08 +0200
Subject: [PATCH] [PL] BC; Fix lower order element values access.

In cases when the underlying element is quadratic but the shape function
is of linear order, there is a dimension mismatch between the
NodalVectorType and the return value of the getNodalValuesOnElement.

Taking the first rows of the return matrix ensures correct dimensions.
---
 .../NeumannBoundaryConditionLocalAssembler.h   |  3 ++-
 .../RobinBoundaryConditionLocalAssembler.h     |  6 ++++--
 ...entNeumannBoundaryConditionLocalAssembler.h | 18 +++++++++++-------
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/ProcessLib/BoundaryCondition/NeumannBoundaryConditionLocalAssembler.h b/ProcessLib/BoundaryCondition/NeumannBoundaryConditionLocalAssembler.h
index 9296b1db422..ab58fca24cb 100644
--- a/ProcessLib/BoundaryCondition/NeumannBoundaryConditionLocalAssembler.h
+++ b/ProcessLib/BoundaryCondition/NeumannBoundaryConditionLocalAssembler.h
@@ -57,7 +57,8 @@ public:
         // Get element nodes for the interpolation from nodes to integration
         // point.
         NodalVectorType parameter_node_values =
-            _neumann_bc_parameter.getNodalValuesOnElement(Base::_element, t);
+            _neumann_bc_parameter.getNodalValuesOnElement(Base::_element, t)
+                .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
 
         for (unsigned ip = 0; ip < n_integration_points; ip++)
         {
diff --git a/ProcessLib/BoundaryCondition/RobinBoundaryConditionLocalAssembler.h b/ProcessLib/BoundaryCondition/RobinBoundaryConditionLocalAssembler.h
index 762f6470493..4a196ee2cb3 100644
--- a/ProcessLib/BoundaryCondition/RobinBoundaryConditionLocalAssembler.h
+++ b/ProcessLib/BoundaryCondition/RobinBoundaryConditionLocalAssembler.h
@@ -55,9 +55,11 @@ public:
             Base::_integration_method.getNumberOfPoints();
 
         typename Base::NodalVectorType const alpha =
-            _data.alpha.getNodalValuesOnElement(Base::_element, t);
+            _data.alpha.getNodalValuesOnElement(Base::_element, t)
+                .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
         typename Base::NodalVectorType const u_0 =
-            _data.u_0.getNodalValuesOnElement(Base::_element, t);
+            _data.u_0.getNodalValuesOnElement(Base::_element, t)
+                .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
 
         for (unsigned ip = 0; ip < n_integration_points; ++ip)
         {
diff --git a/ProcessLib/BoundaryCondition/VariableDependentNeumannBoundaryConditionLocalAssembler.h b/ProcessLib/BoundaryCondition/VariableDependentNeumannBoundaryConditionLocalAssembler.h
index 471c2974b50..4da73be23f9 100644
--- a/ProcessLib/BoundaryCondition/VariableDependentNeumannBoundaryConditionLocalAssembler.h
+++ b/ProcessLib/BoundaryCondition/VariableDependentNeumannBoundaryConditionLocalAssembler.h
@@ -64,16 +64,20 @@ public:
         // Get element nodes for the interpolation from nodes to
         // integration point.
         NodalVectorType const constant_node_values =
-            _data.constant.getNodalValuesOnElement(Base::_element, t);
+            _data.constant.getNodalValuesOnElement(Base::_element, t)
+                .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
         NodalVectorType const coefficient_current_variable_node_values =
-            _data.coefficient_current_variable.getNodalValuesOnElement(
-                Base::_element, t);
+            _data.coefficient_current_variable
+                .getNodalValuesOnElement(Base::_element, t)
+                .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
         NodalVectorType const coefficient_other_variable_node_values =
-            _data.coefficient_other_variable.getNodalValuesOnElement(
-                Base::_element, t);
+            _data.coefficient_other_variable
+                .getNodalValuesOnElement(Base::_element, t)
+                .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
         NodalVectorType const coefficient_mixed_variables_node_values =
-            _data.coefficient_mixed_variables.getNodalValuesOnElement(
-                Base::_element, t);
+            _data.coefficient_mixed_variables
+                .getNodalValuesOnElement(Base::_element, t)
+                .template topRows<ShapeFunction::MeshElement::n_all_nodes>();
         unsigned const n_integration_points =
             Base::_integration_method.getNumberOfPoints();
 
-- 
GitLab