public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Hello everybody!!
@ 2006-07-28  2:59 miguel jiménez Zapata
  2006-07-28  3:10 ` Hello everybody!! (function attached) miguel jiménez Zapata
  0 siblings, 1 reply; 2+ messages in thread
From: miguel jiménez Zapata @ 2006-07-28  2:59 UTC (permalink / raw)
  To: gcc-help

Hello everybody,

Mi name is Salomon and I'm a fortran user(This sounds
like AA meeting).
I'm new to the list and to fortran.
So far I've been able to construct some programs with
succes. However, rigth now I'm facing a problem that
simply goes far beyond my undestanding.

The problem I'm having is the following

I have a program that has to multiply matrices, one of
the matrices is symmetric and has the form

S = BT.C.B*detj + S

this matrix is in a do loop so it won't be symmetric
until the end of the cycle. BT is the transpose of B
and C is a 4*4 matrix. I've been playing with the
coeffients of C, they are of the order of 1e10. When I
use order of magnitude less than 1e9 the program works
just fine, I get my symmetric matrix, but with values
of 1e10 my result (S) is no longer symmetric. I tested
my code in Matlab and works perfect, it doesnt matter
the order of the coefficents of C.
I declared C as
REAL B(4,8)
REAl S(8,8)
REAL C(4,4)
REAL C11,C12,C13,C33,C44

I already tried REAL(4) and REAL(8) and nothing
happens. I use the gfortran compiler in linux.
Is there anything I'm missing??

Thanks for your help


	
	
		
___________________________________________________________ 
Do You Yahoo!? 
La mejor conexión a Internet y <b >2GB</b> extra a tu correo por $100 al mes. http://net.yahoo.com.mx 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Hello everybody!! (function attached)
  2006-07-28  2:59 Hello everybody!! miguel jiménez Zapata
@ 2006-07-28  3:10 ` miguel jiménez Zapata
  0 siblings, 0 replies; 2+ messages in thread
From: miguel jiménez Zapata @ 2006-07-28  3:10 UTC (permalink / raw)
  To: gcc-help

Hi,

It's me again, I thougth the code would help!!
The coeffients fo C are defined in a main progran that
calls the function STIFFE

   REAL FUNCTION STIFFE(NODES, C) RESULT(STIFF)
        
        REAL C(:,:)
        REAL NODES(:,:)
        DIMENSION STIFF(8,8)                   
        REAL BE(4,8)                       
        REAL JINT(4,4)
        REAL J11, J12, J21, J22
        REAL MAT(4,8)                      
        REAL XI, ETA                            
        REAL N1, N2, N3,N4
        INTEGER I, J, STAGE
        MAT=0
        B=0        
        STIFF=0
        
        DO STAGE=1, 4
            
        
            IF  (STAGE .EQ. 1) THEN
                XI  = -1/3**(.5)
                ETA = -1/3**(.5)
            END IF
            
            IF  (STAGE .EQ. 2) THEN
                XI  =  1/3**(.5)
                ETA = -1/3**(.5)
            END IF
            
            IF  (STAGE .EQ. 3) THEN
                XI  =  1/3**(.5)
                ETA =  1/3**(.5)
            END IF
            
            IF  (STAGE .EQ. 4) THEN
                XI  = -1/3**(.5)
                ETA =  1/3**(.5)
            END IF     
            
            N1 = 1 - XI
            N2 = 1 + XI
            N3 = 1 - ETA
            N4 = 1 + ETA

J11 = 0.25*( -N3*NODES(1,1) + N3*NODES(3,1) +
N4*NODES(5,1) - N4*NODES(7,1) )
J12 = 0.25*( -N1*NODES(1,1) - N2*NODES(3,1) +
N2*NODES(5,1) + N1*NODES(7,1) )
J21 = 0.25*( -N3*NODES(2,1) + N3*NODES(4,1) +
N4*NODES(6,1) - N4*NODES(8,1) )
J22 = 0.25*( -N1*NODES(2,1) - N2*NODES(4,1) +
N2*NODES(6,1) + N1*NODES(8,1) )

DETJ=J11*J22-J12*J21      

            JINT=0
            JINT(1,1) =  J22/DETJ
            JINT(1,2) = -J21/DETJ
            JINT(2,3) = -J12/DETJ
            JINT(2,4) =  J11/DETJ
            JINT(3,1:4) = (/0.0, 0.0, 0.0, 0.0/)
            JINT(4,1) = -J12/DETJ
            JINT(4,2) =  J11/DETJ
            JINT(4,3) =  J22/DETJ
            JINT(4,4) = -J21/DETJ 
            
MAT(1,1:8) = (/-N3, 0.0, N3, 0.0, N4, 0.0, -N4, 0.0/) 
MAT(2,1:8) = (/-N1, 0.0, -N2, 0.0, N2, 0.0, N1, 0.0/)
MAT(3,1:8) = (/0.0, -N3, 0.0, N3, 0.0, N4, 0.0, -N4/)
MAT(4,1:8) = (/0.0, -N1, 0.0, -N2, 0.0, N2, 0.0, N1/)
            
BE=.25*MATMUL(JINT,MAT)
           
STIFF = MATMUL( MATMUL( TRANSPOSE(BE), C ), BE )*DETJ
+ STIFF
            PRINT *,"STIFF"
            PRINT '(18X 8EN18.5 )',STIFF
            PRINT *,"Checking symmetry"
            PRINT '(18X
8F18.2)',STIFF-TRANSPOSE(STIFF)
            
        END DO
        
        
        
    END FUNCTION STIFFE    




 --- miguel jiménez Zapata <smajz2000@yahoo.com.mx>
escribió:

> Hello everybody,
> 
> Mi name is Salomon and I'm a fortran user(This
> sounds
> like AA meeting).
> I'm new to the list and to fortran.
> So far I've been able to construct some programs
> with
> succes. However, rigth now I'm facing a problem that
> simply goes far beyond my undestanding.
> 
> The problem I'm having is the following
> 
> I have a program that has to multiply matrices, one
> of
> the matrices is symmetric and has the form
> 
> S = BT.C.B*detj + S
> 
> this matrix is in a do loop so it won't be symmetric
> until the end of the cycle. BT is the transpose of B
> and C is a 4*4 matrix. I've been playing with the
> coeffients of C, they are of the order of 1e10. When
> I
> use order of magnitude less than 1e9 the program
> works
> just fine, I get my symmetric matrix, but with
> values
> of 1e10 my result (S) is no longer symmetric. I
> tested
> my code in Matlab and works perfect, it doesnt
> matter
> the order of the coefficents of C.
> I declared C as
> REAL B(4,8)
> REAl S(8,8)
> REAL C(4,4)
> REAL C11,C12,C13,C33,C44
> 
> I already tried REAL(4) and REAL(8) and nothing
> happens. I use the gfortran compiler in linux.
> Is there anything I'm missing??
> 
> Thanks for your help
> 
> 
> 	
> 	
> 		
>
___________________________________________________________
> 
> Do You Yahoo!? 
> La mejor conexión a Internet y <b >2GB</b> extra a
> tu correo por $100 al mes. http://net.yahoo.com.mx 
> 
> 



	
	
		
___________________________________________________________ 
Do You Yahoo!? 
La mejor conexión a Internet y <b >2GB</b> extra a tu correo por $100 al mes. http://net.yahoo.com.mx 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-28  3:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-28  2:59 Hello everybody!! miguel jiménez Zapata
2006-07-28  3:10 ` Hello everybody!! (function attached) miguel jiménez Zapata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).