CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Fortran code debugging

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 7, 2022, 08:46
Default Fortran code debugging
  #1
New Member
 
Kuljeet Singh
Join Date: Aug 2022
Posts: 20
Rep Power: 4
Kuljeet is on a distinguished road
hi, i am trying to use this code to compute FSK distribution(this doesnt matter) from a file which has absorption coefficient and wavenumber. basically it is reading a file and in output it is creating some files. it is generating an error because of the format of input file. if someone can help i really appreciate it.

this is the reading file absco.dat

99999 000.0000-999.9900
0.00E+00 0.01
0.00E+00 0.02
0.00E+00 0.03
0.00E+00 0.04
0.00E+00 0.05
0.00E+00 0.06
0.00E+00 0.07
0.00E+00 0.08
0.00E+00 0.09
0.00E+00 0.1
0.00E+00 0.11
0.00E+00 0.12
... ...

there are two columns here.

and this is the format required

! absco.dat: input file for absorption coefficient absco
! 1st line: numk, Deta (in I5,F7.4 format)
! 2nd-(numk+1)th line: wvnm,absco (in e12.4 format)

thanks in advance

-K
Kuljeet is offline   Reply With Quote

Old   October 7, 2022, 12:19
Default
  #2
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
Which part do you want to change?
The format of the input file so it matches what the code expects?
Or the code so it can read the input file as-is?
flotus1 is offline   Reply With Quote

Old   October 7, 2022, 13:14
Default
  #3
New Member
 
Kuljeet Singh
Join Date: Aug 2022
Posts: 20
Rep Power: 4
Kuljeet is on a distinguished road
Thanks for the reply. I want to change the format of input file.
Kuljeet is offline   Reply With Quote

Old   October 9, 2022, 09:27
Default
  #4
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
No idea what to make of the first line. The code expects one integer length 5 and one floating point. The file contains one integer length 5 (this is fine) and a range? Change "000.0000-999.9900" to whatever single value "deta" is supposed to be. E.g. 99999 999.9900
Also note that 999.9900 is technically too large to fit into F7.4. That's 4 digits after the decimal point, leaving only 3 digits. One for the decimal point itself, one for a sign, and one for the digit before the decimal point. Compilers might read this without throwing an error, but some truncation WILL occur.

The other lines are more straightforward.
The code expects two E12.4 floating point numbers. In your example, it should look like this:
Code:
 0.0000E+00  0.1000E-01
 0.0000E+00  0.2000E-01
 0.0000E+00  0.3000E-01
 0.0000E+00  0.4000E-01
 0.0000E+00  0.5000E-01
 0.0000E+00  0.6000E-01
 0.0000E+00  0.7000E-01
 0.0000E+00  0.8000E-01
 0.0000E+00  0.9000E-01
 0.0000E+00  0.1000E+00
 0.0000E+00  0.1100E+00
 0.0000E+00  0.1200E+00
flotus1 is offline   Reply With Quote

Old   October 13, 2022, 02:43
Default
  #5
New Member
 
Kuljeet Singh
Join Date: Aug 2022
Posts: 20
Rep Power: 4
Kuljeet is on a distinguished road
got resolved. Thanks
Kuljeet is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Patankar CFD FORTRAN 90 Code FVM siddiquesil Main CFD Forum 19 October 25, 2022 06:21
Need help on checking HLL and Rusanov fortran code. pinball1997 Main CFD Forum 0 April 4, 2018 08:44
False diffusion + FORTRAN code mamly Main CFD Forum 0 July 18, 2012 03:42
CGNS fortran code compiling with intel visual fortran xe dokeun Main CFD Forum 1 April 5, 2012 22:01
Comparison between C/C++ and Fortran? rick Main CFD Forum 45 September 6, 2011 01:52


All times are GMT -4. The time now is 10:19.