Import or "translate" a FORTAN code in Processing

Hi everyones,

I’m very interested with the synchronisation of globally coupled oscillators due to wonderful pattern it can make.

So, I would like to use the periodic signal of 5 oscillators and see how they synchronise they shift or recover there “natural” pattern oscillation.

The model of the research is based on kuramato model.

We can see several pattern based of kuramato model here

To do that, I think we could use a program all ready made in FORTAN.

I’m looking the best way to use theses numerical simulations of N coupled oscillation (of 5 pendulum for example, it would be enough).

In this program, synchronisation were run with and without noise to supplement and verify the analytical results.

The research is here

The program in FORTRAN is at the end of the research.

Finally, I will use the movement of each oscillator to control speed of motors by using Arduino. The 5 motors are ready to receive data from Processing. :wink:

Thanks for your attention.

1 Like

Interesting project.

Is your question: “How do I import or translate Daniels’ FORTRAN code into Processing (Java)?” …?

There is no way to “import” FORTRAN. In theory, you could use f2j to compile Fortran77 directly to java, but I don’t think this is what you want. You will probably need to read it and rewrite it.

Do you want your sketch to your produce pictures, or sound, or both?

If you want sound, have you look at the Sound library for Processing, or minim? Those are your two main options for oscillators, unless you want to write your own of course.


It looks like at least one person has achieved something similar through a mix of C and JNI. I managed to compile the paper’s example code with gfortran on macOS but… no output. Hmm.


Scratch that–it works! Change line 16 to parameter (N=50) ! number of oscillators and you should see output in a reasonable amount of time.

I am very happy that you have successfully rewritten the code.
But I do not know what the result should look like. Are these sinusoidal waves synchronizing? Or does it look like a pattern that looks like turbulence, or something else?

In my project, I would like the noise (by modulating it in a special way) to synchronize or desynchronize the speed of my motors.
And later, what will be more interesting, I wish that the simple fact that I manually modify the speed of a motor (by blocking it a little), modifies the speed of an oscillator in the algorithm, and that the algorithm recalculates data to readjust motor speed.
Will it be possible to do this with this algorithm? Later, with the data of the movements of the 5 phases of my 5 motors synchronized or not, on which I interact, I will transform these changes of speed into sound with minim library.
So, for the moment, my question is: can you adapt your code to the processing language? Can I ask you or someone else to do it, for a fee?
Thank you very much for your attention and your answers.

I didn’t analyze or visualize the model output. This is the first time I’ve looked at FORTRAN in years and it’s kinda fun. I’m game to re-implement the model in Processing and started the project here.


@bking the basic implementation is done and the output looks reasonable–let’s move the conversation to GitHub issues.

1 Like

Great, Let’s see how will I can use your program with Arduino. I have a lot of exciting idea.
I have just made a account on Github, and invite you Nick McIntyre in “my” self OrganicNation. (I’m not sure of the beauty of the name, I wanted to play with self organisation and auto organic nation).
I 'm French. Now it’s 12.00 am to me and maybe 8 pm for you, so have a good night.
My name is bvking on GitHub too.
See you there.

1 Like