Skip to content

Commit

Permalink
[PL] Remove M and K from asmWithJacobian functions
Browse files Browse the repository at this point in the history
  • Loading branch information
endJunction committed Jul 17, 2024
1 parent 4466324 commit b0cfd47
Show file tree
Hide file tree
Showing 83 changed files with 123 additions and 223 deletions.
2 changes: 0 additions & 2 deletions ProcessLib/ComponentTransport/ComponentTransportFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -1285,8 +1285,6 @@ class LocalAssemblerData : public ComponentTransportLocalAssemblerInterface
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) override
{
Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/ComponentTransport/ComponentTransportProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void ComponentTransportProcess::assembleConcreteProcess(
void ComponentTransportProcess::assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac)
GlobalVector& b, GlobalMatrix& Jac)
{
DBUG("AssembleWithJacobian ComponentTransportProcess.");

Expand All @@ -296,7 +296,7 @@ void ComponentTransportProcess::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev,
process_id, &M, &K, &b, &Jac);
process_id, &b, &Jac);

// b is the negated residumm used in the Newton's method.
// Here negating b is to recover the primitive residuum.
Expand Down
3 changes: 1 addition & 2 deletions ProcessLib/ComponentTransport/ComponentTransportProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ class ComponentTransportProcess final : public Process
void assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b,
GlobalMatrix& Jac) override;
GlobalVector& b, GlobalMatrix& Jac) override;

void preOutputConcreteProcess(const double t, double const dt,
std::vector<GlobalVector*> const& x,
Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/HT/HTProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void HTProcess::assembleConcreteProcess(
void HTProcess::assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac)
GlobalVector& b, GlobalMatrix& Jac)
{
DBUG("AssembleWithJacobian HTProcess.");

Expand All @@ -131,7 +131,7 @@ void HTProcess::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev,
process_id, &M, &K, &b, &Jac);
process_id, &b, &Jac);
}

std::tuple<NumLib::LocalToGlobalIndexMap*, bool>
Expand Down
3 changes: 1 addition & 2 deletions ProcessLib/HT/HTProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ class HTProcess final : public Process
void assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b,
GlobalMatrix& Jac) override;
GlobalVector& b, GlobalMatrix& Jac) override;

/**
* @copydoc ProcessLib::Process::getDOFTableForExtrapolatorData()
Expand Down
2 changes: 0 additions & 2 deletions ProcessLib/HeatConduction/HeatConductionFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ class LocalAssemblerData : public HeatConductionLocalAssemblerInterface
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_M_data*/,
std::vector<double>& /*local_K_data*/,
std::vector<double>& local_rhs_data,
std::vector<double>& local_Jac_data) override
{
Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/HeatConduction/HeatConductionProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void HeatConductionProcess::assembleConcreteProcess(
void HeatConductionProcess::assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac)
GlobalVector& b, GlobalMatrix& Jac)
{
DBUG("AssembleWithJacobian HeatConductionProcess.");

Expand All @@ -121,7 +121,7 @@ void HeatConductionProcess::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, getActiveElementIDs(), dof_table, t, dt, x, x_prev,
process_id, &M, &K, &b, &Jac);
process_id, &b, &Jac);

transformVariableFromGlobalVector(b, 0 /*variable id*/,
*_local_to_global_index_map, *_heat_flux,
Expand Down
3 changes: 1 addition & 2 deletions ProcessLib/HeatConduction/HeatConductionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ class HeatConductionProcess final : public Process
const double t, double const /*dt*/,
std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b,
GlobalMatrix& Jac) override;
GlobalVector& b, GlobalMatrix& Jac) override;

void preOutputConcreteProcess(const double t, double const dt,
std::vector<GlobalVector*> const& x,
Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void HeatTransportBHEProcess::assembleConcreteProcess(
void HeatTransportBHEProcess::assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac)
GlobalVector& b, GlobalMatrix& Jac)
{
DBUG("AssembleWithJacobian HeatTransportBHE process.");

Expand All @@ -188,7 +188,7 @@ void HeatTransportBHEProcess::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, getActiveElementIDs(), dof_table, t, dt, x, x_prev,
process_id, &M, &K, &b, &Jac);
process_id, &b, &Jac);
}

void HeatTransportBHEProcess::computeSecondaryVariableConcrete(
Expand Down
3 changes: 1 addition & 2 deletions ProcessLib/HeatTransportBHE/HeatTransportBHEProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class HeatTransportBHEProcess final : public Process
void assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b,
GlobalMatrix& Jac) override;
GlobalVector& b, GlobalMatrix& Jac) override;

void createBHEBoundaryConditionTopBottom(
std::vector<std::vector<MeshLib::Node*>> const& all_bhe_nodes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ void HeatTransportBHELocalAssemblerBHE<ShapeFunction, BHEType>::
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)
{
Expand All @@ -236,6 +234,8 @@ void HeatTransportBHELocalAssemblerBHE<ShapeFunction, BHEType>::
auto local_rhs = MathLib::createZeroedVector<BheLocalVectorType>(
local_rhs_data, local_matrix_size);

std::vector<double> local_M_data(local_Jac_data.size());
std::vector<double> local_K_data(local_Jac_data.size());
assemble(t, dt, local_x, local_x_prev, local_M_data, local_K_data,
local_rhs_data /*not going to be used*/);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ class HeatTransportBHELocalAssemblerBHE
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_M_data*/,
std::vector<double>& /*local_K_data*/,
std::vector<double>& local_rhs_data,
std::vector<double>& local_Jac_data) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,8 @@ void HeatTransportBHELocalAssemblerSoil<ShapeFunction>::assemble(
template <typename ShapeFunction>
void 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)
std::vector<double> const& local_x_prev,
std::vector<double>& local_rhs_data, std::vector<double>& local_Jac_data)
{
assert(local_x.size() == ShapeFunction::NPOINTS);
auto const local_matrix_size = local_x.size();
Expand All @@ -212,6 +211,8 @@ void HeatTransportBHELocalAssemblerSoil<ShapeFunction>::assembleWithJacobian(
auto local_rhs = MathLib::createZeroedVector<NodalVectorType>(
local_rhs_data, local_matrix_size);

std::vector<double> local_M_data(local_Jac_data.size());
std::vector<double> local_K_data(local_Jac_data.size());
assemble(t, dt, local_x, local_x_prev, local_M_data, local_K_data,
local_rhs_data /*not going to be used*/);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ class HeatTransportBHELocalAssemblerSoil
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_M_data*/,
std::vector<double>& /*local_K_data*/,
std::vector<double>& local_rhs_data,
std::vector<double>& local_Jac_data) override;

Expand Down
14 changes: 6 additions & 8 deletions ProcessLib/HydroMechanics/HydroMechanicsFEM-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ void HydroMechanicsLocalAssembler<ShapeFunctionDisplacement,
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)
{
Expand Down Expand Up @@ -791,12 +789,12 @@ template <typename ShapeFunctionDisplacement, typename ShapeFunctionPressure,
int DisplacementDim>
void HydroMechanicsLocalAssembler<ShapeFunctionDisplacement,
ShapeFunctionPressure, DisplacementDim>::
assembleWithJacobianForStaggeredScheme(
const double 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)
assembleWithJacobianForStaggeredScheme(const double 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)
{
// For the equations with pressure
if (process_id == _process_data.hydraulic_process_id)
Expand Down
3 changes: 0 additions & 3 deletions ProcessLib/HydroMechanics/HydroMechanicsFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,12 @@ class HydroMechanicsLocalAssembler
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_M_data*/,
std::vector<double>& /*local_K_data*/,
std::vector<double>& local_rhs_data,
std::vector<double>& local_Jac_data) override;

void assembleWithJacobianForStaggeredScheme(
const double 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) override;

Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/HydroMechanics/HydroMechanicsProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void HydroMechanicsProcess<DisplacementDim>::
assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac)
GlobalVector& b, GlobalMatrix& Jac)
{
// For the monolithic scheme
bool const use_monolithic_scheme = _process_data.isMonolithicSchemeUsed();
Expand Down Expand Up @@ -339,7 +339,7 @@ void HydroMechanicsProcess<DisplacementDim>::
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev,
process_id, &M, &K, &b, &Jac);
process_id, &b, &Jac);

auto copyRhs = [&](int const variable_id, auto& output_vector)
{
Expand Down
3 changes: 1 addition & 2 deletions ProcessLib/HydroMechanics/HydroMechanicsProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ class HydroMechanicsProcess final : public Process
const double t, double const /*dt*/,
std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b,
GlobalMatrix& Jac) override;
GlobalVector& b, GlobalMatrix& Jac) override;

void preTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
double const t, double const dt,
Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ template <int GlobalDim>
void HydroMechanicsProcess<GlobalDim>::assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac)
GlobalVector& b, GlobalMatrix& Jac)
{
DBUG("AssembleWithJacobian HydroMechanicsProcess.");

Expand All @@ -471,7 +471,7 @@ void HydroMechanicsProcess<GlobalDim>::assembleWithJacobianConcreteProcess(
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, getActiveElementIDs(), dof_table, t, dt, x, x_prev,
process_id, &M, &K, &b, &Jac);
process_id, &b, &Jac);

auto copyRhs = [&](int const variable_id, auto& output_vector)
{
Expand Down
3 changes: 1 addition & 2 deletions ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ class HydroMechanicsProcess final : public Process
void assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b,
GlobalMatrix& Jac) override;
GlobalVector& b, GlobalMatrix& Jac) override;
void preTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
double const t, double const dt,
int const process_id) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class HydroMechanicsLocalAssemblerInterface
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_M_data*/,
std::vector<double>& /*local_K_data*/,
std::vector<double>& local_b_data,
std::vector<double>& local_Jac_data) override
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class SmallDeformationLocalAssemblerInterface
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_M_data*/,
std::vector<double>& /*local_K_data*/,
std::vector<double>& local_b_data,
std::vector<double>& local_Jac_data) override
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ void SmallDeformationLocalAssemblerMatrix<ShapeFunction, DisplacementDim>::
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_b_data,
std::vector<double>& local_Jac_data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ class SmallDeformationLocalAssemblerMatrix
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_M_data*/,
std::vector<double>& /*local_K_data*/,
std::vector<double>& local_b_data,
std::vector<double>& local_Jac_data) override;

Expand Down
4 changes: 2 additions & 2 deletions ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void SmallDeformationProcess<DisplacementDim>::
assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac)
GlobalVector& b, GlobalMatrix& Jac)
{
DBUG("AssembleWithJacobian SmallDeformationProcess.");

Expand All @@ -439,7 +439,7 @@ void SmallDeformationProcess<DisplacementDim>::
GlobalExecutor::executeSelectedMemberDereferenced(
_global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
_local_assemblers, getActiveElementIDs(), dof_table, t, dt, x, x_prev,
process_id, &M, &K, &b, &Jac);
process_id, &b, &Jac);
}
template <int DisplacementDim>
void SmallDeformationProcess<DisplacementDim>::preTimestepConcreteProcess(
Expand Down
3 changes: 1 addition & 2 deletions ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ class SmallDeformationProcess final : public Process
void assembleWithJacobianConcreteProcess(
const double t, double const dt, std::vector<GlobalVector*> const& x,
std::vector<GlobalVector*> const& x_prev, int const process_id,
GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b,
GlobalMatrix& Jac) override;
GlobalVector& b, GlobalMatrix& Jac) override;

void preTimestepConcreteProcess(std::vector<GlobalVector*> const& x,
double const t, double const dt,
Expand Down
2 changes: 0 additions & 2 deletions ProcessLib/LargeDeformation/LargeDeformationFEM.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ class LargeDeformationLocalAssembler
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_M_data*/,
std::vector<double>& /*local_K_data*/,
std::vector<double>& local_b_data,
std::vector<double>& local_Jac_data) override
{
Expand Down
Loading

0 comments on commit b0cfd47

Please sign in to comment.