How to run Subroutine using Gfortran and CalculiX?

I’m new to CalculiX, I was able to write a subroutine, and I compiled the subroutine using Gfortran on my windows machine. It created a .o file. But I’m not sure how to link this file to the input file. Please give me instructions on how to link my input file with .o file.

Thank you in advance.

In general, the linking process requires that the subroutine is seen by the calculix executable. I don’t remember exactly all the files, but you need to include it in:

  • Makefile.inc
  • ccx_2.21.c
  • any other subroutine that would need to access the data.

As you can see, it is not a straight-forward process. It all depends on what you are doing and modifying.

How do I link subroutine with Calculix and where do I get these files from?
If you have some examples, can you please share the files?

Thank you in advance.

From CalculiX User’s Manual:

To use a user subroutine, replace the dummy routine in the CalculiX distribution by yours (e.g. dflux.f from the distribution by the dflux.f you wrote yourself) and recompile.

The way to reference subroutine in the input file depends on its type. Check the corresponding keyword in the manual.

On windows machine, I’m not sure where I can find the dummy subroutines.

Have you seen this thread: User subroutines in Calculix using Windows ?