Simultaneous resource recovery and ammonia volatilization minimization in animal husbandry and agriculture