Running FSI flap_perp example with OpenFOAM and Calculix

Hello Everyone!
The whole week of staying home due to the quarantine I happily dedicated trying to make at least the tutorial, which is presented here. My current settings are OpenFOAM 7 with appropriate adapter, Calculix 2.15 ccx and cgx with own appropriate adaptor and preCICE v2.0.1, installed from .deb package and linked to libraries. The tutorial cases which come with each of the packages run smooth according to the instructions.

The problem is that I still cannot launch the FSI simulation in Step 3 of tutorial, flap_perp with ./Allrun or subsequently doing runSolid and then runFluid and vice verse.

In case I try ./Allrun the output of Fluid.log is
./Allrun: line 58: -case: command not found
whereas this line in Allrun states following:
${Solver1} -case ${Participant1} > ${Participant1}.log 2>&1 &

and the output of Solid.log is


CalculiX Version 2.15, Copyright© 1998-2018 Guido Dhondt
CalculiX comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome to redistribute it under
certain conditions, see gpl.htm


You are using an executable made on Sa 15. Dez 15:34:34 CET 2018

In the event I apply ./Allclean and start from the scratch with ./runFluid the simulation seems going ok in terminal as it enters in loop and ends with the line
---[precice] Setting up master communication to coupling partner/s
I guess at this point it waits till the solid solver comes, so I launch ./runSolid in a separate terminal window and the last two lines of the outputs in the terminal are as follow:

 Determining the structure of the matrix:
./runSolid: line 19: 14818 Segmentation fault      (core dumped) ccx_preCICE -i Solid/flap -precice-participant Calculix

Please let me know if it is resolvable and if I can supply more info.

Best regards,
Dmytro.

I cannot reproduce this problem, but let’s try to find what could be going wrong.

The error you get:

./Allrun: line 58: -case: command not found

is triggered by:

${Solver1} -case ${Participant1} > ${Participant1}.log 2>&1 &

and essentially means that ${Solver1} (and also ${Participant1}) is empty. This is supposed to already have a value from:

Solver1=$(getApplication)

which gets the OpenFOAM application defined in the case’s system/controlDict. It should be pimpleFoam and if you replace the respective line, it should run:

- ${Solver1} -case ${Participant1} > ${Participant1}.log 2>&1 &
+ pimpleFoam -case Fluid > Fluid.log 2>&1 &

My guess is that something is wrong (i.e. different) with your shell. Do you maybe use some other shell instead of Bash? As far as I know, it also works with zsh, but maybe you are using something else.

Hello @Makis, thank You for the reply. Indeed I work with bash, for some reason the sourcing of the OpenFOAM routines after launching the Allrun file was not working. Now, the case is launching normally till the line 57 of the Allrun file, which is

${Solver2} -i ${Participant2}/flap -precice-participant Calculix > ${Participant2}.log 2>&1 &

or, in more readible terms,

ccx_preCICE -i Solid/flap -precice-participant Calculix > Solid.log 2>&1 &

After running the case until this line and than manually introducing this command in the
terminal, the response is as follow:

Segmentation fault (core dumped)

In case I try to run first ./runFluid, the terminal output last line is

---[precice] Setting up master communication to coupling partner/s

and than ./runSolid, the terminal output last 7 lines are like this:

 STEP            1

 Dynamic analysis was selected

 Newton-Raphson iterative procedure is active

 Nonlinear geometric effects are taken into account

 Decascading the MPC's

 Determining the structure of the matrix:
./runSolid: line 19: 32067 Segmentation fault      (core dumped) ccx_preCICE -i Solid/flap -precice-participant Calculix

Any thoughts?

Best regards,
Dmytro.

So, you get a segmentation fault while running the CalculiX adapter (using the flap_perp tutorial, as-is). You already said that you are using CalculiX 2.15 with the right version of the adapter.

The expected output is:

 STEP            1

 Dynamic analysis was selected

 Newton-Raphson iterative procedure is active

 Nonlinear geometric effects are taken into account

 Decascading the MPC's

 Determining the structure of the matrix:
 number of equations
 240
 number of nonzero lower triangular matrix elements
 3128

Starting FSI analysis via preCICE using the geometrically non-linear CalculiX solver...
 Using up to 1 cpu(s) for the stress calculation.

 Using up to 1 cpu(s) for the symmetric stiffness/mass contributions.

 Factoring the system of equations using the symmetric spooles solver
 Using 1 cpu for spooles.

 Using up to 1 cpu(s) for the stress calculation.

About to enter preCICE setup in Calculix with names Calculix and config.yml 
Setting up preCICE participant Calculix, using config file: config.yml
---[precice]  This is preCICE version 2.0.0

so, it looks like it breaks ?before? the first call to preCICE. Did anything go wrong during building the CalculiX adapter? Any warnings?

The adapter was built without building the Calculix instelf. The location of the adapter folder is in /usr/local/CalculiX/calculix-adapter-master and, after configuring Makefilewith correct paths, was built with sudo make. On a run there were numerous warnings of three types

Warning: ‘nnr’ may be used uninitialized in this function [-Wmaybe-uninitialized]

/usr/local/CalculiX/ccx_2.15/src/mastruct.c:42:49: warning: unused variable ‘istart’ [-Wunused-variable]

Warning: ‘multslav’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Already tried with all three types of compilers FC = mpifort OR mpif90 OR gfortran, the terminal output is more or less the same in terms of warnings, in all cases the ccx_preCICE is generated and located at /usr/bin/ccx_preCICE.

These warning could be related, but it still looks like they are originating in CalculiX itself. What compiler versions are you using? Keep also this issue in mind.

Can you run any CalculiX-only case? (not sure what you could try, but there are some examples on their website)

If you trace this down to the CalculiX adapter, could you please open an issue?

Hello @Makis, thanks for the reply.

The compiler version is provided by

$ gfortran --version

results with

GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
This compiler was used for both the CalculiX and adapter installation.
The issue, which You mention, is adopted already in the text Makefile of the adapter, do I need to change to something else?

Regarding running the case - yes, I can, majority of the test examples from the CalculiX web-site execute with no problems,for example the $ ccx_2.15 beamp provides a normal output in terminal and results coincide precisely with the example values.

After analyzing everything once again from the beginning, found that due to lack of knowledge of scripting in Ububntu, I did not implement correct adding the CalculiX adapter to the PATH, my bad! By chance found this long script, which can provide a better insight for Ubuntu beginners how to program and install things correctly. The FSI case with flap successfully finished simulation and the results look nice, will continue playing with them around. Thank you very much!!

I understand that you solved your issue (great!) but I am not sure I understand what the problem was at the end. Could you please add a few more details?

It could be useful for future readers, as well as for us, trying to improve things. :slight_smile:

The lesson is - make a proper path with proper commands for all necessary libs/bins. The short story short: I did
echo "export PATH=/usr/local/CalculiX/calculix-adapter-master/bin:$PATH>> /home/dmaslov/.bashrc
to provide a clear path for the preCICE adapter after installing it and everything worked. So the problem was that the path to generated /bin/preCICE was not correct.

The long story…
After installing the adapter there was an issue with libyaml-cpp.so.0.5 when the ccx_preCICE was called, discussed here. I decided to take a closer look at what is happening with making this lib visible, while it was not located at /usr/local/lib, as suggested in solution. After searching how to do it properly, I realized that the best way is to use another command for such cases, which are best shown in this script, instead of trying to manually add it in ~/.profile.

1 Like