dimb
Technical User
- Dec 2, 2010
- 1
Hello everyone
I started to use FORTRAN 77 week ago
I'm trying to read from a file, I use FORTRAN 77, I can not understand exactly what happens
******************************************************
That is an example of the data file :
Model: config_4.mph
% Version: COMSOL 4.0.0.993
% Date: Oct 2 2010, 23:51
% Dimension: 3
% Nodes: 123220
% Expressions: 4
% Description: Magnetic flux density, x component, Magnetic flux density, y component, Magnetic flux density, z component, Magnetic flux density norm
% x y z mf.Bx (T) mf.By (T) mf.Bz (T) mf.normB (T)
0.7 0.048691700470630664 -0.16502893113726974 -17.48728187721925 -0.1614065348511069 0.10294566053003251 17.488329746772145
0.7 0.042072027653693084 -0.149161178712754 -17.79973537031668 -0.21478827392261124 -0.20897089738410557 17.802257780738678
0.7 0.027414539338143515 -0.16044804853035652 -14.60770546033153 0.20830436409930542 0.001925509990911678 14.609190711038416
0.7149693019789779 0.039708881079374994 -0.1595764600327363 -15.977552204317588 -2.229527239282659 -1.1600150527838873 16.174010049306954
0.7 0.03397038565137395 -0.18081820743294008 -14.835298462101358 0.08954350306353831 0.2839581596700995 14.838285976992458
0.7 0.048691700470630664 -0.16502893113726974 -17.582924467091733 -0.5294189756439849 0.1596965562548931 17.59161789766094
0.7 0.027414539338143515 -0.16044804853035652 -14.719912190769339 0.3319056815995296 -0.05105932487671083 14.7237421649557
*****************************************************
I want to receive the coordinates and cosines of the magnetic field in different arrays
That's what i did:
**********MAGfld**************
integer nmax, u
parameter (nmax=123220, u=20)
real posx(nmax), posy(nmax), posz(nmax)
real mx(nmax), my(nmax), mz(nmax), normb(nmax)
open (u, FILE='XYZ', STATUS='OLD')
read(u,*) n
if (n.GT.nmax) then
write(*,*) 'Error: n = ', n, 'is larger than nmax =', nmax
endif
do 10 i= 1, n
read(u,100) posx(i), posy(i), posz(i), mx(i), my(i), mz(i)
read(u,100) normb(i)
10 enddo
100 format (7(F10.4))
************************************************************
Please help me
Thanks in advance
I started to use FORTRAN 77 week ago
I'm trying to read from a file, I use FORTRAN 77, I can not understand exactly what happens
******************************************************
That is an example of the data file :
Model: config_4.mph
% Version: COMSOL 4.0.0.993
% Date: Oct 2 2010, 23:51
% Dimension: 3
% Nodes: 123220
% Expressions: 4
% Description: Magnetic flux density, x component, Magnetic flux density, y component, Magnetic flux density, z component, Magnetic flux density norm
% x y z mf.Bx (T) mf.By (T) mf.Bz (T) mf.normB (T)
0.7 0.048691700470630664 -0.16502893113726974 -17.48728187721925 -0.1614065348511069 0.10294566053003251 17.488329746772145
0.7 0.042072027653693084 -0.149161178712754 -17.79973537031668 -0.21478827392261124 -0.20897089738410557 17.802257780738678
0.7 0.027414539338143515 -0.16044804853035652 -14.60770546033153 0.20830436409930542 0.001925509990911678 14.609190711038416
0.7149693019789779 0.039708881079374994 -0.1595764600327363 -15.977552204317588 -2.229527239282659 -1.1600150527838873 16.174010049306954
0.7 0.03397038565137395 -0.18081820743294008 -14.835298462101358 0.08954350306353831 0.2839581596700995 14.838285976992458
0.7 0.048691700470630664 -0.16502893113726974 -17.582924467091733 -0.5294189756439849 0.1596965562548931 17.59161789766094
0.7 0.027414539338143515 -0.16044804853035652 -14.719912190769339 0.3319056815995296 -0.05105932487671083 14.7237421649557
*****************************************************
I want to receive the coordinates and cosines of the magnetic field in different arrays
That's what i did:
**********MAGfld**************
integer nmax, u
parameter (nmax=123220, u=20)
real posx(nmax), posy(nmax), posz(nmax)
real mx(nmax), my(nmax), mz(nmax), normb(nmax)
open (u, FILE='XYZ', STATUS='OLD')
read(u,*) n
if (n.GT.nmax) then
write(*,*) 'Error: n = ', n, 'is larger than nmax =', nmax
endif
do 10 i= 1, n
read(u,100) posx(i), posy(i), posz(i), mx(i), my(i), mz(i)
read(u,100) normb(i)
10 enddo
100 format (7(F10.4))
************************************************************
Please help me
Thanks in advance