def d_a(self, k: float = 0.5, pretty=False): if not self.properties.geometry.solved: self.solvegeometry() d_a = 3.4 * math.pow( self.M_b() / ((1 - math.pow(k, 4)) * self.properties.material.sigma_bWN), 1 / 3) * ureg.meter if pretty: formArray = [ [self.M_b(pretty=True)[1].data[1:-1]], [ r"d_{a} = \approx 3.4 " + Latex.sqrt( Latex.frac(r"M_{b}", r"\left(1 - k^4 \right) \sigma_{bWN}"), 3) + r" \rightarrow 3.4 [m] " + Latex.sqrt( Latex.frac( self.M_b(), r"\left(1 - " + str(k) + r"^{4} " + r"\right)" + Latex.toStr(self.properties.material.sigma_bWN)), 3) + r" \approx " + Latex.toStr(d_a) ] ] pr = Latex.display(Latex.array(formArray)) return [d_a, pr] else: return d_a
def M_max(self, pretty=False): M_max = np.max(self.M) * ureg.N * ureg.m**-2 if pretty: pr = Latex.display( Latex.toStr(r"M_{max} = \max(M_{nom}) \rightarrow " + Latex.toStr(M_max))) return [M_max, pr] else: return M_max
def flowrate(v, A, pretty=False): Q = v * A Q = Q.to_base_units() if pretty: pr = Latex.display(Latex.toStr( r"Q_{f} = v_{f} \times A \rightarrow " + Latex.toStr(v) + r" \times " + Latex.toStr( A) + r" = " + Latex.toStr(Q))) return [Q, pr] return Q
def M_b(self, pretty=False): M_b = self.M_max() * self.properties.appliancefactor.K_a if pretty: pr = Latex.display( Latex.toStr(r"M_{b} = K_A \max(M_{nom}) \times \rightarrow " + Latex.toStr(self.properties.appliancefactor.K_a) + r" \times " + Latex.toStr(self.M_max()) + r" = " + Latex.toStr(self.M_b()))) return [M_b, pr] else: return M_b
def Reynolds(v, D, rho=None, mu=None, nu=None, fluid=None, pretty=False): if mu is not None and rho is not None: Re = (v * D * rho) / mu Re = Re.to_base_units() if pretty: pr = Latex.display( Latex.toStr(r"Re = \frac{v{f} \times D_i \times \rho_{f}}{\mu_{f}} \rightarrow \frac{" + Latex.toStr( v) + r" \times " + Latex.toStr(D) + r" \times " + Latex.toStr(rho) + r"}{" + Latex.toStr( mu) + r"} = " + Latex.toStr(Re))) return [Re, pr] else: return Re elif nu is not None: Re = (v * D) / nu Re = Re.to_base_units() if pretty: pr = Latex.display( Latex.toStr(r"Re = \frac{v{f} \times D_{i}}{\nu_{f}} \rightarrow \frac{" + Latex.toStr( v) + r" \times " + Latex.toStr(D) + r" \times " + Latex.toStr(rho) + r"}{" + Latex.toStr( mu) + r"} = " + Latex.toStr(Re))) return [Re, pr] else: return Re elif fluid is not None: Re = (v * D.to('m') * fluid.rho) / fluid.mu Re = Re.to_base_units() if pretty: pr = Latex.display(Latex.toStr( r"Re = \frac{v{f} \times D_i \times \rho_{f}}{\mu_{f}} \rightarrow \frac{" + Latex.toStr( v) + r" \times " + Latex.toStr(D) + r" \times " + Latex.toStr(fluid.rho) + r"}{" + Latex.toStr( fluid.mu) + r"} = " + Latex.toStr(Re))) return [Re, pr] else: return Re else: print('Error! Either fill in mu, nu or a fluid') return None return Re
def d_prime(self, pretty=False): if not self.properties.geometry.solved: self.solvegeometry() d_prime = 3.4 * math.pow( self.M_b() / self.properties.material.sigma_bWN, 1 / 3) * ureg.meter if pretty: formArray = [ [self.M_b(pretty=True)[1].data[1:-1]], [ r"d^{'} = \approx 3.4 " + Latex.sqrt(Latex.frac(r"M_{b}", r"\sigma_{bWN}"), 3) + r" \rightarrow 3.4 [m] " + Latex.sqrt( Latex.frac(self.M_b(), self.properties.material.sigma_bWN), 3) + r" \approx " + Latex.toStr(d_prime) ] ] pr = Latex.display(Latex.array(formArray)) return [d_prime, pr] else: return d_prime