4#ifndef lethe_cahn_hilliard_filter_h
5#define lethe_cahn_hilliard_filter_h
28 static std::shared_ptr<CahnHilliardFilterBase>
56 return unfiltered_phase;
79 return (std::abs(unfiltered_phase) < 1) ? unfiltered_phase :
80 sgn(unfiltered_phase);
106 return tanh(
beta * unfiltered_phase);
virtual double filter_phase(const double &unfiltered_phase) override
Calculate the value of the filtered phase fraction.
CahnHilliardClipFilter()=default
virtual double filter_phase(const double &unfiltered_phase)=0
Calculate the value of the filtered phase fraction.
static std::shared_ptr< CahnHilliardFilterBase > model_cast(const Parameters::CahnHilliard &cahn_hilliard_parameters)
Instantiate and return a pointer to a CahnHilliardFilterBase object by casting it to the proper child...
CahnHilliardFilterBase()=default
virtual ~CahnHilliardFilterBase()=default
Default destructor.
CahnHilliardNoFilter()=default
virtual double filter_phase(const double &unfiltered_phase) override
Return the phase fraction with no modification.
CahnHilliardTanhFilter(const double beta)
virtual double filter_phase(const double &unfiltered_phase) override
Calculate the value of the filtered phase fraction.
constexpr int sgn(const T val) noexcept
Retrieve the sign of a value.