I am meeting a problem when writing my UDF: From the book <<ELMER guide to FRM>> p38. Says that UDF should has format

Code: Select all

`FUNCTION name_func ( model, n, var ) RESULT(result)`

Code: Select all

`xecRealFunction( ptr % PROCEDURE,CurrentModel, NodeIndex, T )`

Code: Select all

```
FUNCTION MyFunc(Model,n, t)RESULT(br)
USE DefUtils
IMPLICIT None
CHARACTER(len=20) filename
TYPE(Model_t) :: Model
INTEGER :: n
REAL(KIND=dp) :: br, t
filename = "C:\\Temp\\Test.txt"
open(unit = 1, file = filename)
write(1, '(i16)') n
br = 0.3
END FUNCTION MyFunc
```

it seems that the values of n do not correspond to the node index (should from 0 to Number of nodes-1). Part of the result of n is shown below:

779498769

646292935

-1717986918

646292935

779498769

1120292398

779498769

-1717986918

-1717986918

779498769

-1717986918

-549755814

1344262916

-1717986918

-1717986918

1344262916

-549755814

-1717986918

1756579777

1344262916

148214167

1344262916

1756579777

-549755814

1870269279

282189659

-549755814

282189659

Anyone has any idea about what these numbers are or why I am not getting expected value for n?

Thanks