The energy that flows through most ecosystems comes from the sun. primary producers convert a fraction of the sun's energy into chemical energy, which can be used by consumers. food webs describe how energy flows between trophic levels in an ecosystem, and a trophic pyramid represents the amount of energy available at each trophic level.