i have dp as a parameter that needs to be used in the define adjust. when i do multiple diameter runs I need to change this in the define adjust function as and when necessary. (i was trying various other methods)

(This is not the best of the ideas but i thought this would work, i still get problems with this. not sure why the compiler does it )

I have written an execute on demand to rewrite the define adjust function file (with different particle diameter values) when I run it. But unfortunately, when I write the file it writes the file twice onto the same file

This prints the contents of the file twice. I don't have multiple injection loops. At a time I inject one particle diameter but after that is done I need to change the diameter and re-run the iterations and inject different diameters.

this is what i want to achieve but when I write define adjust I get the contents of the file printed twice. (I even used fseek to write the file even then the file gets printed twice. how to get rid of this double printing (i am running this in serial, not in parallel mode)