From 48d8685bfccc9729fccd1b39e57c2ea8c53edebe Mon Sep 17 00:00:00 2001 From: podlesny <podlesny@zedat.fu-berlin.de> Date: Mon, 8 Feb 2021 18:59:50 +0100 Subject: [PATCH] generalize velocity boundary condition to allow setting loading time, previously 0.1 fix --- dune/tectonic/factories/twoblocksfactory.cc | 2 +- dune/tectonic/problem-data/bc.hh | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dune/tectonic/factories/twoblocksfactory.cc b/dune/tectonic/factories/twoblocksfactory.cc index 44070552..a5f57cba 100644 --- a/dune/tectonic/factories/twoblocksfactory.cc +++ b/dune/tectonic/factories/twoblocksfactory.cc @@ -121,7 +121,7 @@ void TwoBlocksFactory<HostGridType, VectorTEMPLATE>::setBoundaryConditions() { using Function = Dune::VirtualFunction<double, double>; std::shared_ptr<Function> neumannFunction = std::make_shared<NeumannCondition>(); - std::shared_ptr<Function> velocityDirichletFunction = std::make_shared<VelocityDirichletCondition>(this->parset_.template get<double>("boundary.dirichlet.finalVelocity")); + std::shared_ptr<Function> velocityDirichletFunction = std::make_shared<VelocityDirichletCondition>(this->parset_.template get<double>("boundary.dirichlet.finalVelocity"), 0.25); const double lengthScale = CuboidGeometry::lengthScale(); diff --git a/dune/tectonic/problem-data/bc.hh b/dune/tectonic/problem-data/bc.hh index ac82e47f..075f5749 100644 --- a/dune/tectonic/problem-data/bc.hh +++ b/dune/tectonic/problem-data/bc.hh @@ -7,8 +7,9 @@ class VelocityDirichletCondition : public Dune::VirtualFunction<double, double> { public: - VelocityDirichletCondition(const double finalVelocity = 5e-5) : - finalVelocity_(finalVelocity) + VelocityDirichletCondition(const double finalVelocity = 5e-5, const double threshold = 0.1) : + finalVelocity_(finalVelocity), + threshold_(threshold) {} void evaluate(double const &relativeTime, double &y) const { @@ -21,8 +22,8 @@ class VelocityDirichletCondition else std::cout << "- final velocity reached" << std::endl;*/ - y = (relativeTime <= 0.1) - ? finalVelocity_ * (1.0 - std::cos(relativeTime * M_PI / 0.1)) / 2.0 + y = (relativeTime <= threshold_) + ? finalVelocity_ * (1.0 - std::cos(relativeTime * M_PI / threshold_)) / 2.0 : finalVelocity_; //y = relativeTime * finalVelocity; @@ -31,6 +32,7 @@ class VelocityDirichletCondition private: const double finalVelocity_; + const double threshold_; }; class NeumannCondition : public Dune::VirtualFunction<double, double> { -- GitLab