Nano-Intermediate of Magnetite Nanoparticles Supported on Activated Carbon from Spent Coffee Grounds for Treatment of Wastewater from Oil Industry and Energy Production

This work focused on evaluating the adsorptive removal of crude oil using a nanointermediate based on magnetite nanoparticles supported on activated carbon synthesized from spent coffee grounds and the subsequent catalytic oil decomposition to recover by-products and regenerate the support material. The magnetite nanoparticles were synthesized by the co-precipitation method and were used as active phases on prepared activated carbon. The amount of crude oil adsorbed was determined by adsorption isotherms. In addition, dynamic tests were performed on a packed bed to evaluate the efficiency of the removal process. Thermogravimetric analysis and mass spectrometry were used to evaluate the catalytic powder and the quantification of by-products. Contrasting the results with commercial carbon, the one synthesized from the coffee residue showed a greater affinity for the oil. Likewise, the adsorption capacity increased by doping activated carbon with magnetite nanoparticles, obtaining an efficiency greater than 10%. The crude oil decomposition was carried out successfully by thermal cracking, obtaining a 100% removal. The gas produced after decomposition contains light hydrocarbons such as C2H4 and CH4 and shows a decrease in polluting species such as CO and CO2, leading to greater environmental sustainability of the process.


Introduction
There is substantial water production during hydrocarbons extraction, attaining nine barrels of water per barrel of crude oil (water cut ≥ 0.9) [1,2]. Generally, this water reaches the surface contaminated by solids and emulsified oil [3,4]. The produced water cannot be stored for long periods due to costs and space availability. Therefore, its reinjection or dumping into water sources should be considered, while international standards for dumping and reinjection require low crude oil concentrations (≤10 mg L −1 ) [5,6]. Correct water treatment is required to comply with these requirements and reduce the damage to ecosystems and human health caused by the waste's poor disposal [7,8]. In addition, many agents (natural or artificial) present in the reservoirs can stabilize oil-in-water emulsions (O/W) [9][10][11][12]. When stabilizing the emulsions, secondary and tertiary treatment stages are required for removing large, medium, small, and ultra-small oil droplets [3,[13][14][15][16]. These stages include physical [13,17], chemical [3], biological [18], membranes [3,16,17], and adsorption treatments. In Colombia, for the adsorption of crude oil, agro-industrial residues are used, such as walnut or rice husks [19]. These materials present serious disadvantages during their implementation due to their complex cleaning and fast saturation system. To find an efficient and reusable treatment system, studies have been carried out to determine the viability of nanointermediates as adsorbents since they allow the removal of a more significant number of contaminants to traditional adsorbents [19,20].
Recently, carbon-based materials with superhydrophobic and super-oleophilic properties have been used as adsorbents of oily particles due to their excellent properties, such as the indicated catalysts can not only generate a 100% decomposition of the adsorbed crude oil, but they also allow the self-regeneration of the material with low energy costs.
Several works have evaluated the combination of carbon-based materials and metal oxide nanoparticles for crude oil adsorption. Liu et al. [47] conjugated magnetite nanoparticles with carbonaceous nanomaterials such as graphene oxide films to create graphene-based magnetic polymer foams to carry out oil/water separation. Synthesized magnetic polymerbased graphene foams (MPG) exhibit superhydrophobicity and super-oil philia with a water and oil contact angle of 158 and a 0 • ± 1 • , respectively. Haitao Wang et al. [48] synthesized carbon nanotubes coated with superparamagnetic iron oxide nanoparticles to separate oil from a mixture of water and oil. The authors managed to eliminate almost 100% of the free oil present in the mixture. These methods report excellent adsorption capacity for both oils and organic solvents, maintaining their performance after several adsorption/desorption cycles, which makes them recyclable and stable materials under cyclical operations and, therefore, an easy alternative for cleaning contamination by crude oils, petroleum derivatives and toxic organic solvents [27,48].
This work focused on developing activated carbon from coffee residues-specifically, spent coffee grounds-considering the importance of reusing these resources, and their surface modification with magnetite nanoparticles, to improve their adsorptive and catalytic properties. This is the first time a nano-intermediate with these characteristics has been designed to remove crude oil from O/W emulsions. Besides, the application of thermal treatment is proposed as a final stage, given useful by-products in energy production. This work is envisioned to open a new landscape for the fabrication of materials from agro-industrial waste, with more significant oil adsorptive capacity, and that require a lower temperature in the decomposition process by thermal cracking (pyrolysis) reactions, which implies a recovery of total activated carbon and possible use of gases (CO, H 2 , CH 4 ) derived from crude oil.

Preparation of Oil-in-Water Emulsions
An emulsion with a fixed concentration of crude oil was prepared. For this, a brine was prepared with freshwater and 2.0 wt.% KCl. The brine was vigorously stirred and filtered. Subsequently, 500 mg L −1 of crude oil and 0.2 wt.% of Tween 80 surfactant were added, maintaining stirring at 16,000 rpm for 45 min. For the adsorption tests, solutions of 50, 100, 200, and 300 mg L −1 were prepared. The emulsions' stability was determined through the oil drop size, measured through an optical microscope at 40X for seven (7) days [19,20,49], as shown in Figure 1.
It was concluded that O/W emulsions have high stability and an average size between 0.47 and 0.75 µm. During the days of analysis, the emulsions presented a standard deviation of <0.044 µm in hydrodynamic size.

Synthesis and Characterization of Magnetite Nanoparticles
The co-precipitation method was used to synthesize magnetite nanoparticles [50]. The FeCl3•6H2O was dissolved in deionized water and mixed with a solution of FeCl2•4H2O in 0.2wt.% HCl. The molar ratio employed was 4:1 Fe +3 :Fe +2 . Then, NH4OH was added in excess, and the systems were vigorously stirred for 10 min. Subsequently, the mixture was filtered and washed with deionized water and ethanol to remove excess ferric ions and ammonia. Finally, the filtrate was dried for 24 h at a temperature of 75 °C [50].
The morphology and size of the synthesized magnetite nanoparticles were analyzed by scanning electron microscopy (SEM) and the dynamic light scattering technique using an FEI microscope (Quanta 400 model) (SEM) (Eindhoven, The Netherlands) and a Nanoplus-3 (Micromeritics, Norcross, GA, USA), respectively. The size data were obtained through statistical analysis. The population of particles was fixed for each sample, the confidence level was established at 95%, the confidence interval was calculated, and finally, the size of the population was calculated using the MiniTab17 statistical software (Minitab Inc., State College, PA, USA). Each point was analyzed using the morphometric software tpsDig 2.1 7 (SUNY, Stony Brook, NY, USA) [39,51]. Fourier transform infrared spectroscopy was performed to corroborate the presence of iron and oxygen as central components of magnetite nanoparticles.

Synthesis of Activated Carbon
The first step to prepare activated carbon was to remove impurities and contaminants from the coffee residue. The material was dried for 24 h at a temperature of approximately 100 °C. The dry residue was divided into two parts. The first one was mixed with ZnCl2 in powder form and sufficient deionized water maintaining a ratio of 1:2 coffee residue/ZnCl2. Then, the material was dried for 24 h at a temperature of 100 °C. The second part was left intact. Then, a pyrolysis process was carried out in a stainless-steel tube (Thermo Scientific Lindberg/Blue M Waltham, MA, USA) under an inert atmosphere of nitrogen and constant flow of 80 mL min −1 to the two parts obtained. The pyrolysis heating rate was 10 °C min −1 , and the activation temperature was kept constant at 600 °C for 2 h.

Synthesis and Characterization of Magnetite Nanoparticles
The co-precipitation method was used to synthesize magnetite nanoparticles [50]. The FeCl 3 ·6H 2 O was dissolved in deionized water and mixed with a solution of FeCl 2 ·4H 2 O in 0.2wt.% HCl. The molar ratio employed was 4:1 Fe +3 :Fe +2 . Then, NH 4 OH was added in excess, and the systems were vigorously stirred for 10 min. Subsequently, the mixture was filtered and washed with deionized water and ethanol to remove excess ferric ions and ammonia. Finally, the filtrate was dried for 24 h at a temperature of 75 • C [50].
The morphology and size of the synthesized magnetite nanoparticles were analyzed by scanning electron microscopy (SEM) and the dynamic light scattering technique using an FEI microscope (Quanta 400 model) (SEM) (Eindhoven, The Netherlands) and a Nanoplus-3 (Micromeritics, Norcross, GA, USA), respectively. The size data were obtained through statistical analysis. The population of particles was fixed for each sample, the confidence level was established at 95%, the confidence interval was calculated, and finally, the size of the population was calculated using the MiniTab17 statistical software (Minitab Inc., State College, PA, USA). Each point was analyzed using the morphometric software tpsDig 2.1 7 (SUNY, Stony Brook, NY, USA) [39,51]. Fourier transform infrared spectroscopy was performed to corroborate the presence of iron and oxygen as central components of magnetite nanoparticles.

Synthesis of Activated Carbon
The first step to prepare activated carbon was to remove impurities and contaminants from the coffee residue. The material was dried for 24 h at a temperature of approximately 100 • C. The dry residue was divided into two parts. The first one was mixed with ZnCl 2 in powder form and sufficient deionized water maintaining a ratio of 1:2 coffee residue/ZnCl 2 . Then, the material was dried for 24 h at a temperature of 100 • C. The second part was left intact. Then, a pyrolysis process was carried out in a stainless-steel tube (Thermo Scientific Lindberg/Blue M, Waltham, MA, USA) under an inert atmosphere of nitrogen and constant flow of 80 mL min −1 to the two parts obtained. The pyrolysis heating rate was 10 • C min −1 , and the activation temperature was kept constant at 600 • C for 2 h. Then, the activated coffee carbon was cooled at a temperature of 25 • C. The activated carbons impregnated with ZnCl 2 were washed sequentially with ethanol, hydrochloric acid (0.1 M), and deionized water to remove the Zn +2 and Cl − ion residues. Finally, AC materials were dried for 12 h by a stream of air at 100 • C [52,53]. The samples thus obtained were labeled as PCR (pyrolyzed coffee residue) and AC (activated carbon).

Functionalization of Activated Carbon with Magnetite Nanoparticles
The activated carbon was dried at 120 • C for 2 h to remove the remaining water content. For the impregnation process with the synthesized magnetite nanoparticles, the AC Processes 2021, 9, 63 5 of 21 has pretreated in a 45.75%v v −1 deionized water solution, with 8.50%v v −1 ammonium hydroxide and 45.75%v v −1 ethanol, using 4 mL of solution per gram of AC. The system was magnetically stirred at 1500 RPM for 1 h. Then, 5.0 wt% of magnetite nanoparticles were added and left stirring for 4 h at 1500 RPM. Finally, the mixture was heated to 150 • C to evaporate the NH 4 OH and ethanol. Finally, the functionalized material was dried to remove the remaining liquid from the process [54]. The nano-intermediate was named ACM (activated carbon modified with 5.0 wt.% of magnetite nanoparticles).

Textural and Chemical Characterization
The iodine number was calculated following the ASTM D4607 standard to obtain the relative activation level by adsorption of iodine from an aqueous solution. This parameter is strongly related to the surface area and porosity structure of AC. The porous texture was assessed by nitrogen physisorption at −196 • C and CO 2 adsorption at 0 • C using a Micromeritic ASAP2020 instrument (Micromeritics Instruments Corporation, Norcross, GA). The Brunauer-Emmett-Teller method with N 2 adsorption data was used to quantify the synthesized samples' surface area [55]. The final content of magnetite nanoparticles after the impregnation process was obtained by thermogravimetric analysis in a thermogravimetric analyzer Q50 (TA Instruments, New Castle, DE, USA) by flowing air at 100 mL min −1 and heating the sample from 30 to 700 • C.
The samples' size and morphology were determined by dynamic light scattering technique and scanning electron microscopy (SEM) in an FEI microscope (Quanta 400 model) (Eindhoven, The Netherlands). Besides, Energy-dispersive X-ray spectroscopy was executed to establish the Fe dispersion in the sample.
To specify the surface composition of synthesized nano-intermediates, Fourier transform infrared spectroscopy was done in an IRAffinity-1 spectrophotometer by mixing potassium chloride (KCl) and sample in a 3:7 ratio [56].

Adsorption Isotherms
Batch adsorption experiments were carried out to evaluate the crude oil adsorption over magnetite nanoparticles, coffee residue (CR), pyrolyzed coffee residue (PCR), activated carbon (AC), and activated carbon modified with magnetite nanoparticles (ACM).
Initially, oil-in-water emulsions with oil concentrations between 50 and 300 mg L −1 were prepared. Then, adsorbents were added into the O/W emulsions at a fixed solution volume adsorbent mass ratio of 1 g L −1 . The mixtures were stirred for 12 h at room temperature to ensure adsorption equilibrium. Next, the solutions were centrifuged at 4500 rpm for 1 h. The amount of crude oil adsorbed was determined by colorimetry analysis. A UV-Visible spectrophotometer (Thermo Fisher Scientific MA, USA) was used, using a wavelength of 300 nm. The amount of crude oil adsorbed (Q) (mg g −1 ) was calculated using Equation (1).
where C o (mg L −1 ) is the initial concentration of crude oil in the solution, C e (mg L −1 ) is the equilibrium concentration of crude oil, V (L) is the volume of solution in, and W (mg) is the weight of the adsorbent. The solid-liquid equilibrium model (SLE) was used to determine the adsorption mechanism in terms of selectivity and adsorptive capacity and to obtain thermodynamic insights about the adsorption phenomenon. Equations (2)-(7) show the models used for this purpose.
where H (mg g −1 ) is the inverse of adsorption affinity, K (mg g −1 ) the crude oil selfassociation over the material surface, Q m (mg g −1 ) is the maximum amount adsorbed, C E is the crude oil concentration at the equilibrium from the SLE fitting, Ψ and ξ are constants, R (J mol −1 K −1 ) is the universal gas constant, and K 1 −K 0 are related to the values of enthalpy and entropy, respectively; Further, ∆H 0 ads is the enthalpy, ∆S 0 ads is the entropy, ∆G 0 ads is the change of the Gibbs free energy of the adsorption process. The error definition used is the root mean square error RSME%.
where, X exp,i and X mod,i are the values of Q for experimental and modeled data, respectively, and p is the number of data used in the model.

Dynamic Tests
Dynamic adsorption tests were performed on a fixed-bed column, as shown in Figure 2. The experimental setup consists of a positive displacement pump, an emulsion containing cylinder, regulating valves, and an open packed-bed system. The oil concentration in the O/W emulsion was fixed at 100 mg L −1 and was injected under a flow rate of 10 mL min −1 at room conditions of pressure and temperature. The established flow was kept uniform with flow throttle valves, guaranteeing a uniform and complete saturation of the bed and avoiding the formation of preferential channels. The diameter and height of the packed bed were 6.5 cm and 19.5 cm, respectively. The adsorption process was done by mass transfer mechanisms between a mobile phase (emulsion) and a fixed phase (adsorbent). The effluents produced by the upper part of the bed were collected and characterized by UV-vis to determine the quantity of crude oil removed. The test provides information about the adsorption capacity and speed of saturation of the packed bed.

Thermogravimetric Analysis (TGA)
Catalytic thermal cracking of adsorbed crude oil over ACM nano-intermediate was assessed in a Q50 thermogravimetric analyzer coupled to an IR-Affinity-1 FTIR device. The system had a gas cell, which allowed the analysis of the gases produced. The tests were executed under a nitrogen flow of 100 cm 3 min −1 , using a heating ramp of 20 °C min −1 from 30 to 600 °C. The mass sample was maintained ~5 mg to avert diffusional mass and heat effects [57,58]. In addition, the loading of crude oil per unit of the adsorbent surface  The system had a gas cell, which allowed the analysis of the gases produced. The tests were executed under a nitrogen flow of 100 cm 3 min −1 , using a heating ramp of 20 • C min −1 from 30 to 600 • C. The mass sample was maintained~5 mg to avert diffusional mass and heat effects [57,58]. In addition, the loading of crude oil per unit of the adsorbent surface area was 0.2 mg m −2 . FTIR operates in transmission mode with ten scans per minute at a resolution of 2 cm −1 in the range between 400 and 100 cm −1 . The characteristic intensities of each of the gas absorption bands were used, considering the data reported in previous works [38].

Results
This section compiles the results obtained for the characterization of magnetite nanoparticles, the pyrolyzed coffee residue (PCR), the synthesized activated carbon (AC), and the nano-intermediate activated carbon modified with 5.0 wt.% of magnetite nanoparticles (ACM). In these tests, the size of the nano-intermediates, composition, morphology, and surface area were determined. Subsequently, adsorption tests were carried out through batch and dynamic experiments to determine the absorptive capacity of the synthesized nano-intermediates. For the static tests, the adsorption of crude oil was carried out at temperatures of 25, 40, and 50 • C. The experiment was carried out for the materials walnut shell (WH), coffee residue (CR), pyrolyzed coffee residue (PCR), the synthesized activated carbon (AC), and activated carbon modified with 5.0 wt.% of magnetite nanoparticles (ACM). The dynamic packed bed test was carried out for the WH material and the newly synthesized ACM nano-intermediate. WH is usually used in the oil industry to remove crude from production waters. Then, the best material was selected to evaluate crude oil decomposition through thermal cracking reactions.

Characterization of Magnetite Nanoparticles
It is worth mentioning that the magnetic nanoparticles were synthesized by the coprecipitation method and were used to modify the surface of the activated carbon obtained from the coffee residues. This functionalization aims to obtain a greater adsorptive and regenerative capacity of the material. Characterization of magnetite nanoparticles was carried out by Fourier transform infrared spectroscopy (FTIR), dynamic light scattering (DLS), and scanning electron microscopy (SEM). Figure 3 shows a representative image from the SEM analysis and the particle size distribution for the synthesized nanoparticles. The particles exhibited an irregular and agglomerated structure and a nanometric particle size of about 28 nm, following the same results reported in the literature [59]. The size distribution obtained from the SEM images agrees with the size obtained using the dynamic light scattering technique, where an average hydrodynamic size of about 30 nm was obtained. Figure 4 shows the FTIR spectrum for magnetite nanoparticles. A band intensity was observed between 3500 and 3000 cm −1 , which corresponds to the hydroxyl groups bound to the surface of the iron oxide by hydrogen bonds and water molecules adsorbed chemically in the nanoparticles' surface. The bands at 1757 and 1678 cm −1 show low intensities attributed to H-O-H groups' stretching. Finally, the predominant band between 640 and 580 cm −1 confirms Fe-O vibration [60].

Activated Carbon Characterization
The pyrolyzed coffee residue (PCR) and the synthesized activated carbon (AC) were analyzed to determine the iodine value. The highest iodine value corresponds to AC (821 mg g −1 ), which agrees with the reported values for activated carbons (500-1200 mg g −1 ) [61]. By contrast, PCR shows a low iodine number of 6 mg g −1 . The considerable difference in both results is because of the ZnCl 2 action in the activation process. Zinc chloride is an agent that can modify the pyrolysis mechanism of carbon-based materials because it is a dehydrating compound. Once the coffee residue has been mixed with ZnCl 2 , the latter can intermingle into the carbon matrix and remove hydrogen and oxygen atoms during pyrolysis. After carbonization, Processes 2021, 9, 63 8 of 21 an interaction between the Zn compounds and the C atoms begins. Thus, the atomic layers of carbon can widen, and pores can form in the carbon matrix [52,53]. The final content of magnetite nanoparticles over AC was verified by TGA, obtaining a content of 5.0%, which indicates the high efficiency of the synthesis process. distribution for the synthesized nanoparticles. The particles exhibited an irregular and agglomerated structure and a nanometric particle size of about 28 nm, following the same results reported in the literature [59]. The size distribution obtained from the SEM images agrees with the size obtained using the dynamic light scattering technique, where an average hydrodynamic size of about 30 nm was obtained.

Activated Carbon Characterization
The pyrolyzed coffee residue (PCR) and the synthesized activated carbon (AC) were analyzed to determine the iodine value. The highest iodine value corresponds to AC (821 mg g −1 ), which agrees with the reported values for activated carbons (500-1200 mg g −1 )  Table 1 shows the textural parameters for PCR and AC. As observed, the iodine number is congruent with the materials' surface area, which was higher for AC than PCR. The area is increased excessively by the activation process with ZnCl 2 , promoting a well-developed porous structure, thus increasing the surface area estimated by the BET equation (S BET ). In this order, the porous texture was studied by nitrogen adsorption. Figure 5 shows the nitrogen adsorption/desorption isotherms for PCR and AC, and their porous characteristics were summarized in Table 1. Micropore volume, W 0 (N 2 ), and the mean micropore width, L 0 (N 2 ), were obtained using Dubinin-Radushkevich equations, as well as mesoporous volume, V meso(BJH) , which was calculated with the Barrette-Joynere-Halenda (BJH) method.  Following the International Union of Pure and Applied Chemistry (IUPAC) classification, the PCR sample exhibits a type II isotherm, typical for macroporous materials. The adsorbed amount is relatively low, which can be due to the small surface area and the material's adsorptive capacity. The volumes of micropore and mesopore for PCR were 0.0036 and 0.002 cm 3 g −1 , respectively. The activation of PCR leads to a change in the isotherm shape, obtaining a type I behavior. These isotherms are characteristic of microporous materials with a predominant micropore structure, responsible for the high surface area due to their high porosity. In addition, in Figure 5c, the nitrogen adsorption curve for the ACM material is observed. After AC impregnation, the nanointermediate retains the type I isotherm of nitrogen adsorption, which suggests that it still retains its micro and macroporous properties. The surface area (S BET ) obtained was 862 m 2 g −1 . This result suggests a slight reduction in the surface area due to its functionalization with the magnetite nanoparticles due to the AC material's porosity.
The morphology and particle size of AC material and ACM nano intermediate were analyzed through SEM images. Figure 6 shows the results obtained. First, it was appreciated that the synthesized materials have an amorphous structure with a presence of blows and pores inherent in the synthesis process used [61]. According to Figure 6b-d, AC has a particle size of about 40 µm and ACM of about 50 µm. This means that the materials comply with the ASTM D5158 standard, stating that synthesized activated carbons must be smaller than 180 µm. The error associated with the measurement was calculated and was equal to 2.32% for the synthesized magnetite nanoparticles, 4.11% for the AC material and 6.81% for the ACM material. The elemental composition of the AC and ACM samples was determined by EDX analysis. Figure 8 shows EDX results for the ACM sample, and Table 2 depicts the atomic content for both systems. As a first instance, it was obtained that ACM has an iron content of 5.42%, while AC has no iron in its matrix. For the two samples, a significant chlorine content was evidenced due to the activation process. These results agree with the FTIR analysis.
The band at 2312 cm −1 is an indication of the presence of alkyne C≡C groups. The 1560-1530 cm −1 band indicates the presence of an aromatic C=C ring stretching. At 1153 cm −1 , the band shows the C-O stretching vibrations in ether, alcohols, ester, or phenols groups [52,53,61]. Likewise, the chemical composition of the activated carbon modified with magnetite nanoparticles (ACM) nano-intermediate was analyzed, in which bands similar to those obtained by the individual systems (activated carbon and magnetite nanoparticles) were obtained. The elemental composition of the AC and ACM samples was determined by EDX analysis. Figure 8 shows EDX results for the ACM sample, and Table 2 depicts the atomic content for both systems. As a first instance, it was obtained that ACM has an iron content of 5.42%, while AC has no iron in its matrix. For the two samples, a significant chlorine content was evidenced due to the activation process. These results agree with the FTIR analysis.   Figure 9 shows the crude oil adsorption isotherms at 25 °C over WH, CR, PCR, AC, and ACM, as well as SLE fitting. Considering the IUPAC classification, it was concluded that crude oil adsorption over AC and ACM behaves like Type Ib isotherm, corresponding to high affinity adsorption systems (liquid-solid), whereas on WH, CR, and PCR it has a type III behavior, typical in solid-liquid systems with relatively weak adsorbent-adsorbate interactions [62]. In AC and ACM, adsorption affinity is higher than WH, CR, and PCR. This suggestion was corroborated by the estimated solid-liquid equilibrium (SLE) parameters, where H decreases in the order WH < CR < PCR < AC < ACM (Table 3). Besides, for a fixed initial crude oil concentration, the adsorbed amount increases as follows: WH < CR < PCR < AC < ACM, showing a higher adsorptive capacity when the samples were activated and modified with the magnetic particles due to the functional groups in the samples (see Figure 7). This result is in agreement with the research of Xiaobing et al. [63], which focused on exploring the potential application of coal to purification of oily waste water. The authors concluded that the absorption mechanism consists of two kinds of absorption, a physical process assisted by a chemical one. In addition, the results follow a similar behavior that surface area. The higher the surface area, the higher the amount adsorbed. In addition, the great capacity of AC and ACM materials to adsorb non-polar   Figure 9 shows the crude oil adsorption isotherms at 25 • C over WH, CR, PCR, AC, and ACM, as well as SLE fitting. Considering the IUPAC classification, it was concluded that crude oil adsorption over AC and ACM behaves like Type Ib isotherm, corresponding to high affinity adsorption systems (liquid-solid), whereas on WH, CR, and PCR it has a type III behavior, typical in solid-liquid systems with relatively weak adsorbent-adsorbate interactions [62]. In AC and ACM, adsorption affinity is higher than WH, CR, and PCR. This suggestion was corroborated by the estimated solid-liquid equilibrium (SLE) parameters, where H decreases in the order WH < CR < PCR < AC < ACM (Table 3). Besides, for a fixed initial crude oil concentration, the adsorbed amount increases as follows: WH < CR < PCR < AC < ACM, showing a higher adsorptive capacity when the samples were activated and modified with the magnetic particles due to the functional groups in the samples (see Figure 7). This result is in agreement with the research of Xiaobing et al. [63], which focused on exploring the potential application of coal to purification of oily waste water. The authors concluded that the absorption mechanism consists of two kinds of absorption, a physical process assisted by a chemical one. In addition, the results follow a similar behavior that surface area. The higher the surface area, the higher the amount adsorbed. In addition, the great capacity of AC and ACM materials to adsorb non-polar substances such as hydrocarbon chains in petroleum is due to the large number of unpaired electrons that these materials contain [64], which, together with the porous structure generated by the randomly joined basal planes [65], provide AC and ACM materials with a high affinity and adsorptive capacity for crude oil. The excellent result for the ACM sample reflects the beneficial effect of magnetite addition on the AC surface in the current context. It is reported that iron-based nanoparticles present a higher affinity for adsorption of crude oil fractions, based on the selectivity of heteroatoms' like sulfur, nitrogen, and oxygen, resulting from σ and π bonding with the functional groups on nanoparticles [66].

Adsorption Tests: Batch and Dynamic Experiments
In general, the oil adsorption mechanism over AC and ACM was based on different steps, including: (i) crude oil adsorption on the external surface of the material, (ii) intraparticle diffusion through the pores of the adsorbent, and (iii) the final stage of adsorption equilibrium.  The effect of temperature on the crude oil adsorption was evaluated by building adsorption isotherms at 25, 40, and 50 °C. Figure 10 shows the results obtained, and Table 4 summarizes the adjustment parameters of the SLE model. For all the ACM and AC systems, type I isotherms were obtained, typical of microporous materials with a great affinity for the organic molecules of crude oil [19,20,67]. For equilibrium crude oil concentrations, the amount of adsorbed crude oil increases as the temperature decreases. For example, at a fixed concentration of 100 mg L −1 , the amount of adsorption on the ACM material decreases from 90.2 mg g −1 at 25 °C, to 71.4 mg g −1 and 58.3 mg g −1 , at 40 °C and 50 °C, respectively.  The excellent result for the ACM sample reflects the beneficial effect of magnetite addition on the AC surface in the current context. It is reported that iron-based nanoparticles present a higher affinity for adsorption of crude oil fractions, based on the selectivity of heteroatoms' like sulfur, nitrogen, and oxygen, resulting from σ and π bonding with the functional groups on nanoparticles [66].
In general, the oil adsorption mechanism over AC and ACM was based on different steps, including: (i) crude oil adsorption on the external surface of the material, (ii) intraparticle diffusion through the pores of the adsorbent, and (iii) the final stage of adsorption equilibrium.
The effect of temperature on the crude oil adsorption was evaluated by building adsorption isotherms at 25, 40, and 50 • C. Figure 10 shows the results obtained, and Table 4 summarizes the adjustment parameters of the SLE model. For all the ACM and AC systems, type I isotherms were obtained, typical of microporous materials with a great affinity for the organic molecules of crude oil [19,20,67]. For equilibrium crude oil concentrations, the amount of adsorbed crude oil increases as the temperature decreases. For example, at a fixed concentration of 100 mg L −1 , the amount of adsorption on the ACM material decreases from 90.2 mg g −1 at 25 • C, to 71.4 mg g −1 and 58.3 mg g −1 , at 40 • C and 50 • C, respectively.   The results obtained show that temperature influences the adsorbate/adsorbent attraction and/or repulsion forces. Temperature influences the interaction forces between adsorbate and adsorbent, and this agrees with what was reported in the literature [68]. Furthermore, the parameters H K and Qm support these results, showing a lower affinity (higher constant of Henrys's Law H), a higher degree of self-association (higher K), and a lower amount adsorbed (less Qm) as temperature increases. Between the type Ib isotherm systems (ACM and AC), the ACM presents the higher value for H as a response of the high affinity for crude oil compounds, whereas, for the type III systems, the H value increases in the order WH < PCR < CR, indicating that CR has a higher affinity for crude oil compared with the other two systems. The K values follow the same trend regardless of the temperature used, increasing in the following order: WH < PCR < CR < AC < ACM. In other words, the ACM system has a greater capacity to reduce the self-association degree of crude oil molecules on its surface than the rest of the systems.
In addition, the thermodynamic parameters were calculated concerning the adsorption results at different levels. They were shown in Table 5. ∆S • ads > 0 shows a behavior of molecular disorder (randomness) of the crude molecules' adsorption on the ACM nanointermediate's surface. Furthermore, the values of ∆H • ads < 0 and ∆G • ads < 0 show that the adsorption process is exothermic and spontaneous. The behavior was maintained for all three (3) evaluated temperatures.
The oil adsorption mechanism was thermodynamically more favorable in the AC system with the lowest values for −∆H • ads and −∆G • ads of 4.51 kJ mol −1 and 1.27 J (mol K) −1 , respectively. On the other hand, this system's entropy was much lower than the others (0.019 J (mol K) −1 ). The results agree with the SLE fitting parameters. The system with the lowest K value agrees with the one with the lowest ∆S • ads , since by inhibiting the crude oil molecules' self-association, the molecular disorder in the interface is reduced.

Dynamic Packed Bed Adsorption Tests
Dynamic tests were done to evaluate the selected material's (ACM) adsorption capacity under a continuous flow of emulsified crude oil at 100 mg L −1 . For comparative purposes, this experiment was also carried out on the walnut shell [5], considered one of the most used agro-industrial products in the oil and gas industry for water treatment. Figure 11 exposes the breakthrough curves. These curves allow visualization through the flow of crude oil through packed beds of ACM and walnut shell, which affects the trapping of hydrocarbon particles. The walnut shell observed that the bed is almost 100% saturated from the first 30 min. Furthermore, from the first recovered effluent, a crude oil concentration of  Table 5. Thermodynamic parameters for the adsorption of crude oil in oil-in-water emulsions, for activated carbon modified with 5.0 wt.% of magnetite nanoparticles (ACM), the synthesized activated carbon (AC), The pyrolyzed coffee residue (PCR), coffee residue (CR), and Walnut shell (WH), for temperatures of 25 • C, 40 • C and 50 • C.

Material
Temperature

Crude Oil Decomposition Pyrolysis Process
The final removal of the adsorbed crude oil is a crucial stage in water treatment, as the regeneration of the adsorbent material depends on how efficient the system is to remove the adsorbed crude oil. In this sense, this work proposes heating in an inert atmosphere, simulated with nitrogen injection, to promote thermal and thermocatalytic cracking of hydrocarbons. According to the adsorption results, the ACM sample was selected to evaluate crude oil's decomposition through pyrolysis processes. To fulfill this purpose, the ACM sample with an adsorbed crude oil load of 0.2 mg m −2 was subjected to heating through nitrogen injection in a wide temperature range (30-600 °C). Figure 12 shows the rate for mass change profiles for virgin crude oil and ACM containing crude oil. The results show that crude oil mass loss began at low temperatures (<200 °C).
Nevertheless, the maximum mass loss peak occurs at approximately 500 °C. In this order, two distinct regions related to distillation and cracking reactions were noted. Distillation is associated with the first mass loss observed at low temperatures. The second and narrower reaction region was extended up to 600 °C. Several authors have reported that distillation of low molecular weight compounds in the initial stages of pyrolysis oc- On the other hand, the ACM packed bed shows completely different results. The effluents recovered until 170 min present concentrations lower than 10 mg L −1 , and the system reached a maximum saturation percentage of 12% when the test was completed. These results show that the removal percentage for the ACM material is 68% more effective than a walnut shell for removing crude oil from O/W emulsions. It reaches almost 100% removal up to more than 1 L of injected emulsion.

Crude Oil Decomposition Pyrolysis Process
The final removal of the adsorbed crude oil is a crucial stage in water treatment, as the regeneration of the adsorbent material depends on how efficient the system is to remove the adsorbed crude oil. In this sense, this work proposes heating in an inert atmosphere, simulated with nitrogen injection, to promote thermal and thermocatalytic cracking of hydrocarbons. According to the adsorption results, the ACM sample was selected to evaluate crude oil's decomposition through pyrolysis processes. To fulfill this purpose, the ACM sample with an adsorbed crude oil load of 0.2 mg m −2 was subjected to heating through nitrogen injection in a wide temperature range (30-600 • C). Figure 12 shows the rate for mass change profiles for virgin crude oil and ACM containing crude oil. The results show that crude oil mass loss began at low temperatures (<200 • C). The amount of gaseous products evolved during the pyrolysis of virgin and adsorbed crude oil on ACM was obtained and showed in Figure 13. The results show significant differences between the selectivity distribution of the light gases in both scenarios. According to the literature, pyrolysis is dominated by the evaporation of hydrocarbons with a low boiling point, and weak chemical bonds rupture at low temperatures [69,72,75]. This leads to a higher production of LHC, as shown in Figure 13 for both systems. Simultaneously, the mass loss at higher temperatures produces the rupture of chemical bonds between carbon and heteroatoms (N, S, and O), reflected in the releasing of oxygen-, nitrogen-, and sulfur-based species. Contrasting both scenarios, ethylene (C2H4) and CH4 were the main LHC produced during thermal and catalytic thermal cracking of crude oil, and they have been increased by 25% and 8%, respectively, for virgin crude oil to the adsorbed-on ACM. Ethylene can be produced by the rupture of the penultimate β C-C bond in alkyl free radicals containing an unpaired electron, located at the end of the alkyl free radical. C-C bonds' cleavage in macromolecular olefins generated from the ring-opening of naphthenic hydrocarbons and the dealkylation of the aromatic and naphthenic rings (Caromatic−Cα or Cnaphthenic−Cα) contributes to its emission. As for methane, it can be released at low and high temperatures. First, the cracking of methyl and methylene groups in aliphatic hydrocarbons and alkyl side chines attached to aromatic and naphthenic rings occurs at low temperatures. Then, when the temperature is high, enough reactions of demethylation of the methoxyl groups occur.
On the other hand, gases like CO and CO2 decreased in the catalytic scenario. The formation of CO2 could be attributed first to the decomposition of weak thermal groups like carboxyl and ester groups and second to the craking of ethers, ketones, and oxygencontaining heterocycles. Meanwhile, CO production can be ascribed to the reforming of oxygen-containing groups (carbonyl and ethers), especially those which are liked to aromatic rings. In addition, SOx and NOx gas emissions are reduced when crude oil is adsorbed on the ACM system. These results suggest a direct influence of the ACM material on the thermal cracking of crude oil by increasing the production of gases with added value and reducing polluting gas emissions. Considering the production of the different gases produced, the mixture's calorific value resulting from the thermal cracking of the crude oil was estimated, obtaining that the virgin crude oil produces a mixture of around 8.59 kcal kg −1 , while in the presence of ACM, it increases to 11.33 kcal kg −1 . This suggests Nevertheless, the maximum mass loss peak occurs at approximately 500 • C. In this order, two distinct regions related to distillation and cracking reactions were noted. Distillation is associated with the first mass loss observed at low temperatures. The second and narrower reaction region was extended up to 600 • C. Several authors have reported that distillation of low molecular weight compounds in the initial stages of pyrolysis occurs. However, as the temperature rises, some chemical reactions such as visbreaking and cracking of higher molecular weight species produce volatile compounds [69][70][71]. In addition, the volatilization rate due to progressive evaporation of larger molecules is associated with the transition between both regions. These results indicate the difficulties of removing crude oil at the surface level, generating coke deposition and adsorbents/catalysts poisoning.
When crude oil is adsorbed over on ACM, the onset temperature for pyrolysis reactions appeared to occur at lower temperatures, near 400 • C, which is 100 • C less than virgin crude oil. The deconvolution of this curve leads to crude oil decomposition in two main regions, like the system in the absence of ACM. The first one occurs below 350 • C, associated with alkyl side chains rupture and opening of polycyclic aromatic hydrocarbons (PAH) [72]. Then, at higher temperatures, the catalytic rupture of remaining heavy oil fractions occurs. The material's catalytic power is noticeable when comparing both curves and was attributed to the presence of hexagonal graphite crystallites on the carbon matrix that acts as critical active sites for possible cracking of lower crude oil compounds [73]. In contrast, iron-sites could produce the breaking of stronger chemical bonds, mainly C-C and C-H. Thereby, magnetite nanoparticles supported on activated carbons present a synergistic effect in crude oil decomposition [74].
The amount of gaseous products evolved during the pyrolysis of virgin and adsorbed crude oil on ACM was obtained and showed in Figure 13. The results show significant differences between the selectivity distribution of the light gases in both scenarios. According to the literature, pyrolysis is dominated by the evaporation of hydrocarbons with a low boiling point, and weak chemical bonds rupture at low temperatures [69,72,75]. This leads to a higher production of LHC, as shown in Figure 13 for both systems. Simultaneously, the mass loss at higher temperatures produces the rupture of chemical bonds between carbon and heteroatoms (N, S, and O), reflected in the releasing of oxygen-, nitrogen-, and sulfur-based species. Contrasting both scenarios, ethylene (C 2 H 4 ) and CH 4 were the main LHC produced during thermal and catalytic thermal cracking of crude oil, and they have been increased by 25% and 8%, respectively, for virgin crude oil to the adsorbed-on ACM. Ethylene can be produced by the rupture of the penultimate β C-C bond in alkyl free radicals containing an unpaired electron, located at the end of the alkyl free radical. C-C bonds' cleavage in macromolecular olefins generated from the ring-opening of naphthenic hydrocarbons and the dealkylation of the aromatic and naphthenic rings (C aromatic − C α or C naphthenic − C α ) contributes to its emission. As for methane, it can be released at low and high temperatures. First, the cracking of methyl and methylene groups in aliphatic hydrocarbons and alkyl side chines attached to aromatic and naphthenic rings occurs at low temperatures. Then, when the temperature is high, enough reactions of demethylation of the methoxyl groups occur.

Conclusions
During this study's development, activated carbon materials have been successfully synthesized from coffee residues in the presence and absence of magnetite nanoparticles. The characterization shows that the activation and functionalization at 5 wt.% of the magnetic nanoparticles were carried out successfully. Zinc chloride plays a vital role in the activation process since it has been shown that its function as a dehydrating agent is to expand the micro and mesopores. The synthesized AC material has better characteristics in terms of iodine number, surface area, and nitrogen adsorption and desorption than the other materials tested. The use of coffee residues to produce coal made it possible to obtain adsorption capacities of up to 38 mg g −1 in the absence of nanoparticles and up to 120 mg g −1 in the presence of magnetite nanoparticles. This is due to exposed functional groups (ferric chloride and iron chloride) that increase the affinity for specific substances in production waters, such as emulsified crude oil and phenols. Thus, this study provides a significant contribution to industrial efforts to carry out oil removal processes. The material has a great adsorptive capacity and affinity for crude oil and has a remarkable capacity for decomposing the adsorbed hydrocarbons at low temperatures. The latter shows the potential of the material for its reuse in several crude adsorption/desorption cycles. The gases produced during the pyrolysis stage can be recovered and used for energy production.  On the other hand, gases like CO and CO 2 decreased in the catalytic scenario. The formation of CO 2 could be attributed first to the decomposition of weak thermal groups like carboxyl and ester groups and second to the craking of ethers, ketones, and oxygencontaining heterocycles. Meanwhile, CO production can be ascribed to the reforming of oxygen-containing groups (carbonyl and ethers), especially those which are liked to aromatic rings. In addition, SOx and NOx gas emissions are reduced when crude oil is adsorbed on the ACM system. These results suggest a direct influence of the ACM material on the thermal cracking of crude oil by increasing the production of gases with added value and reducing polluting gas emissions. Considering the production of the different gases produced, the mixture's calorific value resulting from the thermal cracking of the crude oil was estimated, obtaining that the virgin crude oil produces a mixture of around 8.59 kcal kg −1 , while in the presence of ACM, it increases to 11.33 kcal kg −1 . This suggests that the material is promising to generate added value to water treatment.

Conclusions
During this study's development, activated carbon materials have been successfully synthesized from coffee residues in the presence and absence of magnetite nanoparticles. The characterization shows that the activation and functionalization at 5 wt.% of the magnetic nanoparticles were carried out successfully. Zinc chloride plays a vital role in the activation process since it has been shown that its function as a dehydrating agent is to expand the micro and mesopores. The synthesized AC material has better characteristics in terms of iodine number, surface area, and nitrogen adsorption and desorption than the other materials tested. The use of coffee residues to produce coal made it possible to obtain adsorption capacities of up to 38 mg g −1 in the absence of nanoparticles and up to 120 mg g −1 in the presence of magnetite nanoparticles. This is due to exposed functional groups (ferric chloride and iron chloride) that increase the affinity for specific substances in production waters, such as emulsified crude oil and phenols. Thus, this study provides a significant contribution to industrial efforts to carry out oil removal processes. The material has a great adsorptive capacity and affinity for crude oil and has a remarkable capacity for decomposing the adsorbed hydrocarbons at low temperatures. The latter shows the potential of the material for its reuse in several crude adsorption/desorption cycles. The gases produced during the pyrolysis stage can be recovered and used for energy production.