
Post by tomdcpe on Jan 5, 2017 7:30:09 GMT 6
Dear Alberto,
I found when change the initial conditions for moment.0 ~ moment.4 for case_5 under madadiPassalacquaGamma folder to the values:
moment.0= 3.9806152e+20 moment.1= 2.6129729e+13 moment.2= 1716094.9 moment.3= 0.11276348 moment.4= 7.4133732e09
The code responded the following errors:
> FOAM FATAL ERROR: The zeroorder moment is negative.
From function Foam::extendedMomentInversion::invert ( const univariateMomentSet& moments ) in file extendedMomentInversion/extendedMomentInversion.C at line 86.
FOAM aborting
Could you please take a look and give some help on this problem?
Thanks and have a very happy and prosperous new year!



Post by tomdcpe on Jan 5, 2017 8:26:28 GMT 6
By the way, in case_5 under madadiPassalacquaGamma, The settings in populationBalanceProperties file are:
diffusionModel { diffusionModel none; } aggregation on; aggregationKernel { aggregationKernel constant; } breakup on; breakupKernel { breakupKernel constant; Cb Cb [ 0 0 1 0 0 0 0 ] 0.02; } daughterDistribution { daughterDistribution symmetricFragmentation; } growth off;
When I turned off the "aggregation" kernel, the code works.
So it means the " zeroorder moment is negative" error must caused by the aggregation kernel?
Reasons?
Thanks in advance for any help or comments on this!



Post by tomdcpe on Jan 5, 2017 8:42:37 GMT 6
Hi, I found if changing the value of moment.0 from 0 to 2000 with both aggregation kernel and breakup kernel on, the code runs. so it also means the value of moment.0 matters? Dear Alberto, I found when change the initial conditions for moment.0 ~ moment.4 for case_5 under madadiPassalacquaGamma folder to the values: moment.0= 3.9806152e+20 moment.1= 2.6129729e+13 moment.2= 1716094.9 moment.3= 0.11276348 moment.4= 7.4133732e09 The code responded the following errors: > FOAM FATAL ERROR: The zeroorder moment is negative. From function Foam::extendedMomentInversion::invert ( const univariateMomentSet& moments ) in file extendedMomentInversion/extendedMomentInversion.C at line 86. FOAM aborting Could you please take a look and give some help on this problem? Thanks and have a very happy and prosperous new year!



Post by Alberto Passalacqua on Jan 6, 2017 5:10:18 GMT 6
Hi, I found if changing the value of moment.0 from 0 to 2000 with both aggregation kernel and breakup kernel on, the code runs. so it also means the value of moment.0 matters? If moment.0 is zero, the inversion algorithm will ignore the moment set, because it means there are no particles in the system. When you set the initial condition, what matters is that the moment set is realizable, which, in simple words, means that it is a moment set associated to a numberdensity function. You are not allowed to set initial values of the moments independently, because the inversion algorithm needs a realizable set (or subset) of moments to calculate the quadrature approximation of the NDF. My suggestion to obtain initial conditions is to start from the quadrature and compute the moments. Remember that weight w_i defines the number of particles with size xi_i per unit volume. So you can decide the number of nodes you use (= number of sizes, or, if you want a visual interpretation, bars in your histogram of the NDF). Let's assume we set it to 3. We have to define three weights and three abscissae w_i [no. of particles/volume] xi_i [particle size] w_1 xi_1 w_2 xi_2 w_3 xi_3 Now, compute the moments as: m_k = w_1*(xi_1)^k + w_2*(xi_2)^k + w_3*(xi_3)^k = sum_i (w_i * (xi_i)^k), m_k = 0, ... 2*N+1 The set of m_k will give you a realizable set of moments you can use for your initial condition. If you have a set of moments from experiments, you can make sure it is realizable using the piece of code TestUnivariateMomentSet. For what concerns the error saying the zeroorder moment is negative, this typically happens when the timestep is too large to ensure realizability. I will merge an adaptive timestepping routine to automate this in the near future. Please, let me know if you still face difficulties. In the meantime, Happy New Year! AP



Post by Alberto Passalacqua on Jan 6, 2017 5:11:50 GMT 6
When I turned off the "aggregation" kernel, the code works. So it means the " zeroorder moment is negative" error must caused by the aggregation kernel? Reasons? Stiffness of the aggregation term. Try reducing the timestep. AP



Post by tomdcpe on Jan 6, 2017 9:35:35 GMT 6
Hi, Alberto, Really appreciate your input and help. The initial conditions for the moments are obtained from FLUENT, the real initial condition for the NDF is that there are 3.9806152e+20 particles per unit volume with uniform diameter equal to 65 nm. I recalculate the moments by hand: m_0=3.9806152e+20*(65e9)^0=3.9806152e+20; m_1=3.9806152e+20*(65e9)^1=2.5873999e+13; m_2=3.9806152e+20*(65e9)^2=1681809.922; m_3=3.9806152e+20*(65e9)^3=0.10931764493; m_4=3.9806152e+20*(65e9)^4=7.10564692e9; so, as seen, the recalculated values are very close to those obtained by FLUENT. I tried to use these initial values for moments, and reduced the time step even to 1e10 s, the code still responded "The zeroorder moment is negative." For you convenience, I upload the case file via dropbox: www.dropbox.com/s/emfcijb2srzl087/case5.zip?dl=0 Thanks for any help and comments in advance! Hi, I found if changing the value of moment.0 from 0 to 2000 with both aggregation kernel and breakup kernel on, the code runs. so it also means the value of moment.0 matters? If moment.0 is zero, the inversion algorithm will ignore the moment set, because it means there are no particles in the system. When you set the initial condition, what matters is that the moment set is realizable, which, in simple words, means that it is a moment set associated to a numberdensity function. You are not allowed to set initial values of the moments independently, because the inversion algorithm needs a realizable set (or subset) of moments to calculate the quadrature approximation of the NDF. My suggestion to obtain initial conditions is to start from the quadrature and compute the moments. Remember that weight w_i defines the number of particles with size xi_i per unit volume. So you can decide the number of nodes you use (= number of sizes, or, if you want a visual interpretation, bars in your histogram of the NDF). Let's assume we set it to 3. We have to define three weights and three abscissae w_i [no. of particles/volume] xi_i [particle size] w_1 xi_1 w_2 xi_2 w_3 xi_3 Now, compute the moments as: m_k = w_1*(xi_1)^k + w_2*(xi_2)^k + w_3*(xi_3)^k = sum_i (w_i * (xi_i)^k), m_k = 0, ... 2*N+1 The set of m_k will give you a realizable set of moments you can use for your initial condition. If you have a set of moments from experiments, you can make sure it is realizable using the piece of code TestUnivariateMomentSet. For what concerns the error saying the zeroorder moment is negative, this typically happens when the timestep is too large to ensure realizability. I will merge an adaptive timestepping routine to automate this in the near future. Please, let me know if you still face difficulties. In the meantime, Happy New Year! AP



Post by tomdcpe on Jan 13, 2017 8:42:19 GMT 6
Hi Alberto,
I checked the moments below, which is shown realizable using the piece of code TestUnivariateMomentSet.
Input moments
Moment 0 = 3.9806152e+20 Moment 1 = 26003692757421.01 Moment 2 = 1715784.735925774 Moment 3 = 0.1143493021595023 Moment 4 = 7.69745541487218e09
The full set of moments is realizable.
The number of invertible moments is 4
Weights and abscissae:
Node 0 Weight: 2.287243514228154e+20 Abscissa: 5.96908463660079e08 Node 1 Weight: 1.693371685771847e+20 Abscissa: 7.293698566152253e08
Moments computed from quadrature
Moment 0 = 3.980615200000001e+20 Moment 1 = 26003692757421.02 Moment 2 = 1715784.735925775 Moment 3 = 0.1143493021595024 Moment 4 = 7.695938812229962e09
End
But when use these moments as initial values for pbeFoam, the pbeFoam still responded the error: "The zeroorder moment is negative." The error remains even when very small time step (e.g., 1e15 s) is used.
Could you please take a look and give some help on this problem? Thanks!

