topic Re: Population balance modelling - Rkadapt and Minerr in PTC Mathcad
https://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344096#M134561
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD><P>If i set beta equal to beta_exp then that would create at vector both with 12 elements correct?</P></TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Yes beta (not "better", as I wrote in the last post) just has to be a vector the same dimension as DeltaT.max_exp.</P><P>But doesn't it matter for you which values are in the vector beta?</P><P></P><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD><P> For the given statement then, if it's only a single vector should it just be a case of:</P><P>Delta.T.max(beta, kb,b, kg, g) = Delta.T.max_exp?</P></TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Yes, but you would have to use vectorization on th LHS. To further explain: If beta is a range variable as you had, feeding beta in DeltaT.max results in something which looks like a vector on display, but it isn't. You can't access single elements (as in a range) and you even cannot assign it a variable. So you cannot compare it to a vector, too.</P><P>If you feed a vector in a function, it depends on the operation in the function if the result is a vector or something else. For example f(x):=x^2 and g(x):=x*x. If you call f and g with a vector as argument, f will return a vector with the single elements squared and g would return a scalar (the dot product of the vector with itself). To avoid this you have to use vectorization.</P><P></P><P>I attach a sheet which seems to work, but the fit is awfully bad. I tried with somewhat different guess values and got the same result. Maybe the guesses and/or the model needs a rework.</P><P>I provided an alternative for your way to calculate DeltaT.max which has to call Rkadapt only once and not five times as with your solution. Nevertheless the solveblock still will takes its time, especially with N set to 1000 or even more (N influences the outcome as I noticed because while testing I had set N to 100).</P><P><IMG __jive_id="54778" __jive_id="54778" class="jive-image" alt="population.png" src="https://community.ptc.com/legacyfs/online/54778_population.png" /></P></BODY></HTML>Wed, 07 Aug 2013 17:28:13 GMTWerner_E2013-08-07T17:28:13ZPopulation balance modelling - Rkadapt and Minerr
https://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344093#M134558
I'm looking for help solving a problem with a topic I haven't seen any previous example on here of, population balance modeling. In this case the onset of crystallization. The aim is to solve a system of differential equations which represent the crystal population. The firstThu, 03 May 2018 17:04:47 GMThttps://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344093#M134558ptc-52063362018-05-03T17:04:47ZRe: Population balance modelling - Rkadapt and Minerr
https://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344094#M134559
<HTML><HEAD></HEAD><BODY><P>I spot some errors in you minerr sheet</P><P></P><P>- beta should be a vector, not a range variable</P><P>- it seems you have copied<IMG class="jiveImage" src="https://community.ptc.com/message/211233/" style="max-width: 1200px; max-height: 900px;" /> the expressions using "augment" from the sheet you mentioned and didn't know what augment is meant for. Augment simply merges together two or more matrices or vectors with the same number of rows to create a bigger matrix. It doesn't make any sense to apply augment to a single vector, the output woul be just that vector again. </P><P>Was the intention that MinErr should try to make DeltaT.max equal to DeltaT.max_exp? How could that be? You supply 19 different values for better, so the first vector would have 19 elements, while the second you have defined with only 12!</P></BODY></HTML>Wed, 07 Aug 2013 16:12:00 GMThttps://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344094#M134559Werner_E2013-08-07T16:12:00ZRe: Population balance modelling - Rkadapt and Minerr
https://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344095#M134560
<HTML><HEAD></HEAD><BODY><P>If i set beta equal to beta_exp then that would create at vector both with 12 elements correct?</P><P></P><P>For the given statement then, if it's only a single vector should it just be a case of:</P><P>Delta.T.max(beta, kb,b, kg, g) = Delta.T.max_exp?</P></BODY></HTML>Wed, 07 Aug 2013 16:42:08 GMThttps://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344095#M134560ptc-52063362013-08-07T16:42:08ZRe: Population balance modelling - Rkadapt and Minerr
https://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344096#M134561
<HTML><HEAD></HEAD><BODY><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD><P>If i set beta equal to beta_exp then that would create at vector both with 12 elements correct?</P></TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Yes beta (not "better", as I wrote in the last post) just has to be a vector the same dimension as DeltaT.max_exp.</P><P>But doesn't it matter for you which values are in the vector beta?</P><P></P><BLOCKQUOTE><TABLE border="1"><TBODY><TR><TD><P> For the given statement then, if it's only a single vector should it just be a case of:</P><P>Delta.T.max(beta, kb,b, kg, g) = Delta.T.max_exp?</P></TD></TR></TBODY></TABLE></BLOCKQUOTE><P>Yes, but you would have to use vectorization on th LHS. To further explain: If beta is a range variable as you had, feeding beta in DeltaT.max results in something which looks like a vector on display, but it isn't. You can't access single elements (as in a range) and you even cannot assign it a variable. So you cannot compare it to a vector, too.</P><P>If you feed a vector in a function, it depends on the operation in the function if the result is a vector or something else. For example f(x):=x^2 and g(x):=x*x. If you call f and g with a vector as argument, f will return a vector with the single elements squared and g would return a scalar (the dot product of the vector with itself). To avoid this you have to use vectorization.</P><P></P><P>I attach a sheet which seems to work, but the fit is awfully bad. I tried with somewhat different guess values and got the same result. Maybe the guesses and/or the model needs a rework.</P><P>I provided an alternative for your way to calculate DeltaT.max which has to call Rkadapt only once and not five times as with your solution. Nevertheless the solveblock still will takes its time, especially with N set to 1000 or even more (N influences the outcome as I noticed because while testing I had set N to 100).</P><P><IMG __jive_id="54778" __jive_id="54778" class="jive-image" alt="population.png" src="https://community.ptc.com/legacyfs/online/54778_population.png" /></P></BODY></HTML>Wed, 07 Aug 2013 17:28:13 GMThttps://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344096#M134561Werner_E2013-08-07T17:28:13ZRe: Population balance modelling - Rkadapt and Minerr
https://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344097#M134562
<HTML><HEAD></HEAD><BODY><P>Sorry, I forgot to attch the worksheet.</P><P>Strange enough upon reloading the worksheet I get different results (a better fit and the guess values didn't change much).</P><P><IMG __jive_id="54779" __jive_id="54779" class="jive-image-thumbnail jive-image" alt="population2.png" src="https://community.ptc.com/legacyfs/online/54779_population2.png" width="450" /></P></BODY></HTML>Wed, 07 Aug 2013 18:52:53 GMThttps://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344097#M134562Werner_E2013-08-07T18:52:53ZRe: Population balance modelling - Rkadapt and Minerr
https://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344098#M134563
<HTML><HEAD></HEAD><BODY><P>Thanks! It does exactly what I'm after. The model as a whole seems quite senstive to a number of the variables. I'd see that N affected the outcome too. At the moment I made a slight modification to the cooling rate expression, changed it to 0.12i to tend towards the higher cooling rate and ended up getting a fit that looks pretty good:</P><P><IMG __jive_id="54780" class="jive-image-thumbnail jive-image" onclick="" alt="Affect+of+cooling+rate.png" src="https://community.ptc.com/legacyfs/online/54780_Affect+of+cooling+rate.png" width="450" /> </P><P>At the moment it's matching the experimental data only on the temperature at the onset on crystallization but potentially I could add the particle size. Although I'm still working out how to extract the particle size from the moments. Going to mark this as answered.</P></BODY></HTML>Wed, 07 Aug 2013 19:58:07 GMThttps://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344098#M134563ptc-52063362013-08-07T19:58:07ZRe: Population balance modelling - Rkadapt and Minerr
https://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344099#M134564
<HTML><HEAD></HEAD><BODY><P>I tried with different beta's, too, but it seems my goal ws going up to high (in the region 1.85 where your original values were) but found that simply cuttin of the higher values as I did yielded better results. You are right, the model seems to be rather sensitive.</P><P>You could of course define the vector beta in a similar way as beta_exp so you are free and not restricted to equidistant values.</P><P>I tried beta:=beta.exp as you suggested in a prior post, but the result was inferiour.</P><P>What you have found seems to be the best fit (while still not necessarily a real good one).</P></BODY></HTML>Wed, 07 Aug 2013 20:43:25 GMThttps://community.ptc.com/t5/PTC-Mathcad/Population-balance-modelling-Rkadapt-and-Minerr/m-p/344099#M134564Werner_E2013-08-07T20:43:25Z