Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the calculation of the Darcy velocity in staggered TH #2127

Merged
merged 4 commits into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ProcessLib/HT/HTProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ void HTProcess::initializeConcreteProcess(
}
else
{
const int heat_transport_process_id = 0;
const int hydraulic_process_id = 1;

ProcessLib::createLocalAssemblers<StaggeredHTFEM>(
mesh.getDimension(), mesh.getElements(), dof_table,
pv.getShapeFunctionOrder(), _local_assemblers,
mesh.isAxiallySymmetric(), integration_order,
*_material_properties);
mesh.isAxiallySymmetric(), integration_order, *_material_properties,
heat_transport_process_id, hydraulic_process_id);
}

_secondary_variables.addSecondaryVariable(
Expand Down
26 changes: 16 additions & 10 deletions ProcessLib/HT/StaggeredHTFEM-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
std::vector<double>& local_b_data,
LocalCoupledSolutions const& coupled_xs)
{
if (coupled_xs.process_id == 0)
if (coupled_xs.process_id == _heat_transport_process_id)
{
assembleHeatTransportEquation(t, local_M_data, local_K_data,
local_b_data, coupled_xs);
Expand All @@ -47,14 +47,16 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
std::vector<double>& local_b_data,
LocalCoupledSolutions const& coupled_xs)
{
auto const& local_p = coupled_xs.local_coupled_xs[1];
auto const& local_p = coupled_xs.local_coupled_xs[_hydraulic_process_id];
auto const local_matrix_size = local_p.size();
// This assertion is valid only if all nodal d.o.f. use the same shape
// matrices.
assert(local_matrix_size == ShapeFunction::NPOINTS);

auto const& local_T1 = coupled_xs.local_coupled_xs[0];
auto const& local_T0 = coupled_xs.local_coupled_xs0[0];
auto const& local_T1 =
coupled_xs.local_coupled_xs[_heat_transport_process_id];
auto const& local_T0 =
coupled_xs.local_coupled_xs0[_heat_transport_process_id];
const double dt = coupled_xs.dt;

auto local_M = MathLib::createZeroedMatrix<LocalMatrixType>(
Expand Down Expand Up @@ -126,9 +128,10 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
GlobalDimMatrixType K_over_mu = intrinsic_permeability / viscosity;

// matrix assembly
local_M.noalias() += w * (porosity * dfluid_density_dp / fluid_density +
specific_storage) *
N.transpose() * N;
local_M.noalias() +=
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change due to clang-format

w *
(porosity * dfluid_density_dp / fluid_density + specific_storage) *
N.transpose() * N;

local_K.noalias() += w * dNdx.transpose() * K_over_mu * dNdx;

Expand Down Expand Up @@ -171,7 +174,7 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
std::vector<double>& /*local_b_data*/,
LocalCoupledSolutions const& coupled_xs)
{
auto const& local_p = coupled_xs.local_coupled_xs[1];
auto const& local_p = coupled_xs.local_coupled_xs[_hydraulic_process_id];
auto const local_matrix_size = local_p.size();
// This assertion is valid only if all nodal d.o.f. use the same shape
// matrices.
Expand All @@ -180,7 +183,8 @@ void StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
auto local_p_Eigen_type =
Eigen::Map<const NodalVectorType>(&local_p[0], local_matrix_size);

auto const& local_T1 = coupled_xs.local_coupled_xs[0];
auto const& local_T1 =
coupled_xs.local_coupled_xs[_heat_transport_process_id];

auto local_M = MathLib::createZeroedMatrix<LocalMatrixType>(
local_M_data, local_matrix_size, local_matrix_size);
Expand Down Expand Up @@ -282,7 +286,9 @@ StaggeredHTFEM<ShapeFunction, IntegrationMethod, GlobalDim>::
auto const local_xs = getCurrentLocalSolutions(
*(this->_coupled_solutions), indices_of_all_coupled_processes);

return this->getIntPtDarcyVelocityLocal(t, local_xs[0], local_xs[1], cache);
return this->getIntPtDarcyVelocityLocal(
t, local_xs[_hydraulic_process_id],
local_xs[_heat_transport_process_id], cache);
}
} // namespace HT
} // namespace ProcessLib
10 changes: 8 additions & 2 deletions ProcessLib/HT/StaggeredHTFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ class StaggeredHTFEM : public HTFEM<ShapeFunction, IntegrationMethod, GlobalDim>
std::size_t const local_matrix_size,
bool is_axially_symmetric,
unsigned const integration_order,
HTMaterialProperties const& material_properties)
HTMaterialProperties const& material_properties,
const int heat_transport_process_id,
const int hydraulic_process_id)
: HTFEM<ShapeFunction, IntegrationMethod, GlobalDim>(
element, local_matrix_size, is_axially_symmetric,
integration_order, material_properties, 1)
integration_order, material_properties, 1),
_heat_transport_process_id(heat_transport_process_id),
_hydraulic_process_id(hydraulic_process_id)
{
}

Expand All @@ -84,6 +88,8 @@ class StaggeredHTFEM : public HTFEM<ShapeFunction, IntegrationMethod, GlobalDim>
double const t, std::vector<double>& local_M_data,
std::vector<double>& local_K_data, std::vector<double>& local_b_data,
LocalCoupledSolutions const& coupled_xs);
const int _heat_transport_process_id;
const int _hydraulic_process_id;
};

} // namespace HT
Expand Down
Loading