#! /usr/bin/gawk -f # Last edited on 2016-08-18 01:29:37 by stolfilocal BEGIN \ { # Computations for the separtion of sodium chloride # and potassium chloride from "light table salt". # ---------------------------------------------------------------- # Table salt is sodium chloride (NaCl). A "light" version of table salt # is available in Brazilian supermarkets under the "Lebre" brand, # intended for people who must reduce their intake of sodium. # According to the label, it consists of a mixture of NaCl # and potassium chloride KCl (with a very small amount of sodium # or potassium iodide, as a preventive for iodide deficiency). # In this experiment we plan to extract the potassium chloride # from that "light salt". # Potassium chloride is very similar to sodium chloride in many # respects. It fairly safe to handle (only a little more toxic # than table salt). Its taste is said to be more bitter than # salty, however. # The plan exploits the fact that the solubility of sodium chloride # in water is nearly independent of temperature, whereas that of # potassium chloride varies considerably. Thus, by preparing # a hot concentrated solution of the "light table salt" and # letting it cool, the KCl should crystallize out first. # Both NaCl and KCl are relatively uncomplicated compounds. # They dissolve in water decomposing into Cl- and K+ or Na+ ions. # When crystallized from water solution, they are anhydrous # solids. # Water amount # The solubility of a substance is usually expressed as the # maximum mass of it that will dissolve in 100 ml of water, # at a given temperature. The graphs below show the # solubilities of KCl and NaCl, separately. # The horizontal axis is temperature, and the vertical # axis is solubility. # However, when both NaCl and KCl are dissolved together, they # interfere and their solubilities change. To describe # the solubility of a mixture, at any given temperature, say # 100 C, we need the following phase diagram # Each point in this triangle represents a given # mix of water, NaCl, and KCl. In particular, each corner represents # a trivial mixture that is 100% one of the substances. # Points along a side represents mixtures of only two substances. # For example, a point that is 1/4 of the way from H2O to NaCl # represents a mixture of 25% water and 75% NaCl by weight. # Points inside the triangle represent mixtures with some amounts # of all three substances. For example, the dot labeled A represents # a mixture of 20% NaCl, 30% KCl, and 50% H2O. # The regions in the diagram tell what each mixture looks # like, after being stirred enough. There are four possibilities. # (1) a clear liquid (both salts completely dissolved). # (2) a clear liquid, with some solid NaCl at the bottom. # (3) a clear liquid, with some solid KCl at the bottom. # (4) a clear liquid, with some solid KCl and NaCl at the bottom. # For example, since the point A is in region # represent mixtures # phase diagram # for the like # Let' s focus # on a fixed temperature (say, 90 C). Ssuppose that we # dissove some amount X of NaCl in 100 ml of water, and # then keep adding KCl until no more will dissolve # (or until adding more KCl will cause some NaCl to # drop out of solution. # When we have two substab # A little bit of the calcium sulfate formed will remain in # solution. To minimize this impurity, we will use the minimum # amount of water needed to dissolve both the reagents and all the # copper chloride produced. # # To reduce the amount of water used, we will prepare the reagent # solutions near the boiling point, and mix them at that # temperature. For equipment limitations, we must allow the mixed # solutions to cool to room temperature before filtering it. # Therefore, we must make sure that the water that remains in # liquid form (not bound to the CaSO4) will be sufficient to # dissolve all the CuCl2 formed. # Purification # We will also use a small excess of copper sulfate. One advantage # of doing so is that the extra SO4-- ions will drive a little # more of the CaSO4 out of solution. # # Another advantage of using some excess of CuSO4 is that # CuSO4 or CaSO4 are quite insoluble in ethanol, whereas CaCl2 is # very soluble. Therefore, for the purification step, it # is useful to ensure tha there is no CaCl2 in the # product that results from evaporation and dehydratin # ---------------------------------------------------------------------- abort = -1; # Molar mass table (grams per mol): split("", gm); # Indexed by chem formula. fill_gm_table(); # Water solubility table (grams that can be dissolved in 100 ml H2O): split("", ws); # Indexed by chem formula and temperature (C). fill_ws_table(); # General parameters: g_CuCl2 = 50; # Grams of anhydrous CuCl2 to make. ts = 80; # Min temperature of reagent solutions. tf = 20; # Min temperature of filtration. ex_CuSO4 = 0.05; # Fractional excess of CuSO4. # Compute the plan steps: m_CuCl2 = g_CuCl2/gm["CuCl2"]; # Moles of CuCl2 to make. m_CuCl2Wt2 = m_CuCl2; # Moles of CuCl2(H2O)2 to make. g_CuCl2Wt2 = m_CuCl2Wt2*gm["CuCl2(H2O)2"]; # Moles of CuCl2(H2O)2 to make. # Use the right amount of anhydrous CaCl2: m_CaCl2 = m_CuCl2; # Moles of anhydrous CaCl2 to use. g_CaCl2 = m_CaCl2*gm["CaCl2"]; # Grams of anhydrous CaCl2 to use. # Use a bit excess CuSO4: m_CuSO4 = (1 + ex_CuSO4)*m_CuCl2; # Moles of anhydrous CuSO4 to use. g_CuSO4 = m_CuSO4*gm["CuSO4"]; # Grams of anhydrous CuSO4 to use. m_CuSO4Wt5 = m_CuSO4; # Moles of CuSO4(H2O)5 to use. g_CuSO4Wt5 = m_CuSO4Wt5*gm["CuSO4(H2O)5"]; # Grams of CuSO4(H2O)5 to use. # Use enough water to dissolve each reagent at temperature {ts}: w_CaCl2 = 100*g_CaCl2/ws["CaCl2",ts]; # Water for CaCl2 soln. w_CuSO4 = 100*g_CuSO4/ws["CuSO4",ts]; # Water for anhydr CuSO4 soln. w_CuSO4Wt5 = 100*g_CuSO4Wt5/ws["CuSO4(H2O)5",ts]; # Water for CuSO4(H2O)5 soln. # Compute how much water is needed to dissolve all CuCl2 at {tf}: w_min_CuCl2 = 100*g_CuCl2/ws["CuCl2",tf]; # Water needed for anhydr CuCl2 soln. # Compute weight of precipitate, assumed to have all the Ca as CaSO4(H2O)2: m_CaSO4Wt2 = m_CaCl2; # Moles of CaSO4(H2O)2 in precp. g_CaSO4Wt2 = m_CaSO4Wt2*gm["CaSO4(H2O)2"]; # Grams of CaSO4(H2O)2 in precp. # Compute how much H2O will be in final solution: # It is the H2O in the two reagent solns minus that locked in precp. w_filtr = w_CaCl2 + w_CuSO4 - 2*m_CaSO4Wt2*gm["H2O"]; # Compute excss of CuSO4 in filtrate: m_ex_CuSO4 = ex_CuSO4*m_CuCl2; # Moles of excess anhydrous CuSO4 g_ex_CuSO4 = m_ex_CuSO4*gm["CuSO4"]; # Grams of excess anhydrous CuSO4. m_ex_CuSO4Wt5 = m_ex_CuSO4; # Moles of excess CuSO4(H2O)5. g_ex_CuSO4Wt5 = m_ex_CuSO4Wt5*gm["CuSO4(H2O)5"]; # Grams of excess CuSO4(H2O)5. # Purificatin with anhydrous ethanol: # Ignore the water of crystallization: # Assume solubility is 50 g/dl at temp {tf}: e_CuCl2 = 100*g_CuCl2/50.0; # Print the recipe: printf "----------------------------------------------------------------------\n"; printf "RECIPE\n"; printf "\n"; printf "Copper sulfate solution:\n"; printf " %5.1f g of CuSO4(H2O)5\n", g_CuSO4Wt5; printf " %5.1f ml of water\n", w_CuSO4Wt5; printf " %5.1f g total weight of solution\n", w_CuSO4Wt5 + g_CuSO4Wt5; printf " min mixing temp = %3.0f C\n", ts; printf "\n"; printf "Calcium chloride solution:\n"; printf " %5.1f g of CaCl2 (anhydrous)\n", g_CaCl2; printf " %5.1f ml of water\n", w_CaCl2; printf " %5.1f g total weight of solution\n", w_CaCl2 + g_CaCl2; printf " min mixing temp = %3.0f C\n", ts; printf "\n"; printf "Reaction result:\n"; printf " %5.1f g precipitate of CaSO4(H2O)2\n", g_CaSO4Wt2; printf " %5.1f g of dissolved CuCl2 (anhydrous)\n", g_CuCl2; printf " %5.1f g of dissolved CuSO4 (anhydrous)\n", g_ex_CuSO4; printf " %5.1f ml of water in filtrate\n", w_filtr; printf " %5.1f g total weight of filtrate\n", w_filtr + g_CuCl2 + g_ex_CuSO4; printf " min filtration temp = %3.0f C\n", tf; printf " %5.1f ml of water needed to dissolve the CuCl2\n", w_min_CuCl2; printf "\n"; printf " %5.1f g of dissolved CuCl2(H2O)2\n", g_CuCl2Wt2; printf " %5.1f g of dissolved CuSO4(H2O)5\n", g_ex_CuSO4Wt5; printf "\n"; printf "Purification:\n"; printf " %5.1f ml of ethanol needed to dissolve the CuCl2\n", e_CuCl2; printf "----------------------------------------------------------------------\n" } function fill_gm_table() \ { # Fills the necessary entries of the {gm} globa table: gm["H"] = 1.008; gm["Cl"] = 35.453; gm["S"] = 32.065; gm["O"] = 15.999; gm["Na"] = 22.990; gm["C"] = 12.011; gm["K"] = 39.098; gm["Ca"] = 40.078; gm["Cu"] = 63.546; gm["H2O"] = 2*gm["H"] + gm["O"]; pmm("H2O"); gm["SO4"] = gm["S"] + 4*gm["O"]; pmm("SO4"); gm["CaCl2"] = gm["Ca"] + 2*gm["Cl"]; pmm("CaCl2"); gm["CaSO4"] = gm["Ca"] + gm["SO4"]; pmm("CaSO4"); gm["CaSO4(H2O)2"] = gm["CaSO4"] + 2*gm["H2O"]; pmm("CaSO4(H2O)2"); gm["CuCl2"] = gm["Cu"] + 2*gm["Cl"]; pmm("CuCl2"); gm["CuCl2(H2O)2"] = gm["CuCl2"] + 2*gm["H2O"]; pmm("CuCl2(H2O)2"); gm["CuSO4"] = gm["Cu"] + gm["SO4"]; pmm("CuSO4"); gm["CuSO4(H2O)5"] = gm["CuSO4"] + 5*gm["H2O"]; pmm("CuSO4(H2O)5"); # gm[""] = ; # gm["CaCl2"] = 110.98; # gm["CaCl2.2H2O"] = 147.0; # gm["CuSO4(H2O)5"] = 249.685; } function fill_ws_table() \ { # Fills the necessary entries of the {ws} global table: ws["CuSO4", 0] = 14.3; ws["CuSO4", 10] = 17.2; ws["CuSO4", 20] = 20.5; ws["CuSO4", 25] = 22.3; ws["CuSO4", 30] = 24.4; ws["CuSO4", 40] = 28.7; ws["CuSO4", 50] = 33.7; ws["CuSO4", 60] = 39.5; ws["CuSO4", 80] = 55.5; ws["CuSO4", 100] = 77.0; ws["CuSO4", 150] = 82.5; compute_ws_hydrated("CuSO4", 5); ws["CaCl2", 0] = 59.5; ws["CaCl2", 10] = 65.0; ws["CaCl2", 20] = 74.5; ws["CaCl2", 30] = 100.0; ws["CaCl2", 40] = 115.5; ws["CaCl2", 60] = 137.0; ws["CaCl2", 80] = 147.0; ws["CaCl2", 100] = 158.0; ws["CaCl2", 150] = 205.0; ws["CuCl2", 0] = 69.2; # [WP] 70.6 ws["CuCl2", 10] = 71.5; ws["CuCl2", 20] = 74.5; ws["CuCl2", 25] = 76.4; # [WP] 75.7 ws["CuCl2", 30] = 78.3; ws["CuCl2", 40] = 81.8; ws["CuCl2", 50] = 85.5; ws["CuCl2", 60] = 89.4; ws["CuCl2", 80] = 98.0; ws["CuCl2", 100] = 110.5; # [WP] 107.9 compute_ws_hydrated("CuCl2", 2); ws["CaSO4", 20] = 0.30; compute_ws_hydrated("CaSO4", 2); # ws["", ] = ; } function pmm(fm) \ { # Prints to {stderr} the molar mass of formula {fm}, # as stored in the global array {gm}. printf "%-20s molar mass = %8.3f\n", fm, gm[fm] > "/dev/stderr"; } function compute_ws_hydrated(fm,nw, t,fh,wsa,msa,mwt,mwh,mwf,msh,wsh) \ { # Computes the solubilities (g/100ml) for # the hydrated version of formula {fm} # with {nw} molecules of water of hydration. if (! (fm in gm)) { prog_error(("missing mol mass for " fm)); } fh = (fm "(H2O)" nw); # Formula of hydrated compound. if (! (fh in gm)) { prog_error(("missing mol mass for " fh)); } for (t = 0; t <= 200; t++) { if ((fm,t) in ws) { # Consider a saturated soln of the anhydr {fm} into 100 ml H2O: wsa = ws[fm,t]; # Grams of anhydr {fm} in that soln. msa = wsa/gm[fm]; # Mols of anhydr {fm} in that soln. mwt = 100.0/gm["H2O"]; # Mols of H2O in that soln. mwh = nw*msa; # Mols of H2O associated to hydrate. mwf = mwt - mwh; # Mols of H2O not in hydrate. # That solution is also a saturated soln of {msa} # moles of hydrate into {mwf} moles of H2O. msh = msa*mwt/mwf; # Moles of hydrate soluble in 100 ml H2O. wsh = msh*gm[fh]; # Grams of hydrate soluble in 100 mt H2O. ws[fh,t] = wsh; pws(fh,t); } } } function pws(fm,t) \ { # Prints to {stderr} the grams of formula {fm} that can be # dissoved in 100 ml of water at temp {t}, # as stored in the global array {ws}. printf "%-20s sol in H2O = %6.1f g/dl at %4.0f C\n", \ fm, ws[fm,t], t > "/dev/stderr"; } function prog_error(msg) \ { printf "** PROG ERROR:%s\n", msg > "/dev/stderr"; abort = 1; exit(abort); }