## How do you arrange output data from Fortran into a text file with specified columns widths?

## How do you arrange output data from Fortran into a text file with specified columns widths?

(OP)

Regarding thread214-1609970: How to output Fortran program into the text file?,

I would like to find out how to arrange the output data from Fortran into a text file with specified column widths?

My code is as follows:

write(3,*)'Model Parameters: '

write(3,*)'Column length :',int(RPAR(2)),' m'

write(3,*)'Mass transfer coeff N2 :',int(RPAR(3)),' 1/s'

write(3,*)'Mass transfer coeff O2 :',int(RPAR(4)),' 1/s'

write(3,*)'Saturation constants :',real(RPAR(7)),' kg/kgs'

write(3,*)'Overall heat transfer coeff:',int(RPAR(13)),' J/m2.s.K'

write(3,*)'Gas heat capacity :',int(RPAR(14)),' J/kg.K'

write(3,*)'Solid heat capacity :',int(RPAR(15)),' J/kg.K'

write(3,*)'Temperature ambient :',int(RPAR(16)),' K'

write(3,*)'Pressure atmospheric :',int(RPAR(29)),' Pa'

write(3,*)'Pressure feed :',int(RPAR(30)),' Pa'

write(3,*)'Heat of Adsorption :',int(RPAR(33)),' J/kg'

My output is not aligned in columns and looks untidy.

Please assist.

I would like to find out how to arrange the output data from Fortran into a text file with specified column widths?

My code is as follows:

write(3,*)'Model Parameters: '

write(3,*)'Column length :',int(RPAR(2)),' m'

write(3,*)'Mass transfer coeff N2 :',int(RPAR(3)),' 1/s'

write(3,*)'Mass transfer coeff O2 :',int(RPAR(4)),' 1/s'

write(3,*)'Saturation constants :',real(RPAR(7)),' kg/kgs'

write(3,*)'Overall heat transfer coeff:',int(RPAR(13)),' J/m2.s.K'

write(3,*)'Gas heat capacity :',int(RPAR(14)),' J/kg.K'

write(3,*)'Solid heat capacity :',int(RPAR(15)),' J/kg.K'

write(3,*)'Temperature ambient :',int(RPAR(16)),' K'

write(3,*)'Pressure atmospheric :',int(RPAR(29)),' Pa'

write(3,*)'Pressure feed :',int(RPAR(30)),' Pa'

write(3,*)'Heat of Adsorption :',int(RPAR(33)),' J/kg'

My output is not aligned in columns and looks untidy.

Please assist.

## RE: How do you arrange output data from Fortran into a text file with specified columns widths?

If you really can't figure it out, show us what you got and then we can help you tweak it.

## RE: How do you arrange output data from Fortran into a text file with specified columns widths?

integer rpar(33),i

do i=1,33

rpar(i)=i

end do

write(*,900),'Model Parameters: '

write(*,900),'Column length :',int(RPAR(2)),' m'

write(*,900),'Mass transfer coeff N2 :',int(RPAR(3)),' 1/s'

write(*,900),'Mass transfer coeff O2 :',int(RPAR(4)),' 1/s'

write(*,910),'Saturation constants :',real(RPAR(7)),' kg/kgs'

write(*,900),'Overall heat transfer coeff:',int(RPAR(13)),

+' J/m2.s.K'

write(*,900),'Gas heat capacity :',int(RPAR(14)),' J/kg.K'

write(*,900),'Solid heat capacity :',int(RPAR(15)),' J/kg.K'

write(*,900),'Temperature ambient :',int(RPAR(16)),' K'

write(*,900),'Pressure atmospheric :',int(RPAR(29)),' Pa'

write(*,900),'Pressure feed :',int(RPAR(30)),' Pa'

write(*,900),'Heat of Adsorption :',int(RPAR(33)),' J/kg'

900 format (a28,i8,a)

910 format (a28,f8.2,a)

end

## RE: How do you arrange output data from Fortran into a text file with specified columns widths?

## RE: How do you arrange output data from Fortran into a text file with specified columns widths?

## RE: How do you arrange output data from Fortran into a text file with specified columns widths?

## CODE --> 77

Output from th program:

## CODE -->