<jupyter_start><jupyter_text>**Heat-Exchanger** **Evolution of Stochastic Differential Equations**<jupyter_code># Created by: <NAME>
# Details: V0.1 contains The evolution of Stochastic differential equation governing the dynamics of water tube heat exchanger via Euler–Maruyama method
# Date: 
# Version: 0.1

#Including libraries
import numpy as np
import matplotlib.pyplot as plt
import array as arr
import math

#Variable Declaration
N = 1000
T = 100
dt = T/N

#Noise Intensity
a1 = 0.0002
a2 = 0.0002
a3 = 0.0002
a4 = 0.0002

#Inputs and Outputs
fc   = float(input('Enter Input Flowrate of Cold Stream bet.n 0.002 to 0.00555 kg/s: '))
fh   = float(input('Enter Input Flowrate of Hot Stream bet.n 0.009 to 0.02 kg/s: '))
Tcin = int(input('Enter Input Temperature of Cold Stream bet.n 280 to 305 K: '))
Thin = int(input('Enter Input Temperature of Hot Stream bet.n 345 to 360 K: '))
h    = int(input('Enter Heat Transfer Coefficient: '))
Ac   = float(input('Enter Cross-sectional Area of Cold Stream: '))
Ah   = float(input('Enter Cross-sectional Area Hot Stream: '))
mc   = float(input('Enter mass Cold Stream: '))
mh   = float(input('Enter mass Hot Stream: '))
Cpc  = float(input('Specific Heat of Cold Stream: '))
Cph  = float(input('Specific Heat of Hot Stream: '))
r    = int(input('Noise Coefficient: '))

#Gaussian-Noise specificaitons for
mu,sd = 0,2

#Initialization
x1 = []
x2 = []
x1.append(298)
x2.append(353) 

for i in range(N):
  dW1=(np.random.normal(mu,sd))*(math.sqrt(dt))
  dW2=(np.random.normal(mu,sd))*(math.sqrt(dt))
  dW3=(np.random.normal(mu,sd))*(math.sqrt(dt))
  dW4=(np.random.normal(mu,sd))*(math.sqrt(dt))
  x1.append(x1[i] +(((((fc/mc)*(Tcin-x1[i]))+(((h*Ac)/(mc*Cpc))*(x2[i]-x1[i])))*dt)+((a1*((Tcin-x1[i])/mc))*dW1)+(a2*(fc/mc)*dW2))) #Dynamic stochastic differential equation of the Heat-Exchanger
  x2.append(x2[i]+(((((fh/mh)*(Thin-x2[i]))-(((h*Ah)/(mh*Cph))*(x2[i]-x1[i])))*dt)+((a3*((Thin-x2[i])/mh))*dW3)+(a4*(fh/mh)*dW4)))

t = np.arange(0,100,dt)

#fig, (ax0, ax1) = plt.subplots(2, 1)
#ax0.plot(t,x1,'b',linewidth=2.0)
#ax1.plot(t,x2,'r--',linewidth=2.0)

plt.figure(dpi=150)
plt.plot(t,x2,'r',linewidth=2.0)
plt.plot(t,x1,'b',linewidth=2.0)
plt.title('Stochastic (SDE) Simulation of Heat-Exchanger')
plt.xlabel('Time (s)')
plt.ylabel('Hot and Cold Stream Temperature (K)')
plt.grid(True)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19469026548672566, 'fraction_numerical': 0.052675937631689845, 'mean_word_length': 5.3646112600536195, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '342155', 'license': 'MIT', 'n_tokens_mistral': 1058, 'n_tokens_neox': 947, 'n_words': 215, 'path': 'StochasticHeatExchanger.ipynb', 'repo_name': 'Shnagarsheth/HeatExchangerEstimationAlgorithm', 'size': '2385'}