define solver_elemental and use it for dynamic polymorphism.