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.
dimension FLUX(2), TIME(2), 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
FLUX(1) = 0.0
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.
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.
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.
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.
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.
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.