Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

DFlux Subroutine

Alex22
Beginner
2,389 Views

Hello,

I am trying to write a DFLux subroutine that simulates a motion of a laser making the motion indicated in the image below. At the moment I have a script that I am trying to repurpose which is also included below.

 

Untitled.jpg

 

subroutine DFLUX(FLUX,SOL,KSTEP,KINC,TIME,NOEL,NPT,COORDS,
& JLTYP,TEMP,PRESS,SNAME)
C
include 'ABA_PARAM.INC'
C
dimension FLUX(2), TIME(2), COORDS(3)
CHARACTER*80 SNAME

X=COORDS(1)
Y=COORDS(2)
Z=COORDS(3)

Dist = 0.0
Y_center = 0.0 - ((0.1/100.0)*(TIME(2)))
X_center = 0.0
YT=Y_center - Y
XT=X_center - X

Dist = SQRT((YT*YT)+(XT*XT))

if (Dist .le. 0.01) then
FLUX(1) = 50000.0
else
FLUX(1) = 0.0
endif

RETURN
END

 

It is a pretty simple subroutine and it includes a heat flux travelling down the centre of the workpiece. I got the code from Not Real Engineering.

The work piece I want to get the laser moving across is 0.04mx0.04m and the laser needs to travel at a couple of different speeds The fastest speed is 0.0083m/s and the slowest 0.000167m/s. Any advice would be greatly appreciated. I am extremely new to programming but this is for my MSc(Res) thesis so it is pretty important to me.

 

Thanks

 

Alex

0 Kudos
10 Replies
JohnNichols
Valued Contributor III
2,383 Views

You should use implicit none, so you must assign as reals and integers each type. 

Write a test main program that loops through the DFLUX subroutine and make sure what is going in is correct and out is also correct

I would write the output to a csv file using comma delineated output and then plot the output, does it look correct. 

I have been working on such a problem at the moment in thermal vibration,  it is a poor example, but it shows you the key elements. 

0 Kudos
JohnNichols
Valued Contributor III
2,381 Views

If you have not taken a Fortran subject, and most of the people here took those courses in the 70's.  Then you should spend your nights reading a book on Fortran. There are many, some of them are only 50 pages and any Uni library has them. 

 

PYTHON is not Fortran. 

This lot are not sage on a stage types, they will help after you make an honest effort. 

Good luck. 

JMN

0 Kudos
Alex22
Beginner
2,368 Views

Thanks,

 

I am completely new to all programming so this is way above my paygrade. But I will find a book.

 

Alex

0 Kudos
mecej4
Honored Contributor III
2,356 Views

The code that you showed gets compiled without errors if the INCLUDE line is removed, but that is of little comfort.

Few of us in this forum use Abaqus, which you did not even mention, and we cannot tell you whether the code, after being used to produce a DLL, models your physical problem correctly.

0 Kudos
Alex22
Beginner
2,350 Views

Yes the code works I have run it in Abaqus and it simulates a heat source moving through the medium in just the y direction from the origin (0,0) over 100 seconds. I need to make it do more than it is currently doing. The thing I need to wrap my head around is how the coordinate can describe the motion pictured. However I am completely unsure of how to do this. The dimensions of the medium and the focal point of the heat source will also need to be different.

0 Kudos
JohnNichols
Valued Contributor III
2,343 Views

1. Read the book first, it will make Fortran make sense.  honest. 

2. Provide a sketch of what you are trying to do  and define the variables in the sketch - that will help us make sense.  

3. A picture is worth a 1000 words. 

4. Borrowing other people's code can make it challenging, develop the algorithm in plain language first.  

0 Kudos
JohnNichols
Valued Contributor III
2,343 Views

Do a search on Conte and deBoore, this is an old but good Fortran numerical analysis book you can get as a pdf from a Uni site and I would spend 6 hours on a couch and read it -- it is old, but it will show you the ideas. 

0 Kudos
Alex22
Beginner
2,341 Views

I have just ordered the book called "Schaum's Outline for programming with Fortran77" Which arrives tomorrow.

0 Kudos
JohnNichols
Valued Contributor III
2,335 Views

Perfect, I would get the Conte and de Boore it is free - I like free

0 Kudos
Alex22
Beginner
2,329 Views

Would that be the book called Elementary Numerical Analysis: An Algorithmic Approach?

0 Kudos
Reply