OGS
ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim > Class Template Reference

Detailed Description

template<typename ShapeFunction, int GlobalDim>
class ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >

Definition at line 31 of file WellboreSimulatorFEM.h.

#include <WellboreSimulatorFEM.h>

Inheritance diagram for ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >:
[legend]
Collaboration diagram for ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >:
[legend]

Public Types

using ResidualVector = Eigen::Matrix<double, jacobian_residual_size, 1>
using JacobianMatrix
using UnknownVector = Eigen::Matrix<double, jacobian_residual_size, 1>

Public Member Functions

 WellboreSimulatorFEM (MeshLib::Element const &element, std::size_t const, NumLib::GenericIntegrationMethod const &integration_method, bool const is_axially_symmetric, WellboreSimulatorProcessData const &process_data)
void assemble (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_b_data) override
void calculateResidual (double const alpha, double const vapor_water_density, double const liquid_water_density, double const v_mix, double const dryness, double const C_0, double const u_gu, ResidualVector &res)
void calculateJacobian (double const alpha, double const vapor_water_density, double const liquid_water_density, double const v_mix, double const dryness, double const C_0, double const u_gu, JacobianMatrix &Jac)
Eigen::Map< const Eigen::RowVectorXd > getShapeMatrix (const unsigned integration_point) const override
 Provides the shape matrix at the given integration point.
void computeSecondaryVariableConcrete (double const, double const, Eigen::VectorXd const &, Eigen::VectorXd const &) override
void postTimestepConcrete (Eigen::VectorXd const &, Eigen::VectorXd const &, double const, double const, int const) override
Public Member Functions inherited from ProcessLib::WellboreSimulator::WellboreSimulatorLocalAssemblerInterface
 WellboreSimulatorLocalAssemblerInterface ()=default
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 assembleWithJacobian (double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_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_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.
virtual int getNumberOfVectorElementsForDeformation () const
Public Member Functions inherited from NumLib::ExtrapolatableElement
virtual ~ExtrapolatableElement ()=default

Static Public Attributes

static int const jacobian_residual_size = 1

Protected Types

using IpData

Protected Member Functions

virtual std::vector< double > const & getIntPtVaporMassFlowRate (const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const override
virtual std::vector< double > const & getIntPtLiquidMassFlowRate (const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const override
virtual std::vector< double > const & getIntPtTemperature (const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const override
virtual std::vector< double > const & getIntPtDryness (const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const override
virtual std::vector< double > const & getIntPtVaporVolumeFraction (const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const override

Protected Attributes

MeshLib::Element const & _element
NumLib::GenericIntegrationMethod const & _integration_method
bool const _is_axially_symmetric
WellboreSimulatorProcessData const & _process_data
Eigen::Vector3d _element_direction
std::vector< IpData, Eigen::aligned_allocator< IpData > > _ip_data

Static Protected Attributes

static const int pressure_index = 0
static const int velocity_index = ShapeFunction::NPOINTS
static const int enthalpy_index = 2 * ShapeFunction::NPOINTS
static const int pressure_size = ShapeFunction::NPOINTS
static const int velocity_size = ShapeFunction::NPOINTS
static const int enthalpy_size = ShapeFunction::NPOINTS

Private Types

using ShapeMatricesType = ShapeMatrixPolicyType<ShapeFunction, GlobalDim>
using ShapeMatrices = typename ShapeMatricesType::ShapeMatrices
using LocalMatrixType
using LocalVectorType
using NodalVectorType = typename ShapeMatricesType::NodalVectorType
using NodalRowVectorType = typename ShapeMatricesType::NodalRowVectorType
using GlobalDimVectorType = typename ShapeMatricesType::GlobalDimVectorType
using GlobalDimNodalMatrixType
using GlobalDimMatrixType = typename ShapeMatricesType::GlobalDimMatrixType

Member Typedef Documentation

◆ GlobalDimMatrixType

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::GlobalDimMatrixType = typename ShapeMatricesType::GlobalDimMatrixType
private

Definition at line 49 of file WellboreSimulatorFEM.h.

◆ GlobalDimNodalMatrixType

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::GlobalDimNodalMatrixType
private
Initial value:
MatrixType< GlobalDim, ShapeFunction::NPOINTS > GlobalDimNodalMatrixType

Definition at line 47 of file WellboreSimulatorFEM.h.

◆ GlobalDimVectorType

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::GlobalDimVectorType = typename ShapeMatricesType::GlobalDimVectorType
private

Definition at line 46 of file WellboreSimulatorFEM.h.

◆ IpData

◆ JacobianMatrix

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::JacobianMatrix
Initial value:

Definition at line 132 of file WellboreSimulatorFEM.h.

◆ LocalMatrixType

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::LocalMatrixType
private
Initial value:
typename ShapeMatricesType::template MatrixType<
NUM_NODAL_DOF * ShapeFunction::NPOINTS,
NUM_NODAL_DOF * ShapeFunction::NPOINTS>
const unsigned NUM_NODAL_DOF

Definition at line 36 of file WellboreSimulatorFEM.h.

◆ LocalVectorType

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::LocalVectorType
private
Initial value:
typename ShapeMatricesType::template VectorType<NUM_NODAL_DOF *
ShapeFunction::NPOINTS>

Definition at line 39 of file WellboreSimulatorFEM.h.

◆ NodalRowVectorType

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::NodalRowVectorType = typename ShapeMatricesType::NodalRowVectorType
private

Definition at line 44 of file WellboreSimulatorFEM.h.

◆ NodalVectorType

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::NodalVectorType = typename ShapeMatricesType::NodalVectorType
private

Definition at line 43 of file WellboreSimulatorFEM.h.

◆ ResidualVector

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::ResidualVector = Eigen::Matrix<double, jacobian_residual_size, 1>

Definition at line 131 of file WellboreSimulatorFEM.h.

◆ ShapeMatrices

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::ShapeMatrices = typename ShapeMatricesType::ShapeMatrices
private

Definition at line 34 of file WellboreSimulatorFEM.h.

◆ ShapeMatricesType

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::ShapeMatricesType = ShapeMatrixPolicyType<ShapeFunction, GlobalDim>
private

Definition at line 33 of file WellboreSimulatorFEM.h.

◆ UnknownVector

template<typename ShapeFunction, int GlobalDim>
using ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::UnknownVector = Eigen::Matrix<double, jacobian_residual_size, 1>

Definition at line 135 of file WellboreSimulatorFEM.h.

Constructor & Destructor Documentation

◆ WellboreSimulatorFEM()

template<typename ShapeFunction, int GlobalDim>
ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::WellboreSimulatorFEM ( MeshLib::Element const & element,
std::size_t const ,
NumLib::GenericIntegrationMethod const & integration_method,
bool const is_axially_symmetric,
WellboreSimulatorProcessData const & process_data )
inline

Definition at line 52 of file WellboreSimulatorFEM.h.

62 {
63 // calculate the element direction vector
64 auto const& p0 = element.getNode(0)->asEigenVector3d();
65 auto const& p1 = element.getNode(1)->asEigenVector3d();
66
68
69 unsigned const n_integration_points =
70 _integration_method.getNumberOfPoints();
72
73 auto const shape_matrices =
77
79 pos.setElementID(_element.getID());
80 auto const& medium =
81 *_process_data.media_map.getMedium(_element.getID());
82 auto const& liquid_phase =
84
85 for (unsigned ip = 0; ip < n_integration_points; ip++)
86 {
87 _ip_data.emplace_back(
89 _integration_method.getWeightedPoint(ip).getWeight() *
90 shape_matrices[ip].integralMeasure *
91 shape_matrices[ip].detJ);
92
94
96 _process_data.well_ref_pressure.getNodalValuesOnElement(
97 _element, 0);
99 _process_data.well_ref_enthalpy.getNodalValuesOnElement(
100 _element, 0);
101
102 vars.liquid_phase_pressure = _ip_data[ip].N.dot(ref_p);
103 vars.enthalpy = _ip_data[ip].N.dot(ref_h);
104
105 // .initialValue
106 _ip_data[ip].temperature =
109 .template value<double>(vars, pos, 0, 0);
110 vars.temperature = _ip_data[ip].temperature;
111 _ip_data[ip].mix_density =
114 .template value<double>(vars, pos, 0, 0);
115 _ip_data[ip].dryness = 0;
116 _ip_data[ip].vapor_volume_fraction = 0;
117 _ip_data[ip].vapor_mass_flow_rate = 0;
118 _ip_data[ip].liquid_mass_flow_rate = 0;
119 _ip_data[ip].pushBackState();
120 }
121 }
typename ShapeMatricesType::NodalVectorType NodalVectorType
NumLib::GenericIntegrationMethod const & _integration_method
ShapeMatrixPolicyType< ShapeFunction, GlobalDim > ShapeMatricesType
std::vector< IpData, Eigen::aligned_allocator< IpData > > _ip_data

References _element, _element_direction, _integration_method, _ip_data, _is_axially_symmetric, _process_data, MaterialPropertyLib::AqueousLiquid, MaterialPropertyLib::density, MaterialPropertyLib::VariableArray::enthalpy, MeshLib::Element::getNode(), NumLib::initShapeMatrices(), MaterialPropertyLib::VariableArray::liquid_phase_pressure, ParameterLib::SpatialPosition::setElementID(), MaterialPropertyLib::temperature, and MaterialPropertyLib::VariableArray::temperature.

Member Function Documentation

◆ assemble()

template<typename ShapeFunction, int GlobalDim>
void ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::assemble ( 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_b_data )
overridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 22 of file WellboreSimulatorFEM-impl.h.

26{
27 auto const local_matrix_size = local_x.size();
28
30
37
38 // Get block matrices
41
46
49
54
57
61
62 unsigned const n_integration_points =
63 _integration_method.getNumberOfPoints();
64
66 pos.setElementID(_element.getID());
67
68 auto const& b = _process_data.specific_body_force;
69
71
72 // Get material properties
73 auto const& medium = *_process_data.media_map.getMedium(_element.getID());
74 auto const& liquid_phase =
77
78 // Get wellbore parameters
79 // casing thickness
80 auto const t_ca = _process_data.wellbore.casing_thickness(t, pos)[0];
81 // wellbore radius
82 auto const r_w = _process_data.wellbore.diameter(t, pos)[0] / 2;
83
84 // pipe thickness
85 auto const t_p = _process_data.wellbore.pipe_thickness(t, pos)[0];
86
87 // roughness of the wellbore
88 auto const xi = _process_data.wellbore.roughness(t, pos)[0];
89 // pipe outer radius
90 auto const r_o = r_w - t_ca;
91 // pipe inner radius
92 auto const r_i = r_o - t_p;
93
94 // get reservoir properties
96 _process_data.reservoir_properties.temperature.getNodalValuesOnElement(
97 _element, t);
99 _process_data.reservoir_properties.pressure.getNodalValuesOnElement(
100 _element, t);
102 _process_data.productivity_index.getNodalValuesOnElement(_element, t);
103 auto const k_r =
104 _process_data.reservoir_properties.thermal_conductivity(t, pos)[0];
105 auto const rho_r = _process_data.reservoir_properties.density(t, pos)[0];
106 auto const c_r =
107 _process_data.reservoir_properties.specific_heat_capacity(t, pos)[0];
108
109 for (unsigned ip(0); ip < n_integration_points; ip++)
110 {
111 auto& ip_data = _ip_data[ip];
112 auto const& N = ip_data.N;
113 auto const& dNdx = ip_data.dNdx;
114 auto const& w = ip_data.integration_weight;
115 auto& mix_density = ip_data.mix_density;
116 auto& temperature = ip_data.temperature;
117 auto& steam_mass_frac = ip_data.dryness;
118 auto& vapor_volume_frac = ip_data.vapor_volume_fraction;
119 auto& vapor_mass_flowrate = ip_data.vapor_mass_flow_rate;
120 auto& liquid_mass_flowrate = ip_data.liquid_mass_flow_rate;
121
122 pos = {
123 std::nullopt, _element.getID(),
126 _element, N))};
127
128 double p_int_pt = 0.0;
129 double v_int_pt = 0.0;
130 double h_int_pt = 0.0;
131
133 h_int_pt);
134
135 double p_prev_int_pt = 0.0;
136 double v_prev_int_pt = 0.0;
137 double h_prev_int_pt = 0.0;
138
141
142 double vdot_int_pt = (v_int_pt - v_prev_int_pt) / dt;
143
144 // calculate fluid properties
145
146 const double pi = std::numbers::pi;
147
148 vars.liquid_phase_pressure = p_int_pt;
149 vars.enthalpy = h_int_pt;
150
151 double liquid_water_density =
154 .template value<double>(vars, pos, t, dt);
155 double const vapour_water_density =
158 .template value<double>(vars, pos, t, dt);
159
160 double const h_sat_liq_w =
162 .property(
164 .template value<double>(vars, pos, t, dt);
165 double const h_sat_vap_w =
167 .property(
169 .template value<double>(vars, pos, t, dt);
170
171 // TODO add a function to calculate dryness with constrain of 0
172 // to 1.
173 double const dryness = std::max(
176
177 double const T_int_pt =
178 (dryness == 0)
181 .template value<double>(vars, pos, t, dt)
182 : gas_phase
187 vars.temperature = T_int_pt;
188
189 // For the calculation of the void fraction of vapour,
190 // see Rohuani, Z., and E. Axelsson. "Calculation of volume void
191 // fraction in a subcooled and quality region." International
192 // Journal of Heat and Mass Transfer 17 (1970): 383-393.
193
194 // profile parameter of drift flux
195 double C_0 = 1 + 0.12 * (1 - dryness);
196
197 // For the surface tension calculation, see
198 // Cooper, J. R., and R. B. Dooley. "IAPWS release on surface
199 // tension of ordinary water substance." International Association
200 // for the Properties of Water and Steam (1994).
201 double const sigma_gl = 0.2358 *
202 std::pow((1 - T_int_pt / 647.096), 1.256) *
203 (1 - 0.625 * (1 - T_int_pt / 647.096));
204 // drift flux velocity
205 double const u_gu =
206 1.18 * (1 - dryness) *
207 std::pow((9.81) * sigma_gl *
209 0.25) /
211
212 // solving void fraction of vapor: Rouhani-Axelsson
213 double alpha = 0;
214 if (dryness != 0)
215 {
216 // Local Newton solver
217 using LocalJacobianMatrix =
222
224
226 {
229 u_gu, residual);
230 };
231
233 {
236 dryness, C_0, u_gu,
237 jacobian); // for solution dependent Jacobians
238 };
239
240 auto const update_solution =
241 [&](LocalUnknownVector const& increment)
242 {
243 // increment solution vectors
244 alpha += increment[0];
245 };
246
247 const int maximum_iterations(20);
248 const double residuum_tolerance(1.e-10);
249 const double increment_tolerance(0);
250
255
256 auto const success_iterations = newton_solver.solve(J_loc);
257
259 {
260 WARN(
261 "Attention! Steam void fraction has not been correctly "
262 "calculated!");
263 }
264 }
265
267
268 if (alpha == 0)
269 {
273 .template value<double>(vars, pos, t, dt);
274 }
275
278
279 auto& mix_density_prev = ip_data.mix_density_prev;
280 vars.density = mix_density;
281
282 auto const rho_dot = (mix_density - mix_density_prev) / dt;
283
284 double const liquid_water_velocity_act =
285 (alpha == 0) ? v_int_pt
286 : (1 - dryness) * mix_density * v_int_pt /
288 double const vapor_water_velocity_act =
289 (alpha == 0) ? 0
292
294 pi * r_i * r_i * alpha;
295
298 (1 - alpha);
299
300 // Slip parameter between two phases,
301 // see Akbar, Somaieh, N. Fathianpour, and Rafid Al Khoury. "A finite
302 // element model for high enthalpy two-phase flow in geothermal
303 // wellbores." Renewable Energy 94 (2016): 223-236.
304 double const gamma =
306 (1 - alpha) /
308 (1 - alpha * C_0) * liquid_water_density),
309 2) *
310 std::pow((C_0 - 1) * v_int_pt + u_gu, 2);
311
312 double const miu =
314 .template value<double>(vars, pos, t, dt);
315 double const Re = mix_density * v_int_pt * 2 * r_i / miu;
316
317 // Wall friction coefficient,
318 // Musivand Arzanfudi, Mehdi, and Rafid Al‐Khoury. "A compressible
319 // two‐fluid multiphase model for CO2 leakage through a wellbore."
320 // International Journal for Numerical Methods in Fluids 77.8 (2015):
321 // 477-507.
322 double f = 0.0;
323 if (Re > 10 && Re <= 2400)
324 {
325 f = 16 / Re;
326 }
327 else if (Re > 2400)
328 {
329 f = std::pow(std::log(xi / 3.7 / r_i) -
330 5.02 / Re * std::log(xi / 3.7 / r_i + 13 / Re),
331 -2) /
332 16;
333 }
334
335 double Q_hx = 0;
336 double const T_r_int_pt = N.dot(T_r);
337 // conductive heat exchange between wellbore and formation
338 if (_process_data.has_heat_exchange_with_formation)
339 {
340 // See Zhang, Pan, Pruess, Finsterle (2011). A time-convolution
341 // approach for modeling heat exchange between a wellbore and
342 // surrounding formation. Geothermics 40, 261-266.
343 const double alpha_r = k_r / rho_r / c_r;
344 const double t_d = alpha_r * t / (r_i * r_i);
345
346 double beta;
347 if (t_d < 2.8)
348 {
349 beta = std::pow((pi * t_d), -0.5) + 0.5 -
350 0.25 * std::pow((t_d / pi), 0.5) + 0.125 * t_d;
351 }
352 else
353 {
354 beta = 2 * (1 / (std::log(4 * t_d) - 2 * 0.57722) -
355 0.57722 /
356 std::pow((std::log(4 * t_d) - 2 * 0.57722), 2));
357 }
358
359 const double P_c = 2 * pi * r_i;
360 Q_hx = P_c * k_r * (T_r_int_pt - T_int_pt) / r_i * beta;
361 }
362
363 // mass exchange with reservoir
364 double const p_r_int_pt = N.dot(p_r);
365 double const PI_int_pt = N.dot(PI);
366 double Q_mx = PI_int_pt * (p_int_pt - p_r_int_pt);
367
368 // advective momentum and energy exchange with reservoir due to the mass
369 // exchange
370 double Q_mom = 0;
371 double Q_ene = 0;
372 if (Q_mx != 0)
373 {
374 Q_mom = Q_mx * v_int_pt;
375 // Only single-phase liquid condition is considered now
376 // TODO: update the two-phase flowing enthalpy from the feed zone.
377 vars.liquid_phase_pressure = p_r_int_pt;
378 vars.temperature = T_r_int_pt;
379 double const h_fres =
382 .template value<double>(vars, pos, t, dt);
383 Q_ene = Q_mx * h_fres;
384 }
385
386 // M matrix assembly
387 Mvv.noalias() += w * N.transpose() * mix_density * N;
388
389 Mhp.noalias() += -w * N.transpose() * N;
390 Mhh.noalias() += w * N.transpose() * mix_density * N;
391
392 // K matrix assembly
393 Kpv.noalias() += w * dNdx.transpose() * N * mix_density;
394
395 Kvp.noalias() += w * N.transpose() * dNdx;
396 Kvv.noalias() += w * N.transpose() * rho_dot * N;
397
398 Khh.noalias() += w * N.transpose() * mix_density * v_int_pt * dNdx;
399
400 // b matrix assembly
401 Bp.noalias() += w * N.transpose() * rho_dot + w * N.transpose() * Q_mx;
402
403 Bv.noalias() +=
404 w * dNdx.transpose() * mix_density * v_int_pt * v_int_pt +
405 w * dNdx.transpose() * gamma -
406 w * N.transpose() * f * mix_density * std::abs(v_int_pt) *
407 v_int_pt / (4 * r_i) -
408 w * N.transpose() * Q_mom;
409
410 Bh.noalias() +=
411 -1 / 2 * w * N.transpose() * rho_dot * v_int_pt * v_int_pt -
412 w * N.transpose() * mix_density * v_int_pt * vdot_int_pt +
413 1 / 2 * w * dNdx.transpose() * mix_density * v_int_pt * v_int_pt *
414 v_int_pt +
415 w * N.transpose() * (Q_hx / pi / r_i / r_i) -
416 w * N.transpose() * Q_ene;
417
418 if (_process_data.has_gravity)
419 {
421 N.transpose() * b * w * _element_direction[2];
422
423 Bv.noalias() += gravity_operator * mix_density;
424 Bh.noalias() += gravity_operator * mix_density * v_int_pt;
425 }
426 }
427
428 // debugging
429 // std::string sep = "\n----------------------------------------\n";
430 // Eigen::IOFormat CleanFmt(6, 0, ", ", "\n", "[", "]");
431 // std::cout << local_M.format(CleanFmt) << sep;
432 // std::cout << local_K.format(CleanFmt) << sep;
433 // std::cout << local_b.format(CleanFmt) << sep;
434}
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:34
void calculateJacobian(double const alpha, double const vapor_water_density, double const liquid_water_density, double const v_mix, double const dryness, double const C_0, double const u_gu, JacobianMatrix &Jac)
void calculateResidual(double const alpha, double const vapor_water_density, double const liquid_water_density, double const v_mix, double const dryness, double const C_0, double const u_gu, ResidualVector &res)
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
void shapeFunctionInterpolate(const NodalValues &, const ShapeMatrix &)

References _element, _element_direction, _integration_method, _ip_data, _process_data, MaterialPropertyLib::AqueousLiquid, calculateJacobian(), calculateResidual(), MathLib::createZeroedMatrix(), MathLib::createZeroedVector(), MaterialPropertyLib::density, MaterialPropertyLib::VariableArray::density, MaterialPropertyLib::enthalpy, MaterialPropertyLib::VariableArray::enthalpy, enthalpy_index, MaterialPropertyLib::Gas, NumLib::interpolateCoordinates(), MaterialPropertyLib::VariableArray::liquid_phase_pressure, ProcessLib::WellboreSimulator::NUM_NODAL_DOF, PI, pressure_index, MaterialPropertyLib::saturation_density, MaterialPropertyLib::saturation_enthalpy, ParameterLib::SpatialPosition::setElementID(), NumLib::detail::shapeFunctionInterpolate(), NumLib::NewtonRaphson< LinearSolver, JacobianMatrixUpdate, ResidualUpdate, SolutionUpdate >::solve(), MaterialPropertyLib::temperature, MaterialPropertyLib::VariableArray::temperature, velocity_index, MaterialPropertyLib::viscosity, and WARN().

◆ calculateJacobian()

template<typename ShapeFunction, int GlobalDim>
void ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::calculateJacobian ( double const alpha,
double const vapor_water_density,
double const liquid_water_density,
double const v_mix,
double const dryness,
double const C_0,
double const u_gu,
JacobianMatrix & Jac )
inline

Definition at line 154 of file WellboreSimulatorFEM.h.

Referenced by assemble().

◆ calculateResidual()

template<typename ShapeFunction, int GlobalDim>
void ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::calculateResidual ( double const alpha,
double const vapor_water_density,
double const liquid_water_density,
double const v_mix,
double const dryness,
double const C_0,
double const u_gu,
ResidualVector & res )
inline

Definition at line 137 of file WellboreSimulatorFEM.h.

Referenced by assemble().

◆ computeSecondaryVariableConcrete()

template<typename ShapeFunction, int GlobalDim>
void ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::computeSecondaryVariableConcrete ( double const ,
double const ,
Eigen::VectorXd const & ,
Eigen::VectorXd const &  )
inlineoverridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 179 of file WellboreSimulatorFEM.h.

184 {
185 auto const n_integration_points =
186 _integration_method.getNumberOfPoints();
187 auto const ele_id = _element.getID();
188
189 (*_process_data.mesh_prop_density)[ele_id] =
190 std::accumulate(_ip_data.begin(), _ip_data.end(), 0.,
191 [](double const s, auto const& ip)
192 { return s + ip.mix_density; }) /
194 }

References _element, _integration_method, _ip_data, and _process_data.

◆ getIntPtDryness()

template<typename ShapeFunction, int GlobalDim>
virtual std::vector< double > const & ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtDryness ( const double ,
std::vector< GlobalVector * > const & ,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & ,
std::vector< double > & cache ) const
inlineoverrideprotectedvirtual

◆ getIntPtLiquidMassFlowRate()

template<typename ShapeFunction, int GlobalDim>
virtual std::vector< double > const & ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtLiquidMassFlowRate ( const double ,
std::vector< GlobalVector * > const & ,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & ,
std::vector< double > & cache ) const
inlineoverrideprotectedvirtual

◆ getIntPtTemperature()

template<typename ShapeFunction, int GlobalDim>
virtual std::vector< double > const & ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtTemperature ( const double ,
std::vector< GlobalVector * > const & ,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & ,
std::vector< double > & cache ) const
inlineoverrideprotectedvirtual

◆ getIntPtVaporMassFlowRate()

template<typename ShapeFunction, int GlobalDim>
virtual std::vector< double > const & ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtVaporMassFlowRate ( const double ,
std::vector< GlobalVector * > const & ,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & ,
std::vector< double > & cache ) const
inlineoverrideprotectedvirtual

◆ getIntPtVaporVolumeFraction()

template<typename ShapeFunction, int GlobalDim>
virtual std::vector< double > const & ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getIntPtVaporVolumeFraction ( const double ,
std::vector< GlobalVector * > const & ,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & ,
std::vector< double > & cache ) const
inlineoverrideprotectedvirtual

◆ getShapeMatrix()

template<typename ShapeFunction, int GlobalDim>
Eigen::Map< const Eigen::RowVectorXd > ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::getShapeMatrix ( const unsigned integration_point) const
inlineoverridevirtual

Provides the shape matrix at the given integration point.

Implements NumLib::ExtrapolatableElement.

Definition at line 170 of file WellboreSimulatorFEM.h.

172 {
173 auto const& N = _ip_data[integration_point].N;
174
175 // assumes N is stored contiguously in memory
176 return Eigen::Map<const Eigen::RowVectorXd>(N.data(), N.size());
177 }

References _ip_data.

◆ postTimestepConcrete()

template<typename ShapeFunction, int GlobalDim>
void ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::postTimestepConcrete ( Eigen::VectorXd const & ,
Eigen::VectorXd const & ,
double const ,
double const ,
int const  )
inlineoverridevirtual

Reimplemented from ProcessLib::LocalAssemblerInterface.

Definition at line 196 of file WellboreSimulatorFEM.h.

200 {
201 unsigned const n_integration_points =
202 _integration_method.getNumberOfPoints();
203
204 for (unsigned ip = 0; ip < n_integration_points; ip++)
205 {
206 _ip_data[ip].pushBackState();
207 }
208 }

References _integration_method, and _ip_data.

Member Data Documentation

◆ _element

template<typename ShapeFunction, int GlobalDim>
MeshLib::Element const& ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::_element
protected

◆ _element_direction

template<typename ShapeFunction, int GlobalDim>
Eigen::Vector3d ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::_element_direction
protected

Definition at line 266 of file WellboreSimulatorFEM.h.

Referenced by WellboreSimulatorFEM(), and assemble().

◆ _integration_method

◆ _ip_data

◆ _is_axially_symmetric

template<typename ShapeFunction, int GlobalDim>
bool const ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::_is_axially_symmetric
protected

Definition at line 263 of file WellboreSimulatorFEM.h.

Referenced by WellboreSimulatorFEM().

◆ _process_data

template<typename ShapeFunction, int GlobalDim>
WellboreSimulatorProcessData const& ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::_process_data
protected

◆ enthalpy_index

template<typename ShapeFunction, int GlobalDim>
const int ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::enthalpy_index = 2 * ShapeFunction::NPOINTS
staticprotected

Definition at line 275 of file WellboreSimulatorFEM.h.

Referenced by assemble().

◆ enthalpy_size

template<typename ShapeFunction, int GlobalDim>
const int ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::enthalpy_size = ShapeFunction::NPOINTS
staticprotected

Definition at line 279 of file WellboreSimulatorFEM.h.

◆ jacobian_residual_size

template<typename ShapeFunction, int GlobalDim>
int const ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::jacobian_residual_size = 1
static

Definition at line 130 of file WellboreSimulatorFEM.h.

◆ pressure_index

template<typename ShapeFunction, int GlobalDim>
const int ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::pressure_index = 0
staticprotected

Definition at line 273 of file WellboreSimulatorFEM.h.

Referenced by assemble().

◆ pressure_size

template<typename ShapeFunction, int GlobalDim>
const int ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::pressure_size = ShapeFunction::NPOINTS
staticprotected

Definition at line 277 of file WellboreSimulatorFEM.h.

◆ velocity_index

template<typename ShapeFunction, int GlobalDim>
const int ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::velocity_index = ShapeFunction::NPOINTS
staticprotected

Definition at line 274 of file WellboreSimulatorFEM.h.

Referenced by assemble().

◆ velocity_size

template<typename ShapeFunction, int GlobalDim>
const int ProcessLib::WellboreSimulator::WellboreSimulatorFEM< ShapeFunction, GlobalDim >::velocity_size = ShapeFunction::NPOINTS
staticprotected

Definition at line 278 of file WellboreSimulatorFEM.h.


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