Biochar in thermal and thermochemical biorefineries—production of biochar as a coproduct