Make a general heat balance solver in python

Playing around with python for a while (mostly icw coolprop) but I'm doing the algebra/calc part by hand (writing the unknowns as explicit functions, integrals etc) and then make use of python to do batch calculation or use coolprop to find properties. But online I saw people using sympy etc which can solve equations but I can't figure out how to use it for balance equations.

I want to make a function hex() who input variables are the variables seen in the picture below, but I want to get a function that fills in some variables and calculate the unknowns.

So when i give it some thing like this:

  • Q1 = -300
  • Cp1 = 3
  • Cp2 = 2
  • m1 = 5
  • m2 = 3
  • T1a = 100
  • T2a = 20

it returns:

  • T1b = 80
  • T2b = 70

Simpgle Q=cpmdT pic with dT = out-in, Q is def to be negative if engerie leaves the system

Read more here:

Content Attribution

This content was originally published by kevin at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: