making solver_common a template wrt dimension number