Hi,
I am trying to write my matrix in a file using some parameters in its name (DxmatAsp=0.1Nx=5Nz=3) . Like number of rows,columns, etc ...
But when I run the code only some part is written in the name, i.e, aspect ratio.
Here is my code
program trialwrite
implicit none
integer :: i,j,k
integer :: Nx, Nz
real(8), dimension
,
,allocatable :: Dx
real(8)::asp
CHARACTER (LEN=100):: Dxmat,Nxc,Nzc, Aspect
Nx=3
Nz=5
Asp=0.1
allocate (Dx(Nz,Nx))
Dx(1,
=(/3.00, -2.00, -1.00/)
Dx(2,
=(/4.00, -1.00, 0.00/)
Dx(3,
=(/4.00, -1.00, 0.00/)
Dx(4,
=(/4.00, -1.00, 0.00/)
Dx(5,
=(/4.00, -1.00, 0.00/)
WRITE(Aspect,'(f4.2)')asp
WRITE(Nxc,'(i1)')Nx
WRITE(Nzc,'(i1)')Nz
Dxmat='Dx'//'Asp='//Aspect//'Nx='//Nxc//'Nz='//Nzc
OPEN(10,FILE=Dxmat)
DO i=1,Nz
WRITE(10,*) (Dx(i,j),j=1,Nx)
ENDDO
CLOSE(10)
end program trialwrite
The output file from this is DxmatAsp=0.1 the rest is not there. I would appreciate if someone point my mistake.
Thank you.
I am trying to write my matrix in a file using some parameters in its name (DxmatAsp=0.1Nx=5Nz=3) . Like number of rows,columns, etc ...
But when I run the code only some part is written in the name, i.e, aspect ratio.
Here is my code
program trialwrite
implicit none
integer :: i,j,k
integer :: Nx, Nz
real(8), dimension
real(8)::asp
CHARACTER (LEN=100):: Dxmat,Nxc,Nzc, Aspect
Nx=3
Nz=5
Asp=0.1
allocate (Dx(Nz,Nx))
Dx(1,
Dx(2,
Dx(3,
Dx(4,
Dx(5,
WRITE(Aspect,'(f4.2)')asp
WRITE(Nxc,'(i1)')Nx
WRITE(Nzc,'(i1)')Nz
Dxmat='Dx'//'Asp='//Aspect//'Nx='//Nxc//'Nz='//Nzc
OPEN(10,FILE=Dxmat)
DO i=1,Nz
WRITE(10,*) (Dx(i,j),j=1,Nx)
ENDDO
CLOSE(10)
end program trialwrite
The output file from this is DxmatAsp=0.1 the rest is not there. I would appreciate if someone point my mistake.
Thank you.