## 1 Introduction  
In the last decades, the world population has increased constantly, reaching 7.8 billion people in 2020, even though the growth rate has decreased by 1% yearly in the last few years [1]. Europe is the third most populated region on the planet, after Asia and Africa, also showing a constant population increase [2], and it is foreseen that this pattern will remain until 2050 [2]. Furthermore, the European society is quicky turning into an aged society [3] and mostly metropolitan, with 74.73% of its population living in large cities [4]. The population growth matches the need to reduce greenhouse gas emissions and, thus, help fight climate change. With a CO\({}_{2}\) concentration in the atmosphere of 416 ppm [5] and a thermal anomaly in the atmosphere that reaches +0.99 \({}^{\circ}\)C [6], the use of renewable energy sources is a necessity, including the improvement of the efficiency, the capture, and the geological storage of CO\({}_{2}\). This shaping of the population makes it necessary to change the food chain production, for example, the production of meat from farm animals, ensuring access to a wide range of food. Spain is the country with the highest animal production in the European Union [7], with pigs being the most important group. In Spain, as well as in other countries, the tendency to farm livestock in the last years has led to the specialisation and concentration, which has meant a decrease in the number of farms but an increase in the average number of animals per farm [8, 9]. This industrial model entails a series of environmental impacts, where manure is considered among the most relevant [10]. The management of this waste has an importance similar to any other phase of the commodity chain and is considered a principal factor of the success of the efficiency management [11]. In Spain, it is estimated that the production of this waste reaches 50 million tonnes annually [12]. Usually, manure is used as an organic fertilizer, but this can cause damage if over-applied (mostly N and P) in agriculture, which leads to the contamination of soil and water [13]. The environmental impacts related to pig breeding, such as climate change, acidification, and eutrophication, are mainly caused by inadequate treatment of manure [14; 15; 16]. The European Union Directive 91/676/EEC concerning the protection of waters against pollution caused by nitrates from agricultural sources has been the main driving force to develop and employ management methods by adopting appropriate fertilization plans adapted to the necessities of the soils and farming [17]. There is a wide range of treatment systems to process the different kinds of livestock manure [18], such as phase separation, ammonia absorption and extraction, thermal concentration (evaporation and drying), nitrification/denitrification, ammonium salt precipitation, and compost [19]. Anaerobic digestion is a livestock defecation treatment system [20] that involves the reduction of contaminating emissions (CH\({}_{4}\), N\({}_{2}\)O, NH\({}_{3}\), CO\({}_{2}\)) [21]. Anaerobic digestion prevents ammonia volatilization and removes volatile organic compounds [22; 23], which makes it possible to prevent odor problems, water quality problems, and eutrophication [24]. It is well established in countries such as Germany, Austria, Denmark, Italy, and the Netherlands [25]. Through the degradation progress of the organic matter that takes place during anaerobic digestion, biogas is produced [26]. This gas, mainly formed by CH\({}_{4}\) and CO\({}_{2}\) in variable proportions [27], is considered a renewable energy source. Its attractiveness as an energy source is driven by the fact that its use reduces greenhouse gas emissions [28; 29] by displacing the use of fossil-based natural gas. In Spain, the installed capacity is 234 MW [30], and a potential of 26,683 GWh of biogas is estimated, enough to cover 40% of household energy demand [31].