Skip to content

Instantly share code, notes, and snippets.

@ewancook
Last active March 2, 2017 17:01
Show Gist options
  • Save ewancook/556bba84e619f7d44b39a2b6ec914f28 to your computer and use it in GitHub Desktop.
Save ewancook/556bba84e619f7d44b39a2b6ec914f28 to your computer and use it in GitHub Desktop.
A short program that determines the number of leachers needed for the given variables
package main
import (
"flag"
"fmt"
"math"
)
func main() {
feed := flag.Float64("feed", 1, "the feed flowrate")
solvent := flag.Float64("solvent", 1, "the solvent flowrate")
purity := flag.Float64("purity", 1, "percentage w/w of the feed")
eratio := flag.Float64("entrainment", 0.5, "ratio of entrainment")
out := flag.Float64("out", 1, "purity at endpoint")
flag.Parse()
ore := *purity * *feed
entr := (*feed - ore) * *eratio
R := *solvent / entr
R1 := (*solvent - entr + ore) / entr
n := math.Log(1+((R-1)/R1)*((1/(1-*out))-1)) / math.Log(R)
fmt.Printf("actual number: %f. rounded: %f\n", n, math.Ceil(n))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment