Skip to content
Snippets Groups Projects
Commit 10145297 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[PL] extended BC interface

parent 2956c87a
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,8 @@ public:
//! Applies natural BCs (i.e. non-Dirichlet BCs) to the stiffness matrix
//! \c K and the vector \c b.
virtual void applyNaturalBC(const double /*t*/, GlobalVector const& /*x*/,
GlobalMatrix& /*K*/, GlobalVector& /*b*/)
GlobalMatrix& /*K*/, GlobalVector& /*b*/,
GlobalMatrix* /*Jac*/)
{
// By default it is assumed that the BC is not a natural BC. Therefore
// there is nothing to do here.
......@@ -43,7 +44,7 @@ public:
//! Writes the values of essential BCs to \c bc_values.
virtual void getEssentialBCValues(
const double /*t*/,
const double /*t*/, GlobalVector const& /*x*/,
NumLib::IndexValueVector<GlobalIndexType>& /*bc_values*/) const
{
// By default it is assumed that the BC is not an essential BC.
......
......@@ -14,10 +14,11 @@ namespace ProcessLib
void BoundaryConditionCollection::applyNaturalBC(const double t,
GlobalVector const& x,
GlobalMatrix& K,
GlobalVector& b)
GlobalVector& b,
GlobalMatrix* Jac)
{
for (auto const& bc : _boundary_conditions)
bc->applyNaturalBC(t, x, K, b);
bc->applyNaturalBC(t, x, K, b, Jac);
}
void BoundaryConditionCollection::addBCsForProcessVariables(
......@@ -43,4 +44,4 @@ void BoundaryConditionCollection::addBCsForProcessVariables(
// object if needed.
_dirichlet_bcs.resize(_boundary_conditions.size());
}
}
} // namespace ProcessLib
......@@ -26,16 +26,16 @@ public:
}
void applyNaturalBC(const double t, GlobalVector const& x, GlobalMatrix& K,
GlobalVector& b);
GlobalVector& b, GlobalMatrix* Jac);
std::vector<NumLib::IndexValueVector<GlobalIndexType>> const*
getKnownSolutions(double const t) const
getKnownSolutions(double const t, GlobalVector const& x) const
{
auto const n_bcs = _boundary_conditions.size();
for (std::size_t i=0; i<n_bcs; ++i) {
auto const& bc = *_boundary_conditions[i];
auto& dirichlet_storage = _dirichlet_bcs[i];
bc.getEssentialBCValues(t, dirichlet_storage);
bc.getEssentialBCValues(t, x, dirichlet_storage);
}
return &_dirichlet_bcs;
}
......
......@@ -187,7 +187,7 @@ void Process::assemble(const double t, GlobalVector const& x, GlobalMatrix& M,
const auto pcs_id =
(_coupled_solutions) != nullptr ? _coupled_solutions->process_id : 0;
_boundary_conditions[pcs_id].applyNaturalBC(t, x, K, b);
_boundary_conditions[pcs_id].applyNaturalBC(t, x, K, b, nullptr);
_source_term_collections[pcs_id].integrateNodalSourceTerms(t, b);
}
......@@ -207,7 +207,7 @@ void Process::assembleWithJacobian(const double t, GlobalVector const& x,
// TODO: apply BCs to Jacobian.
const auto pcs_id =
(_coupled_solutions) != nullptr ? _coupled_solutions->process_id : 0;
_boundary_conditions[pcs_id].applyNaturalBC(t, x, K, b);
_boundary_conditions[pcs_id].applyNaturalBC(t, x, K, b, &Jac);
}
void Process::constructDofTable()
......
......@@ -16,13 +16,13 @@
#include "NumLib/ODESolver/ODESystem.h"
#include "NumLib/ODESolver/TimeDiscretization.h"
#include "ProcessLib/BoundaryCondition/BoundaryConditionCollection.h"
#include "ProcessLib/SourceTerms/SourceTermCollection.h"
#include "ProcessLib/Output/CachedSecondaryVariable.h"
#include "ProcessLib/Output/ExtrapolatorData.h"
#include "ProcessLib/Output/IntegrationPointWriter.h"
#include "ProcessLib/Output/SecondaryVariable.h"
#include "ProcessLib/Parameter/Parameter.h"
#include "ProcessLib/SourceTerms/NodalSourceTerm.h"
#include "ProcessLib/SourceTerms/SourceTermCollection.h"
#include "AbstractJacobianAssembler.h"
#include "ProcessVariable.h"
......@@ -103,11 +103,11 @@ public:
GlobalMatrix& Jac) final;
std::vector<NumLib::IndexValueVector<GlobalIndexType>> const*
getKnownSolutions(double const t) const final
getKnownSolutions(double const t, GlobalVector const& x) const final
{
const auto pcs_id =
(_coupled_solutions) ? _coupled_solutions->process_id : 0;
return _boundary_conditions[pcs_id].getKnownSolutions(t);
return _boundary_conditions[pcs_id].getKnownSolutions(t, x);
}
virtual NumLib::LocalToGlobalIndexMap const& getDOFTable(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment