Fortran (gfortran) compiling error

In summary: It's unclear what 'FEM' is or where it comes from. It could be related to the specific Fortran compiler being used.In summary, the individual is seeking help with programming their first Fortran program, which is not running due to a potential issue with the compiler. They provide their code and ask for feedback on what could be causing the issue. The conversation also includes discussions about various subroutines and potential errors in the code. The compiler may be having trouble finding a program or routine called 'FEM'.
  • #1
zerne
1
0
Hello, I need help for programming my first program in Fortran, because it doesn't run. I think it's a problem with the compiler. What do you think?

This is my code
Code:
program Steifigkeitsmatrix
    implicit none
        real :: E,I,l,p                                      
        real, dimension(4,4) :: Ke                           
        real, dimension(4,4) :: KeI                          
        real, dimension(4,4) :: KeII                         
        real, dimension(4,4) :: KeIII                        
        real, dimension(8,8) :: K                            

        real :: u,v,w
                u = 2
                v = 3
                w = 4
            read(*,*)   E                                    
            write(*,*)  'E=', E                              
            read(*,*)   I                                    
            write(*,*)  'I=', I                              
            read(*,*)   l                                    
            write(*,*)  'l=', l                              


        p = (E*I)/((l**3)/3)                                 
                                                             
                                                             

        call stiffness(l,p,Ke)                               

        write(*,*) Ke                                        

        KeI   = u*Ke
        KeII  = v* Ke
        KeIII = w*Ke
        write(*,*) KeI

        call globalstiffness(KeI,KeII,KeIII,K)
        write(*,*) K
 end program Steifigkeitsmatrix


        subroutine stiffness(z,q,k)                          

                real, intent(in) :: z,q                      
                real, dimension(4,4), intent(out) :: k       
                integer :: i,j                               

                  do i=1,4
                                    do j=1,4

                                            k(1,1)= 12*q
                                            k(1,2)= 6*(z/3)*q
                                            k(1,3)= -12*q
                                            k(1,4)= 6*(z/3)*q
                                            k(2,1)= 6*(z/3)*q
                                            k(2,2)= 4*q*(z/3)**2
                                            k(2,3)= -6*(z/3)*q
                                            k(2,4)= 2*q*(z/3)**2
                                            k(3,1)= -12*q
                                            k(3,2)= -6*(z/3)*q
                                            k(3,3)= 12*q
                                            k(3,4)= -6*(z/3)*q
                                            k(4,1)= 6*(z/3)*q
                                            k(4,2)= 2*q*(z/3)**2
                                            k(4,3)= -6*q*(z/3)
                                            k(4,4)= 4*q*(z/3)**2
                                            write(*,*) 'Zeile:',i,'   Spalte: ', j,'   Wert: ',  k(i,j)
                                    end do
                  end  do

                 return

        end subroutine stiffness

        subroutine globalstiffness(x,y,z,r)

                    real, dimension(4,4), intent(in) :: x,y,z
                    real, dimension(8,8), intent(out) :: r
                    integer :: i,j

                        do i=1,3
                                    do j=1,8
                                            K(1,1)= x(1,1)
                                            K(1,2)= x(1,2)
                                            K(1,3)= x(1,3)
                                            K(1,4)= x(1,4)
                                            K(1,5)= 0
                                            K(1,6)= 0
                                            K(1,7)= 0
                                            K(1,8)= 0
                                            K(2,1)= x(2,1)
                                            K(2,2)= x(2,2)
                                            K(2,3)= x(2,3)
                                            K(2,4)= x(2,4)
                                            K(2,5)= 0
                                            K(2,6)= 0
                                            K(2,7)= 0
                                            K(2,8)= 0
                                            K(3,1)= x(3,1)
                                            K(3,2)= x(3,2)
                                            K(3,3)= x(3,3) + y(1,1)
                                            K(3,4)= x(3,4) + y(1,2)
                                            K(3,5)= y(1,3)
                                            K(3,6)= y(1,4)
                                            K(3,7)= 0
                                            K(3,8)= 0
                                            K(4,1)= x(4,1)
                                            K(4,2)= x(4,2)
                                            K(4,3)= x(4,3) + y(2,1)
                                            K(4,4)= x(4,4) + y(2,2)
                                            K(4,5)= y(2,3)
                                            K(4,6)= y(2,4)
                                            K(4,7)= 0
                                            K(4,8)= 0
                                            K(5,1)= 0
                                            K(5,2)= 0
                                            K(5,3)= y(3,1)
                                            K(5,4)= y(3,2)
                                            K(5,5)= y(3,3) + z(1,1)
                                            K(5,6)= y(3,4) + z(1,2)
                                            K(5,7)= 0
                                            K(5,8)= 0
                                            K(6,1)= 0
                                            K(6,2)= 0
                                            K(6,3)= y(4,1)
                                            K(6,4)= y(4,2)
                                            K(6,5)= y(4,3) + z(2,1)
                                            K(6,6)= y(4,4) + z(2,2)
                                            K(6,7)= z(2,3)
                                            K(6,8)= z(2,4)
                                            K(7,1)= 0
                                            K(7,2)= 0
                                            K(7,3)= 0
                                            K(7,4)= 0
                                            K(7,5)= z(3,1)
                                            K(7,6)= z(3,2)
                                            K(7,7)= z(3,3)
                                            K(7,8)= z(3,4)
                                            K(8,1)= 0
                                            K(8,2)= 0
                                            K(8,3)= 0
                                            K(8,4)= 0
                                            K(8,5)= z(4,1)
                                            K(8,6)= z(4,2)
                                            K(8,7)= z(4,3)
                                            K(8,8)= z(4,4)
                                        end do
                        end do
                        return

        end subroutine globalstiffness



Output
Code:
Description	Resource	Path	Location	Type
../Steifigkeitsmatrix.f90:105.44: Fatal Error: Error count reached limit of 25.	Steifigkeitsmatrix.f90	/FEM	line 105	C/C++ Problem
Description	Resource	Path	Location	Type
make: *** [Steifigkeitsmatrix.o] Error 1	FEM		 	C/C++ Problem
Description	Resource	Path	Location	Type
recipe for target `Steifigkeitsmatrix.o' failed	subdir.mk	/FEM/Debug	line 15	C/C++ Problem
Description	Resource	Path	Location	Type
Unclassifiable statement at (1)	FEM		 	C/C++ Problem


Thanks for help
 
Technology news on Phys.org
  • #2
In subroutine 'globalstiffness', the array 'K' is not dimensioned. Also, why are the definitions for the entries in 'K' contained within the loops? All you are doing is redefining 'K' 24 times. The definitions of 'K' can be placed outside the loops, which apparently are used only to print the various entries in 'K'. This curiosity also occurs in subroutine 'stiffness' for matrix 'k', which is properly dimensioned.

It seems the compiler/linker is having trouble finding a program/routine called 'FEM'.
 

1. What is "Fortran (gfortran) compiling error"?

Fortran (gfortran) compiling error refers to an error that occurs during the process of compiling Fortran code using the gfortran compiler. It is a common issue that arises when there are errors in the code or when the compiler is unable to understand the code.

2. What are some common causes of Fortran (gfortran) compiling error?

Some common causes of Fortran (gfortran) compiling error include syntax errors in the code, missing or incorrect libraries, using incompatible compiler options, and problems with the compiler itself. It can also occur when the code is written for a different version of Fortran.

3. How can I fix Fortran (gfortran) compiling error?

To fix Fortran (gfortran) compiling error, you can start by checking for any syntax errors in your code and fixing them. You can also make sure that you have all the necessary libraries and dependencies installed. If the error persists, try using different compiler options or updating to the latest version of the gfortran compiler.

4. Can I prevent Fortran (gfortran) compiling error from happening?

While some Fortran (gfortran) compiling errors are unavoidable, you can prevent them by writing clean and error-free code. It is also essential to regularly check for updates and keep your compiler and libraries up to date. Additionally, it is helpful to use a debugger or testing tool to catch any errors before compiling.

5. Is there any additional support available for Fortran (gfortran) compiling error?

Yes, there is additional support available for Fortran (gfortran) compiling error. You can refer to the gfortran compiler documentation, online forums and communities, or seek help from experienced Fortran programmers. You can also contact the developer of the compiler for specific troubleshooting assistance.

Similar threads

  • Programming and Computer Science
Replies
4
Views
567
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
4
Views
7K
  • Programming and Computer Science
Replies
6
Views
3K
  • Linear and Abstract Algebra
Replies
1
Views
739
  • Programming and Computer Science
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
17
Views
10K
  • General Math
Replies
3
Views
1K
  • Programming and Computer Science
Replies
2
Views
2K
Replies
1
Views
1K
Back
Top