Indices of do loop

Hello everyone,

I am trying to output the following part in my code into .dat file

I expected to have one column in my output file, however, I am getting seven columns with different data

Can you explain it? is it related to use IJK index?

How can I make do loop to get the data in x direction and y direction?

How many solids phases have you defined? T_s is a 2-dimensional array, the first index is cell number (IJK), the second is solids phase.

one, so it is written on my code t_s(IJK, 1)

write(8,*) T_s(:,1)

It’s just printing the values of the t_s array one after the other. There are no columns, possibly you are seeing an artefact of text-wrapping on your display (try changing your screen width).

I’m not really sure what you want here, but if you want the numbers one per line, you need to either use a FOR loop, or write with a format descriptor other than * - see this posting for example https://stackoverflow.com/questions/51534237/controlling-newlines-when-writing-out-arrays-in-fortran

1 Like

Solved.

Thank you so much!