import math class neumannCondition: def __call__(self, relativeTime): return 0 class velocityDirichletCondition: def __call__(self, relativeTime): # Assumed to vanish at time zero finalVelocity = -5e-5 if relativeTime <= 0.1: return finalVelocity * ( 1.0 - math.cos(relativeTime * math.pi / 0.1) ) / 2.0 return finalVelocity Functions = { 'neumannCondition' : neumannCondition(), 'velocityDirichletCondition' : velocityDirichletCondition() }