Commit 4d53d313 authored by Andreas Nüßing's avatar Andreas Nüßing

[TDCS] add constraints assembly for CG dirichlet

parent e9b31374
......@@ -85,6 +85,7 @@ namespace duneuro
assert(volumeConductor_);
dataTree.set("degree", degree);
dataTree.set("element_type", to_string(elementType));
functionSpace_.assembleConstraints(boundaryCondition_);
}
CGSolver(std::shared_ptr<const VC> volumeConductor,
......@@ -111,7 +112,9 @@ namespace duneuro
const Dune::ParameterTree& config, DataTree dataTree = DataTree())
{
Dune::Timer timer;
randomize_uniform(Dune::PDELab::Backend::native(solution), DF(-1.0), DF(1.0));
//randomize_uniform(Dune::PDELab::Backend::native(solution), DF(-1.0), DF(1.0));
Dune::PDELab::interpolate(dirichletExtension_, functionSpace_.getGFS(), solution);
functionSpace_.setNonConstrainedDOFS(solution, 0.0);
linearSolver_.apply(solverBackend, solution, config, dataTree);
dataTree.set("time", timer.elapsed());
}
......
......@@ -15,7 +15,7 @@ namespace duneuro
TDCSPatchCGParameter(std::shared_ptr<const VC> volumeConductor,
const PatchSet<typename VC::ctype, VC::dim>& patchSet)
: BaseT(volumeConductor), patchSet_(patchSet)
: BaseT(volumeConductor), patchSet_(patchSet), volumeConductor_(volumeConductor)
{
}
......@@ -37,16 +37,26 @@ namespace duneuro
}
}
template <class IG>
typename Traits::RangeFieldType g(const IG& is,
const typename Traits::IntersectionDomainType& xlocal) const
template <class EG>
typename Traits::RangeFieldType g(const EG& eg, const typename Traits::DomainType& local) const
{
return patchSet_.accumulate(is.geometry().global(xlocal), is.unitOuterNormal(xlocal),
PatchBoundaryType::Dirichlet);
if (!eg.hasBoundaryIntersections()) {
return 0;
} else {
for (const auto& it : Dune::intersections(volumeConductor_->gridView(), eg)) {
if (it.boundary()) {
std::cout << "evaluating dirichlet at " << eg.geometry().global(local) << std::endl;
return patchSet_.accumulate(eg.geometry().global(local), it.centerUnitOuterNormal(),
PatchBoundaryType::Dirichlet);
}
}
DUNE_THROW(Dune::Exception, "should never be reached (no boundary intersection)");
}
}
private:
PatchSet<typename VC::ctype, VC::dim> patchSet_;
std::shared_ptr<const VC> volumeConductor_;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment