Allow for passing in functions of space into the penalty method.