Fortran Definition and 876 Threads

  1. Matterwave

    Fortran [FORTRAN] How did I screw up my code?

    Hi guys, there's a bug in my code which I've been trying to get rid of for the last 2 weeks. I'm completely out of ideas now on what it is so I have to turn to you guys for help. The code is here: module helectron use params use parallel !* electron density parameters integer ...
  2. H

    Fortran Fortran - passing unknown array to subroutine

    Im trying to pass an unknown size of array to the subroutine. Then I will define the size of array in subroutine and pass it back to main program. I tried to use interface but the complier said invalid memory reference or Explicit interface required for ' ' at (1): allocatable argument . Any...
  3. H

    Fortran How to Merge and Sort Two Fortran Arrays?

    I have 2 set of data (from different files) and I allocate each set of data to array in my main program. But now I want to merge those 2 array and sort them in ascending orders in my sub program. What should I do? I know how to sort array in ascending orders, but i don't know how to merge those...
  4. J

    Fortran Troubleshooting Fortran 90 Errors: Rank Mismatch in Arguments | RFK.f90

    Hey guys, I'm pretty new and desperate. I been trying to compile this program for a while and keep jumping from error to error. Currently I have the following error: Error: Rank mismatch in argument 't' at (1) (scalar and rank-1) I have checked that my arrays are correctly. I have checked that...
  5. B

    Comp Sci Output format of a matrix in Fortran 90

    Hello, I'm new here and I'm also new in programming. I never did it before and now I have a problem with one of the programs in fortran 90 and I can't figure out how to solve it. Maybe some of you can help me. Many thanks in advance. 1. Homework Statement I need to plot the results of a...
  6. J

    Normal distribution starting with a uniformed distribution

    Hi comunity! I need to make a code o a normal distribution of velocities, starting whit a random secuence uniformly distributed between [0,1]. I am using FNT95, with Plato. I want to obtain a ''for'' bucle with I=1,N for the velocities. It is importan for the distribution to have sigma defined...
  7. S

    Fortran Useful and Extensive MPI tutorial/notes in FORTRAN

    Hello Everyone, I am a new user of MPI in fortran ( i have used fortran for an adequate time ) and I want to make myself familiar with the subject. Has anyone you stumbled upon a useful tutorial in MPI for fortran but simultaneously extensive ? Or maybe someone has used a textbook that...
  8. L

    Fortran Using Integer Expressions in an If Statement: Help Needed!

    Hi, so I'm trying to use the following if statement: if (sum(i,j) <=1.0 ) then sidash=(si)*(Death) else if (1 <= sum(i,j) <= 2) then sidash=(si)*((sqrt(2.0)+1.0)*(2.0-sum(i,j))*(Death)+(sum(i,j)-1.0)*(Survive)) else if (sum(i,j)<=3 .and. sum(i,j)=>2) then...
  9. J

    Fortran Problem with initial state in FORTRAN

    I have created an initial state code with perodic boundary conditions and normal distribution of velocities. I not know where is the problem, when I compile the computer detect the 112 error. Could anyone help me please? Thanks! the code is...
  10. camila

    Fortran {FORTRAN}How can i read blank steps without using iostat

    hello, I have a tricky question with arrays involved. I am trying to made a code who can read precipitation, so i have 3 kinds of strings: 1.numbers, 2.0 ,3. blank steps. I need to change the blanks into the smallest number who can read fortran. I was reading and the other options is using...
  11. Matterwave

    Fortran [FORTRAN] Code misassigning values

    Hi guys, I can't figure this one out. Here I am working with a piece of code which should read in a grid of 2 arrays, a radius array and an electron fraction array. The code looks like this: subroutine varelec_init(varelecfrac,elecprofile,effilename,elecfracname) integer ...
  12. shade rahmawati

    Fortran Fortran Write Path - Change File Paths

    Hello, I have write a fortran code to write several file, like this CHARACTER(len=12) :: FNAME INTEGER::ST DO 100 ST=1,12 DO KC=1,4 !number of layer IF(ST.EQ.1) WRITE (FNAME,10)KC IF(ST.EQ.2) WRITE (FNAME,11)KC IF(ST.EQ.3) WRITE (FNAME,12)KC...
  13. L

    Fortran Can Fortran be used to create a video of changing arrays?

    Hi, using Fortran that writes a large amount of arrays to a text/dat file. Is there some kind of software where I can create a video of these arrays changing from beginning to end? I've tried using VMD, but cannot get dat/text files working on it. Any input will be appreciated.
  14. Antonija

    Comp Sci Fortran error *** glibc detected ***

    Homework Statement I'm doing aproximation of derivative called five-point stencil. For every value of x, in interval [a,b], in step of 0.1 i need to calculate derivative.Homework Equations [/B] The equation is like this: Five-point stencil: (-f(x + 2h) + 8f(x + h) - 8f(x - h) + f(x -...
  15. L

    Fortran Fortran 90/95: Array Help with IF Statement

    Hi, For fortran 90/95, I've written a 10x10 array of numbers. 2 do loops (n,m) from 1 to 10 indicate the subscript of the elements in this array. I've applied a generic rule to the array elements where they become 0 if they are above a certain number. Using an if statement to change the...
  16. L

    Fortran [Fortran] Rounding up Random Numbers

    Hi, So I'm writing a programme in Fortran95 atm and I want to produce an array of 1s and 0s. I've used a random number and random seed generator to produce 10 numbers between 0 and 1 and I want to use a NINT statement to round these random numbers to 0 or 1. However when I try this the...
  17. M

    Can FORTRAN be Used for Quantum Computing in Physics?

    Hi, folks! I am Maisalatison. I currently teach physics at a Nigerian university. My earlier experience includes many years in government service on educational planning and curriculum development for technical & vocational education. I look forward to sharing ideas on especially use of...
  18. Antonija

    Comp Sci How to Evaluate a Function in Fortran at a Given Point of x?

    Homework Statement How can I evaluate function in some point of x? So, user inputs function in a character string, and he inputs the value of x. The program then needs to evaluate f(x). I have read something like this:http://faculty.cs.niu.edu/~hutchins/csci230/arith.htm But, I'd like to see...
  19. Antonija

    Comp Sci Allocatable character array in Fortran

    Homework Statement I have character array in fortran which is defined as allocatable. When program runs, user inputs something like: [1,2,3,4...], and then program reads it and counts the particles, and then allocate array with dimension it just read. Thats' how I understood it. This program...
  20. Antonija

    Comp Sci Derivative of a function in FORTRAN

    [Note from mentor: This thread was originally posted in a non-homework forum, therefore it does not follow the standard homework template.] ------------------------------------------------ Hello. I have some homework to do. I need to make program that finds minimum/maximum of a function od 2...
  21. M

    Fortran What is meaning of (5,*), (6,*)and (*,*) in Fortran ?

    Dear Members, Why The characters "(5,*)" should appear after every READ and the characters "(6,*)" after every WRITE ? What is the use of "(*,*)" that can appear with either the READ or WRITE statements. Best Regards
  22. ognik

    Help with Adams-Bashforth program

    Hi - trying to write a Fortran95 program to solve a trivial 1st order DE (dy/dx=-xy), the idea being that once it works it can be used for different forms of f(x,y). I use Euler to get the starting point, then A-B's 2 step formula for the next 2 starting points. It is when I apply the A-B...
  23. S

    Fortran Fortran 90 command to write only specific lines

    Hi all. I did search in internet but couldn't find the specific answer for my specific problem.I need to run a program with a datafile in 3000 time step and the output will 1.dat to 3000.dat, which is every single data output size 200Mb. To safe the storage, I would like to write only every...
  24. A

    Fortran Fortran 77 variable declaration issue

    Hi I've been struggling with a fortran 77 code that I need for my astrophysics thesis... Since it's quite old, I'm trying to rewrite some features in order to make it more readable, and I'm trying to make it more rigorous by declaring all variables (I'm declaring "implicit none" everywhere)...
  25. Karlisson

    Comp Sci Counting Numbers in Curly Braces in Fortran?

    < Mentor Note -- thread moved to HH from the technical forums, so no HH Template is shown > I have a file Aggregation.dat ######################################################################################## 6.999e+04 4.50000e+01 2.22222e+00 4.94813e+00 2.50000e+01 1.00000e+00 7.004e+04...
  26. Somefantastik

    Fortran Clear a variable in fortran subroutine

    Hello, I am trying to figure out how to clear a variable inside a subroutine from a calling function. The variable in the subroutine acts as a persistent(MATLAB) or static(C), but once in so many calls I want it to be reset to empty as if the subroutine is being called for the first time. I...
  27. SalfordPhysics

    Comp Sci Fortran - equation of motion, astronomical units

    Homework Statement Euler method : Plot the trajectory of a body moving under the influence of the suns gravity from initial conditions x=1, y=0, vx=0, vy=1. My trouble is figuring out my function. Homework Equations d2r / dt2 = -r/r3 The Attempt at a Solution What I have been doing...
  28. M

    Fortran Exploring Unimplemented Data Structures in C: Matrix Storage by Columns

    See attached image. I have never heard that before. Why wouldn't one be able to implement a data structure that stores a matrix by its columns using C? Is that true?
  29. SalfordPhysics

    Comp Sci Efficient Fortran Method for Trajectory Plotting with 4d Vector-First Order ODE

    Homework Statement I have a code that successfully plots the trajectory of a ball moving under gravity and air resistance, but my method is rather long-winded and I want to use a 4d vector-first order ODE instead - but I don't know how to do it. I've tried writing some simple skeletons but...
  30. SalfordPhysics

    Comp Sci Fortran90: DO loop for sequence of numbers

    Homework Statement A program finds the area under the Gaussian Distribution Curve between ±σ using Simpsons Rule. Modify the program to investigate the effect of the number of strips. Do this by using a DO loop in the main program for the following sequence of number of strips (n); n-2, n-4...
  31. SalfordPhysics

    FORTRN90: Euler Midpoint Method for SHO

    Homework Statement Write a program to simulate motion of simple harmonic oscillator. Initial conditions: Let ω = 1, x(t=0) = 1, v(t=0) = 0. Integrate over 30 seconds in intervals of 0.05s. Homework Equations δ2x / δt2 = -ω2x As set of 2 coupled ODE's; x' = v, v' = -w2x The...
  32. A

    Comp Sci Eigenvalues and eigenvectors of a real symmetric matrix in Fortran

    Homework Statement I try to run this program, but there are still some errors, please help me to solve this problems Homework EquationsThe Attempt at a Solution Program Main !==================================================================== ! eigenvalues and eigenvectors of a real...
  33. I

    Fortran Program in FORTRAN which calculate the detection efficiency

    Hi everyone, I want to write a program in FORTRAN which calculate the detection efficiency for a punctual source and a disc source at a distance from the detector .The disc detector is assumed to be perfect: ie photon absorbing everything that falls on it. So here I am working in 3D and I use...
  34. S

    Fortran Error 6404 when running fortran code in visual studio

    I am trying to compile several libraries of FORTRAN code and getting the error message as can be seen in the screen shot. As I do not have any experience with FORTRAN I am not sure what is wrong in the line highlighted line. Any help would be greatly appreciated! Thanks a lot! :-)
  35. Hercuflea

    Fortran A specification statement cannot appear in the executable section (fortran)

    I'm working on a code to compute the Kahan summation of two arrays. I'm a bit new to fortran so my error is probably obvious, but I have no idea why. It seems as if I have declared the subroutine according to standard that I have read on the internet. The code is still a work in progress so I...
  36. S

    Fortran [Fortran] How to open .hdf5 file extension

    Hello, i am relatively new linux user so please be as thoroughly descriptive as you can. i am starting a project and i have a file "file.hdf5" which contains velocity data i need to process in my fortran program. What do i have to do in order to use the data inside this file? i normally use...
  37. Matterwave

    Fortran Why am I getting a Fortran runtime error when trying to print more values?

    Hi guys, I've been tinkering with this code for a while now, as you probably have seen from my other threads. Right now I am working on changing the code around so that it actually writes out the correct output instead of the old output. I am getting this runtime error: At line 2057 of file...
  38. Matterwave

    Fortran [FORTRAN] Assigning bad values in arrays

    Hi, I just realized that I have been making bad array assignments in my code. Specifically, I think I have been assigning to slots that the array does not have. For example, I might declare an array: int,parameter :: nflavor=3 int,parameter :: nflavor2=nflavor*2 real,dimension(nflavor)::x...
  39. D

    Fortran FORTRAN moving from OpenVMS to AIX

    Good day, I am not familiar with older FORTRAN. We are shutting down an old OpenVMS server and moving to AIX. I am trying to tweak old FORTRAN code that is working fine on OpenVMS to now run on AIX. I have one error left in this code that I can't seem to fix. It is the line that reads 6...
  40. Matterwave

    Fortran [Fortran] something very peculiar

    Hello guys, As, you probably know by now, I've been trying to run this piece of code for a while now. I finally got it to run and then I realized something very weird is happening! So in my code, which simulates neutrino evolution, I have made 3 conditional statements in the evolution stage of...
  41. Matterwave

    Fortran [Fortran] A piece of code that confuses me

    Hello all, There is a subroutine in the code I'm working on that looks like this: subroutine onestep(iter,iegy,icos,jcos,iphi,rinit,rfin, & & v2,v2bar,hel,helbar,drdis, & & psib,psie,psibarb,psibare,err) use params use helectron use angles use neutrinodist use parallel...
  42. Matterwave

    Fortran [Fortran] Functions and naming conventions

    Hi guys, In the code I'm working on there are a few functions that will be used to find a Hamiltonian, which I will then use in later parts of the code to find the time evolution of my system. Right now I have it set up so that the function names are actually the names I want to give the...
  43. 1

    Fortran Writing strings/arrays to files in FORTRAN 77

    Hey guys i am a little confused in how to write arrays to a output file in FORTRAN 77. Here is the piece of code: Please assume that rri and eei arrays have been defined correctly above open (16,file='output.out') write (16,6100) rri eei format (5e16.8) However in the output file...
  44. SalfordPhysics

    Fortran Fortran 90 installation assistance

    Like so many before, I have a unit over the next year using Fortran 90 as part of my Physics B.Sc. In advance, I'd like to get it up an running on my MacBook Pro, but having read various threads over the internet I'm not so sure on what to do. I don't want to pay a penny, but if it is the...
  45. T

    Fortran FORTRAN 77 input absolute values

    How to input absolute values in FORTRAN77? This was the code I used READ *,H PRINT *,H The input I gave was 0.01 But the output I got was 0.00999999978.
  46. 1

    Fortran Help with Debugging Fortran Code | Plato Compiler

    Hey everybody, I am a mechanical engineer and new to Fortran(I have decent experience in programming in C, Matlab and understand languages similar to them). However the Fortran programming structure is new to me. Hence I am facing problems debugging a Fortran code. Here is the link of the code...
  47. Matterwave

    Fortran [FORTRAN] Help figuring out zheev

    Hello guys, I am in need of a subroutine that diagonalizes a nxn Hermitian matrix (really I'm just looking for the eigenvalues and eigenvectors of course). Looking online I found that LAPACK has a zheev subroutine that presumably does just this. I am a little confused on how to use this...
  48. 1

    Fortran Fortran Code Help for Mechanical Engineers | Solving Debugging Issues

    Hey everybody, I am a mechanical engineer and new to Fortran(I have decent experience in programming in C, Matlab and understand languages similar to them). However the Fortran programming structure is new to me. Hence I am facing problems debugging a Fortran code. Here is the link of the code...
  49. Matterwave

    Fortran Can equations be used in Fortran array declarations with parameters?

    Hi, I'm just wondering real quick, are equations allowed in array declarations? For example: int :: y=2 int, dimension(2*y):: x ?
  50. I

    Fortran Run Fortran Code - Tips from Ilango

    Dear all, Let me introduce myself first. I am Ilango from India. I am new to Fortran, mostly working on Matlab, Modelica & Dymola. Working in an automobile company I was required to go through some battery models and hence landed at this page. http://www.cchem.berkeley.edu/jsngrp/fortran.html...
Back
Top