Hello guys, I'm stuck with this question for some time. For my equation, I need to use WolframAlpha for my data. Firstly, I fix my initial water temperature as 500 Kelvin. Eg:
Twater = 300
Cwater = QuantityMagnitude[
ThermodynamicData["Water",
"ThermalConductivity", {"Temperature" ->
Quantity[Twater, "Kelvins"]}]]
With Cwater determined, I can implement the next 2 functions
Dwater = (5 Cwater)/\[Pi]
Ewater = Dwater^3 + 2 Cwater
Then by using ParametricNDSolveValue, I can determine the value of Z
ClassicalRungeKuttaCoefficients[4, prec_] :=
With[{amat = {{1/2}, {0, 1/2}, {0, 0, 1}},
bvec = {1/6, 1/3, 1/3, 1/6}, cvec = {1/2, 1/2, 1}},
N[{amat, bvec, cvec}, prec]];
f = ParametricNDSolveValue[{Derivative[1][y][x] ==
Piecewise[{{(y[x] + x^3 + 3 z - 120*Ewater), 0 <= x <= 1},
{(y[x] + x^2 + 2 z), 1 <= x <= 2},
{(y[x] + x + z), 2 <= x <= 3}}],
y[0] == 0},
y[3.],
{x, 0., 3.},
z,
Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> 4,
"Coefficients" -> ClassicalRungeKuttaCoefficients},
StartingStepSize -> 1/10];
point = {z /. FindRoot[f[z] == 100., {z, 1}, Evaluated -> False],
100.};
FindRoot[f[z] == 100., {z, 1}, Evaluated -> False]
Lastly, to find the new temperature of water
Tnew = 170 + 1.89*z /.
FindRoot[f[z] == 100., {z, 1}, Evaluated -> False]
I wanted to repeat Twater with Tnew until Twater=Tnew->True and the loop stop. I need to start Twater with a value, (only to replace Twater=Tnew after the first equation and keep press shift+enter repeatedly)
I've tried some Do Loop or For Loop and even FixedPoint but still don't know how to combine multiple functions/equations into 1 loop.... I apologize because I've been asking this question a few times, or maybe some of you have answered me in some way, but I still did not understand how to do this. Thank you very much for your time.