30 std::vector<FluxVectorType>
const& ip_flux_vector,
31 Eigen::MatrixBase<Derived>& laplacian_matrix)
33 auto const& Ns = shape_matrix_cache.
NsHigherOrder<MeshElementType>();
35 for (std::size_t ip = 0; ip < ip_flux_vector.size(); ++ip)
37 auto const& ip_data = ip_data_vector[ip];
38 auto const w = ip_data.integration_weight;
39 auto const& dNdx = ip_data.dNdx;
40 auto const&
N = Ns[ip];
41 laplacian_matrix.noalias() +=
42 N.transpose() * ip_flux_vector[ip].transpose() * dNdx * w;
48 std::vector<FluxVectorType>
const& ip_flux_vector,
49 Eigen::MatrixBase<Derived>& laplacian_matrix)
51 for (std::size_t ip = 0; ip < ip_flux_vector.size(); ++ip)
53 auto const& ip_data = ip_data_vector[ip];
54 auto const w = ip_data.integration_weight;
55 auto const&
N = ip_data.N;
56 auto const& dNdx = ip_data.dNdx;
57 laplacian_matrix.noalias() +=
58 N.transpose() * ip_flux_vector[ip].transpose() * dNdx * w;
64 Eigen::MatrixBase<Derived>& laplacian_matrix)
66 Eigen::VectorXd
const down_mask =
67 (quasi_nodal_flux.array() < 0).cast<
double>();
68 Eigen::VectorXd
const down = quasi_nodal_flux.cwiseProduct(down_mask);
70 double const q_in = -down.sum();
71 if (q_in < std::numeric_limits<double>::epsilon())
76 Eigen::VectorXd
const up_mask =
77 (quasi_nodal_flux.array() >= 0).cast<
double>();
78 Eigen::VectorXd
const up = quasi_nodal_flux.cwiseProduct(up_mask);
80 laplacian_matrix.diagonal().noalias() += up;
81 laplacian_matrix.noalias() += down * up.transpose() / q_in;
86 std::vector<FluxVectorType>
const& ip_flux_vector,
87 Eigen::MatrixBase<Derived>& laplacian_matrix)
89 Eigen::VectorXd quasi_nodal_flux =
90 Eigen::VectorXd::Zero(laplacian_matrix.rows());
92 for (std::size_t ip = 0; ip < ip_flux_vector.size(); ++ip)
94 auto const& ip_data = ip_data_vector[ip];
95 auto const w = ip_data.integration_weight;
96 auto const& dNdx = ip_data.dNdx;
98 quasi_nodal_flux.noalias() -= ip_flux_vector[ip].transpose() * dNdx * w;
110 IPData
const& ip_data_vector,
112 std::vector<FluxVectorType>
const& ip_flux_vector,
113 double const average_velocity,
114 Eigen::MatrixBase<Derived>& laplacian_matrix)
117 [&](
auto&& stabilizer)
119 using Stabilizer = std::decay_t<
decltype(stabilizer)>;
120 if constexpr (std::is_same_v<Stabilizer, FullUpwind>)
122 if (average_velocity > stabilizer.getCutoffVelocity())
131 ip_data_vector, shape_matrix_cache, ip_flux_vector,
139 IPData
const& ip_data_vector,
140 std::vector<FluxVectorType>
const& ip_flux_vector,
141 double const average_velocity,
142 Eigen::MatrixBase<Derived>& laplacian_matrix)
145 [&](
auto&& stabilizer)
147 using Stabilizer = std::decay_t<
decltype(stabilizer)>;
148 if constexpr (std::is_same_v<Stabilizer, FullUpwind>)
150 if (average_velocity > stabilizer.getCutoffVelocity())
159 ip_data_vector, ip_flux_vector, laplacian_matrix);