Calling user subroutines in shared libraries

Hi,

There is a good option to call UMAT in shared libraries. It does not require any modification to CalculiX, is generally easier to set up and is very flexible. I wonder if this functionality can be used for the other subroutines like “dload.f”.

Let’s assume that it is going to define hydrostatic pressure loading on a structure. In this case, it is needed to build Calculix from the source!

I believe this is only available for the umats, not for any other user subroutine. You might be able to hack a similar mechanism for the dload as the umats, but you will need to look into the source code.

i guessed only in material is possible,

Yes, you are right.
It will be helpful if there is a similar mechanism for other subroutines.
Is there any place to request that feature?

You can email Guido directly to see if this is something he might be interested in doing. I doubt it would take priority over bug fixes and other features.

You can create an issue in the GitHub repository: Issues · Dhondtguido/CalculiX · GitHub

Thank you, @Calc_em.
I created an issue there:

Hi again,
I managed to call dload subroutine from a DLL file on Windows. I share my experience here.

First, I changed the dload.f in the src directory as shown in the following figure:

The “dload.f” calls a new subroutine “ext_dload” that is a DLL warper defined in a new source code called “ext_dload.c” as:

For building the ccx, it is needed to add “ext_dload.c” at the end of the build chain in “Makefile.inc”:
image

Here is an example of a user-defined load defined in a fortran code, MY_DLOAD.F:

Using MinGW to compile it into a DLL file: gfortran -shared -o MY_DLOAD.DLL MY_DLOAD.F and move the MY_DLOAD.DLL into the directory that contains “ccx.exe”.

Finally, it can be called in the input file as:
*dload
Internal-1_Surface-1_S6,P4NU@MY_DLOAD,1.0

5 Likes

The built can be found through the following link:

2 Likes

Well done @m_farrokh !!

1 Like

So good! Thanks for this clear and comprehensive step-through!!!

2 Likes

That looks amazing. Quick question tough - with NLGEOM, is it using the deformed coordinates or the original mesh coordinates?

2 Likes