OGS
ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction > Class Template Reference

Detailed Description

template<typename ShapeFunction>
class ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >

Definition at line 30 of file HeatTransportBHELocalAssemblerSoil.h.

#include <HeatTransportBHELocalAssemblerSoil.h>

Inheritance diagram for ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >:
[legend]
Collaboration diagram for ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >:
[legend]

Public Types

using ShapeMatricesType
 
using NodalMatrixType = typename ShapeMatricesType::NodalMatrixType
 
using NodalVectorType = typename ShapeMatricesType::NodalVectorType
 
using NodalRowVectorType = typename ShapeMatricesType::NodalRowVectorType
 
using ShapeMatrices = typename ShapeMatricesType::ShapeMatrices
 
using GlobalDimNodalMatrixType
 

Public Member Functions

 HeatTransportBHELocalAssemblerSoil (HeatTransportBHELocalAssemblerSoil const &)=delete
 
 HeatTransportBHELocalAssemblerSoil (HeatTransportBHELocalAssemblerSoil &&)=delete
 
 HeatTransportBHELocalAssemblerSoil (MeshLib::Element const &e, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, HeatTransportBHEProcessData &process_data)
 
void assemble (double const, double const, std::vector< double > const &, std::vector< double > const &, std::vector< double > &, std::vector< double > &, std::vector< double > &) override
 
void assembleWithJacobian (double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &, std::vector< double > &, std::vector< double > &local_rhs_data, std::vector< double > &local_Jac_data) override
 
Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix (const unsigned integration_point) const override
 Provides the shape matrix at the given integration point.
 
- Public Member Functions inherited from ProcessLib::LocalAssemblerInterface
virtual ~LocalAssemblerInterface ()=default
 
virtual void setInitialConditions (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, int const process_id)
 
virtual void initialize (std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
 
virtual void preAssemble (double const, double const, std::vector< double > const &)
 
virtual void assembleForStaggeredScheme (double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
 
virtual void assembleWithJacobianForStaggeredScheme (double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
 
virtual void computeSecondaryVariable (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, int const process_id)
 
virtual void preTimestep (std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, double const t, double const delta_t)
 
virtual void postTimestep (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
 
void postNonLinearSolver (std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
 
virtual Eigen::Vector3d getFlux (MathLib::Point3d const &, double const, std::vector< double > const &) const
 
virtual Eigen::Vector3d getFlux (MathLib::Point3d const &, double const, std::vector< std::vector< double > > const &) const
 Fits to staggered scheme.
 
- Public Member Functions inherited from NumLib::ExtrapolatableElement
virtual ~ExtrapolatableElement ()=default
 

Private Attributes

HeatTransportBHEProcessData_process_data
 
std::vector< IntegrationPointDataSoil< NodalRowVectorType, GlobalDimNodalMatrixType >, Eigen::aligned_allocator< IntegrationPointDataSoil< NodalRowVectorType, GlobalDimNodalMatrixType > > > _ip_data
 
NumLib::GenericIntegrationMethod const & _integration_method
 
std::vector< ShapeMatrices, Eigen::aligned_allocator< ShapeMatrices > > _shape_matrices
 
std::size_t const _element_id
 
SecondaryData< typename ShapeMatrices::ShapeType > _secondary_data
 

Member Typedef Documentation

◆ GlobalDimNodalMatrixType

template<typename ShapeFunction >
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::GlobalDimNodalMatrixType
Initial value:
MatrixType< GlobalDim, ShapeFunction::NPOINTS > GlobalDimNodalMatrixType

Definition at line 41 of file HeatTransportBHELocalAssemblerSoil.h.

◆ NodalMatrixType

template<typename ShapeFunction >
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::NodalMatrixType = typename ShapeMatricesType::NodalMatrixType

Definition at line 36 of file HeatTransportBHELocalAssemblerSoil.h.

◆ NodalRowVectorType

template<typename ShapeFunction >
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::NodalRowVectorType = typename ShapeMatricesType::NodalRowVectorType

Definition at line 38 of file HeatTransportBHELocalAssemblerSoil.h.

◆ NodalVectorType

template<typename ShapeFunction >
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::NodalVectorType = typename ShapeMatricesType::NodalVectorType

Definition at line 37 of file HeatTransportBHELocalAssemblerSoil.h.

◆ ShapeMatrices

template<typename ShapeFunction >
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::ShapeMatrices = typename ShapeMatricesType::ShapeMatrices

Definition at line 40 of file HeatTransportBHELocalAssemblerSoil.h.

◆ ShapeMatricesType

template<typename ShapeFunction >
using ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::ShapeMatricesType

Constructor & Destructor Documentation

◆ HeatTransportBHELocalAssemblerSoil() [1/3]

template<typename ShapeFunction >
ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::HeatTransportBHELocalAssemblerSoil ( HeatTransportBHELocalAssemblerSoil< ShapeFunction > const & )
delete

◆ HeatTransportBHELocalAssemblerSoil() [2/3]

template<typename ShapeFunction >
ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::HeatTransportBHELocalAssemblerSoil ( HeatTransportBHELocalAssemblerSoil< ShapeFunction > && )
delete

◆ HeatTransportBHELocalAssemblerSoil() [3/3]

template<typename ShapeFunction >
ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::HeatTransportBHELocalAssemblerSoil ( MeshLib::Element const & e,
NumLib::GenericIntegrationMethod const & integration_method,
bool const is_axially_symmetric,
HeatTransportBHEProcessData & process_data )

Definition at line 31 of file HeatTransportBHELocalAssemblerSoil-impl.h.

37 : _process_data(process_data),
38 _integration_method(integration_method),
39 _element_id(e.getID())
40{
41 unsigned const n_integration_points =
43
44 _ip_data.reserve(n_integration_points);
45 _secondary_data.N.resize(n_integration_points);
46
49 3 /* GlobalDim */>(e, is_axially_symmetric,
51
53 x_position.setElementID(_element_id);
54
55 // ip data initialization
56 for (unsigned ip = 0; ip < n_integration_points; ip++)
57 {
58 x_position.setIntegrationPoint(ip);
59
60 // create the class IntegrationPointDataBHE in place
61 auto const& sm = _shape_matrices[ip];
62 double const w = _integration_method.getWeightedPoint(ip).getWeight() *
63 sm.integralMeasure * sm.detJ;
64 _ip_data.push_back({sm.N, sm.dNdx, w});
65
66 _secondary_data.N[ip] = sm.N;
67 }
68}
double getWeight() const
MathLib::WeightedPoint const & getWeightedPoint(unsigned const igp) const
void setElementID(std::size_t element_id)
std::vector< ShapeMatrices, Eigen::aligned_allocator< ShapeMatrices > > _shape_matrices
std::vector< IntegrationPointDataSoil< NodalRowVectorType, GlobalDimNodalMatrixType >, Eigen::aligned_allocator< IntegrationPointDataSoil< NodalRowVectorType, GlobalDimNodalMatrixType > > > _ip_data
std::vector< typename ShapeMatricesType::ShapeMatrices, Eigen::aligned_allocator< typename ShapeMatricesType::ShapeMatrices > > initShapeMatrices(MeshLib::Element const &e, bool const is_axially_symmetric, IntegrationMethod const &integration_method)
std::vector< ShapeMatrixType, Eigen::aligned_allocator< ShapeMatrixType > > N

References ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::_element_id, ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::_integration_method, ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::_ip_data, ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::_secondary_data, ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::_shape_matrices, NumLib::GenericIntegrationMethod::getNumberOfPoints(), MathLib::WeightedPoint::getWeight(), NumLib::GenericIntegrationMethod::getWeightedPoint(), NumLib::initShapeMatrices(), ProcessLib::HeatTransportBHE::SecondaryData< ShapeMatrixType >::N, and ParameterLib::SpatialPosition::setElementID().

Member Function Documentation

◆ assemble()

template<typename ShapeFunction >
void ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::assemble ( double const t,
double const dt,
std::vector< double > const & local_x,
std::vector< double > const & ,
std::vector< double > & local_M_data,
std::vector< double > & local_K_data,
std::vector< double > &  )
overridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 71 of file HeatTransportBHELocalAssemblerSoil-impl.h.

76{
77 assert(local_x.size() == ShapeFunction::NPOINTS);
78 (void)local_x; // Avoid unused arg warning.
79
80 auto local_M = MathLib::createZeroedMatrix<NodalMatrixType>(
81 local_M_data, ShapeFunction::NPOINTS, ShapeFunction::NPOINTS);
82 auto local_K = MathLib::createZeroedMatrix<NodalMatrixType>(
83 local_K_data, ShapeFunction::NPOINTS, ShapeFunction::NPOINTS);
84
87
88 auto const& medium = *_process_data.media_map.getMedium(_element_id);
89 auto const& solid_phase = medium.phase("Solid");
90 auto const& liquid_phase = medium.phase("AqueousLiquid");
91
93
94 unsigned const n_integration_points =
96
97 for (unsigned ip = 0; ip < n_integration_points; ip++)
98 {
99 pos.setIntegrationPoint(ip);
100 auto& ip_data = _ip_data[ip];
101 auto const& N = ip_data.N;
102 auto const& dNdx = ip_data.dNdx;
103 auto const& w = ip_data.integration_weight;
104
105 double T_int_pt = 0.0;
106 NumLib::shapeFunctionInterpolate(local_x, N, T_int_pt);
107
108 vars.temperature = T_int_pt;
109
110 // for now only using the solid and liquid phase parameters
111 auto const density_s =
113 .template value<double>(vars, pos, t, dt);
114
115 auto const heat_capacity_s =
116 solid_phase
117 .property(
119 .template value<double>(vars, pos, t, dt);
120
121 auto const density_f =
122 liquid_phase.property(MaterialPropertyLib::PropertyType::density)
123 .template value<double>(vars, pos, t, dt);
124
125 auto const heat_capacity_f =
126 liquid_phase
127 .property(
129 .template value<double>(vars, pos, t, dt);
130
131 auto const porosity =
133 .template value<double>(vars, pos, t, dt);
134
135 auto const velocity =
136 liquid_phase
138 .template value<Eigen::Vector3d>(vars, pos, t, dt);
139
140 // calculate the hydrodynamic thermodispersion tensor
141 auto const thermal_conductivity =
143 medium
144 .property(
146 .value(vars, pos, t, dt));
147
148 auto thermal_conductivity_dispersivity = thermal_conductivity;
149
150 double const velocity_magnitude = velocity.norm();
151
152 if (velocity_magnitude >= std::numeric_limits<double>::epsilon())
153 {
154 auto const thermal_dispersivity_longitudinal =
155 medium
158 .template value<double>();
159 auto const thermal_dispersivity_transversal =
160 medium
163 .template value<double>();
164
165 auto const thermal_dispersivity =
166 density_f * heat_capacity_f *
167 (thermal_dispersivity_transversal * velocity_magnitude *
168 Eigen::Matrix3d::Identity() +
169 (thermal_dispersivity_longitudinal -
170 thermal_dispersivity_transversal) /
171 velocity_magnitude * velocity * velocity.transpose());
172 thermal_conductivity_dispersivity += thermal_dispersivity;
173 }
174
175 // assemble Conductance matrix
176 local_K.noalias() +=
177 (dNdx.transpose() * thermal_conductivity_dispersivity * dNdx +
178 N.transpose() * velocity.transpose() * dNdx * density_f *
179 heat_capacity_f) *
180 w;
181
182 // assemble Mass matrix
183 local_M.noalias() += N.transpose() * N * w *
184 (density_s * heat_capacity_s * (1 - porosity) +
185 density_f * heat_capacity_f * porosity);
186 }
187
188 // debugging
189 // std::string sep = "\n----------------------------------------\n";
190 // Eigen::IOFormat CleanFmt(4, 0, ", ", "\n", "[", "]");
191 // std::cout << local_K.format(CleanFmt) << sep;
192 // std::cout << local_M.format(CleanFmt) << sep;
193}
Phase const & phase(std::size_t index) const
Definition Medium.cpp:33
void setIntegrationPoint(unsigned integration_point)
template Eigen::Matrix< double, 3, 3 > formEigenTensor< 3 >(MaterialPropertyLib::PropertyDataType const &values)
void shapeFunctionInterpolate(const NodalValues &, const ShapeMatrix &)
MaterialPropertyLib::MaterialSpatialDistributionMap media_map

References MaterialPropertyLib::density, MaterialPropertyLib::formEigenTensor< 3 >(), MaterialPropertyLib::phase_velocity, MaterialPropertyLib::porosity, ParameterLib::SpatialPosition::setElementID(), ParameterLib::SpatialPosition::setIntegrationPoint(), NumLib::detail::shapeFunctionInterpolate(), MaterialPropertyLib::specific_heat_capacity, MaterialPropertyLib::VariableArray::temperature, and MaterialPropertyLib::thermal_conductivity.

◆ assembleWithJacobian()

template<typename ShapeFunction >
void ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::assembleWithJacobian ( double const t,
double const dt,
std::vector< double > const & local_x,
std::vector< double > const & local_x_prev,
std::vector< double > & local_M_data,
std::vector< double > & local_K_data,
std::vector< double > & local_rhs_data,
std::vector< double > & local_Jac_data )
overridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 196 of file HeatTransportBHELocalAssemblerSoil-impl.h.

201{
202 assert(local_x.size() == ShapeFunction::NPOINTS);
203 auto const local_matrix_size = local_x.size();
204 // initialize x and x_prev
205 auto x =
206 Eigen::Map<NodalVectorType const>(local_x.data(), local_matrix_size);
207 auto x_prev = Eigen::Map<NodalVectorType const>(local_x_prev.data(),
208 local_matrix_size);
209 // initialize local_Jac and local_rhs
210 auto local_Jac = MathLib::createZeroedMatrix<NodalMatrixType>(
211 local_Jac_data, local_matrix_size, local_matrix_size);
212 auto local_rhs = MathLib::createZeroedVector<NodalVectorType>(
213 local_rhs_data, local_matrix_size);
214
215 assemble(t, dt, local_x, local_x_prev, local_M_data, local_K_data,
216 local_rhs_data /*not going to be used*/);
217
218 // convert to matrix
219 auto local_M = MathLib::toMatrix<NodalMatrixType>(
220 local_M_data, local_matrix_size, local_matrix_size);
221 auto local_K = MathLib::toMatrix<NodalMatrixType>(
222 local_K_data, local_matrix_size, local_matrix_size);
223
224 // Jac matrix and rhs vector operation
225 local_Jac.noalias() += local_K + local_M / dt;
226 local_rhs.noalias() -= local_K * x + local_M * (x - x_prev) / dt;
227
228 local_M.setZero();
229 local_K.setZero();
230}
void assemble(double const, double const, std::vector< double > const &, std::vector< double > const &, std::vector< double > &, std::vector< double > &, std::vector< double > &) override

◆ getShapeMatrix()

template<typename ShapeFunction >
Eigen::Map< const Eigen::RowVectorXd > ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::getShapeMatrix ( const unsigned integration_point) const
inlineoverridevirtual

Provides the shape matrix at the given integration point.

Implements NumLib::ExtrapolatableElement.

Definition at line 70 of file HeatTransportBHELocalAssemblerSoil.h.

72 {
73 auto const& N = _secondary_data.N[integration_point];
74
75 // assumes N is stored contiguously in memory
76 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
77 }

References ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::_secondary_data, and ProcessLib::HeatTransportBHE::SecondaryData< ShapeMatrixType >::N.

Member Data Documentation

◆ _element_id

◆ _integration_method

◆ _ip_data

◆ _process_data

template<typename ShapeFunction >
HeatTransportBHEProcessData& ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::_process_data
private

Definition at line 80 of file HeatTransportBHELocalAssemblerSoil.h.

◆ _secondary_data

◆ _shape_matrices

template<typename ShapeFunction >
std::vector<ShapeMatrices, Eigen::aligned_allocator<ShapeMatrices> > ProcessLib::HeatTransportBHE::HeatTransportBHELocalAssemblerSoil< ShapeFunction >::_shape_matrices
private

The documentation for this class was generated from the following files: