-
-
May 30, 2023 at 8:25 pm
mctom0518
SubscriberHello,
I am trying to compile and execute this UDF code to initialize an array, but I am receving the following error message: Chip: invalid opcode 0: pc=21
My UDF code is below:
#include "udf.h" int grid[2][2][10]; DEFINE_ON_DEMAND(ini_all) { int i, j, m; for (i = 0; i < 2; i ++) { for (j = 0; j < 2; j ++) { for (m = 0; m < 10; m ++) { printf("At index %d %d %d \n", i, j, m); grid[i][j][m] = 3; } } } }
What does this error message mean, and how can I resolve it? I can easily execute the same for loop structure using gcc compilers, but it just does not seem to work in ANSYS.
Thank you!
-
May 31, 2023 at 10:36 am
Rob
Forum ModeratorI've not seen that one. Are there any other errors when you compile?
-
May 31, 2023 at 4:34 pm
mctom0518
SubscriberHello Rob,
There were no interpretations or compilation errors with the UDF.Â
-
June 1, 2023 at 3:24 pm
Rob
Forum ModeratorCan you confirm you're compiling the code, ie linking to the libudf library? Also, you may want to look at the Message function rather than printf.Â
-
June 1, 2023 at 6:56 pm
mctom0518
SubscriberWe ran without the printf command and it still displayed the error message.Â
-
June 1, 2023 at 9:04 pm
mctom0518
SubscriberAs of right now, the only solution from my end is to use a while loop instead of a for loop, but I am still wondering why the for loop does not work but the while loop works.
-
June 2, 2023 at 8:59 am
Rob
Forum ModeratorNot sure, my UDF coding isn't overly good, and I don't think I ever used FOR or WHILE in a code. Will FOR fail the block & move on for when i isn't 0, but WHILE moves onto i<2 when i isn't 0? Just been reading an online C manual for my own benefit.Â
-
June 5, 2023 at 8:35 pm
mctom0518
SubscriberHello Rob,
I figured out the issue. For loops just do not seem to work when interpreting UDFs and only seem to work with compiling only. The code is running smoothly now without issue.
I appreciate your time and help!
-
- The topic ‘UDF Error Message’ is closed to new replies.
- air flow in and out of computer case
- Varying Bond model parameters to mimic soil particle cohesion/stiction
- Eroded Mass due to Erosion of Soil Particles by Fluids
- Guidance needed for Conjugate Heat Transfer Analysis for a 3s3p Li-ion Battery
- Centrifugal Fan Analysis for Determination of Characteristic Curve
- I am doing a corona simulation. But particles are not spreading.
- Issue to compile a UDF in ANSYS Fluent
- JACOBI Convergence Issue in ANSYS AQWA
- affinity not set
- Resuming SAG Mill Simulation with New Particle Batch in Rocky
-
3862
-
1414
-
1231
-
1118
-
1015
© 2025 Copyright ANSYS, Inc. All rights reserved.