-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can using the FiPy library result in a different solution even if the equation and variables are the same? #904
Comments
Can you show some real code? Too much of the pseudo-code doesn't make any sense. |
Dear guyer, Thank you for your reply. I will add more detail after simplifying the code and checking this issue. |
Hello! This is my code simplified. Please check the below and I appreciate your help in advance.
|
I see the different solutions you're talking about and I have no idea why it's happening, but I also don't really understand what you're trying to do. You seem to have done a thorough job of isolating the two DistributionSolvers from each other, but I still suspect that something is shared between them. I recommend you simplify to try to isolate the difference.
One thing I found is that the difference goes away if I change to re.update_parameters(E_Ec = EEc[2], Te=Te[2], n_D=ne[2])
re2.update_parameters(E_Ec = EEc[2], Te=Te[2], n_D=ne[2]) or re.update_parameters(E_Ec = EEc[3], Te=Te[3], n_D=ne[3])
re2.update_parameters(E_Ec = EEc[3], Te=Te[3], n_D=ne[3]) I see no reason why this should be different from using index |
I see the different solutions you're talking about and I have no idea why it's happening, but I also don't really understand what you're trying to do. You seem to have done a thorough job of isolating the two DistributionSolvers from each other, but I still suspect that something is shared between them. I recommend you simplify to try to isolate the difference. One thing I found is that the difference goes away if I change to |
Dear guyer, Hello! I leave this message because I predicted I will take more time to test them (your check list). If you recommend, I close this issue now and raise this again after following the list. |
Leaving the issue open is OK |
I'm working on the electron distribution with the FiPy library. I will simply our problem for brevity. The governing equation has a form of the convective-diffusive equation with time-dependent coefficients.
Our distribution solver contains four main parts : (a) set up grids and initialize variables, (b) construct equation with
eq = (TransientTerm == DiffusionTerm + PowerLawConvectionTerm)
, (c) update diffusion / convection coefficients and (d) solve equation.I experienced that the solutions from two distribution solver differ from each other even though both have the same distribution function and convection / diffusion coefficients. I tested this by the following way.
re = DistributionSolver( ... )
re.f.setValue( ... )
re.update_parameters( ... )
re.eq.solve( ... )
re2 = DistributionSolver( ... )
re2.f.setValue(re.f.setValue)
re.update_parameters( ... )
re2.update_parameters( ... )
re.eq.solve( ... )
re2.eq.solve( ... )
If I compare distribution function in re and re2 at step 8), there is discrepancy. I want to understand the reason.
I tried the followings.
A) the distribution function, f, is the same before eq.solve.
B) convective / diffusive coefficients are the same before eq.solve.
C) our default solver is scipy.LinearLUSolver.
D) I tested the above-mentioned way using the hasOld attribute. But it doesn't resolve this issue.
I'm still confused. Is there any clue for discrepancy?
The text was updated successfully, but these errors were encountered: