Skip to content
Snippets Groups Projects
Commit 3a964fc9 authored by podlesny's avatar podlesny
Browse files

new velocity bc for velocity step test

parent 4d270741
No related branches found
No related tags found
No related merge requests found
#ifndef SRC_ONE_BODY_PROBLEM_DATA_BC_HH
#define SRC_ONE_BODY_PROBLEM_DATA_BC_HH
#include <cassert>
#include <dune/common/function.hh>
class VelocityDirichletCondition
......@@ -35,6 +37,38 @@ class VelocityDirichletCondition
const double threshold_;
};
class VelocityStepDirichletCondition
: public Dune::VirtualFunction<double, double> {
public:
VelocityStepDirichletCondition(const double initialVelocity = 5e-5, const double finalVelocity = 1e-4, const double loadingThreshold = 0.1, const double stepTime = 0.5) :
initialVelocity_(initialVelocity),
finalVelocity_(finalVelocity),
loadingThreshold_(loadingThreshold),
stepTime_(stepTime)
{
assert(loadingThreshold_ < stepTime_);
}
void evaluate(double const &relativeTime, double &y) const {
// Assumed to vanish at time zero
y = finalVelocity_;
if (relativeTime <= loadingThreshold_) {
y = initialVelocity_ * (1.0 - std::cos(relativeTime * M_PI / loadingThreshold_)) / 2.0;
} else if (relativeTime < stepTime_) {
y = initialVelocity_;
}
}
private:
const double initialVelocity_;
const double finalVelocity_;
const double loadingThreshold_;
const double stepTime_;
};
class NeumannCondition : public Dune::VirtualFunction<double, double> {
public:
NeumannCondition(double c = 0.0) : c_(c) {}
......
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