Runtime Error

52 views
Skip to first unread message

ruixiong L

unread,
Dec 17, 2024, 9:43:59 PM12/17/24
to PRISMS-PF Users
Hi everyone,
This is the error I encountered when running the program I created. After I modified the parameters, it still cannot run. What is the reason?Error.jpg

Jason Landini

unread,
Dec 18, 2024, 2:42:12 PM12/18/24
to PRISMS-PF Users
Hi Ruixiong,

It looks like you're getting NaN somewhere in your solution field. This could be due to several things depending on what PDE types you have (explicit, auxiliary, or time independent). The most common issue is dividing by zero, which happens when we calculate the normal vector in any of the solidification applications. To "fix" this, we add a small regularization (e.g., 1e-6) to the denominator. This introduces some error, but it is away from the interface, and inconsequential.

If you post your code or example code, I may be able to identify the issue more clearly.

Best,
Jason

David Montiel

unread,
Dec 18, 2024, 3:53:02 PM12/18/24
to Jason Landini, PRISMS-PF Users
Hello, Ruixion

Another common issue that can be causing the error you are encountering is using a time step that is too large, resulting in a numerical instability that gets amplified with each time step. A numerically stable value for the time step can become unstable for various reasons; for example: increasing the maximum refine factor of the mesh, increasing the interface mobility or increasing the mobility of a solute.

As Jason mentioned, if you share your code we can probably pinpoint what the issue is.

Also, which built-in application did you use as a starting point, and what other files did you modify, other than parameters.prm (if any). 

Best,

David

--
You received this message because you are subscribed to the Google Groups "PRISMS-PF Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prisms-pf-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/prisms-pf-users/447c7c04-1ccc-4446-adfc-43a73df73473n%40googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

ruixiong L

unread,
Dec 19, 2024, 8:08:01 PM12/19/24
to PRISMS-PF Users
Hi Jason and David,

Thanks for your reply. I used the built-in alloySolidification application and extended it to 3D.

I mainly modified equations.cc, ICs_and_BCs and parameters.prm.

In parameters.prm, I modified the Domain size and maximum and minimum level of refinement to run the results faster and verify the accuracy. In equation.cc, I added a perturbation at eq_phi to simulate the formation of secondary dendrites. I wonder if this is reasonable. The boundary conditions are set to solid phase at 5 from the bottom and liquid phase at the rest.

Since there was an error when sending a post with attachment yesterday, I have uploaded the code to the GitHub repository.

David Montiel

unread,
Dec 19, 2024, 8:42:31 PM12/19/24
to ruixiong L, PRISMS-PF Users
Thank you, Ruixiong

I will have a look at your code tomorrow and get back to you. 

Best,

David

David Montiel

unread,
Dec 20, 2024, 2:02:14 PM12/20/24
to ruixiong L, PRISMS-PF Users
Hello, Ruixiong

I cloned the code from your repository and ran it for a while. 

I did not run long enough to get to the error you are getting, but I encountered a few issues that could potentially explain the behavior. 

1) First of all, as the code is set, I got an error because refine factor = 5 (initial refinement level) setting was to 5, while the minimum and maximum refinement levels are 2 and 4 respectively. This combination of settings is not permitted in PRISMS-PF because the refine factor must be somewhere in-between 2 and 4. I increased the maximum refinement to 5 to avoid this runtime error.

2) To minimize errors in the numerical integration we strongly recommend using isotropic elements (i.e. dx=dy=dz). However, you are setting the system subdivisions to 2,2, and 3 in the x-, y- and z-directions, respectively. Since your system size is 50 x 50 x 100, you should have twice the subdivisions in the z-direction than in the x- and y-directions. I changed the subdivisions to:

set Subdivisions X = 1
set Subdivisions Y = 1
set Subdivisions Z = 2

3) Finally, the most important issue is that in ICs_and_BCs.cc you define the order parameter as 0 in the liquid and 1 in the solid, but in the alloy solidification model, the order parameter should be -1 in the liquid and 1 in the solid. I modified the initial conditions accordingly. 

With these changes, I ran the code for 20,000 time steps, printing and outputting files every 100 time steps. The simulation did not crash but the solid phase receded instead of growing, and the order parameter continued decreasing after all the solid had disappeared, which leads me to believe there is an error in your implementation of the model. I recommend double checking the equations. 

I hope this helps.

Please let me know if you have any questions.

Best, 

David
Reply all
Reply to author
Forward
0 new messages