Issue with linking preCICE and MBDyn

Hello everyone,

I am trying to do an FSI with MBDyn and OpenFOAM, as part of my thesis, but I am facing an issue with coupling.

In my system, OpenFOAM 2306 was already installed and for preCICE, I installed the ‘libprecice3_3.1.2_jammy.deb’ version followed by installing the openFOAM-preCICE adapter, as explained in the preCICE ‘quickstart’ page.

The ‘quickstart’ tutorial ran without any issue, which leads me to believe that preCICE and required dependencies have been properly installed.

For the MBDyn adapter, I am using the ‘develop’ version and the default Makefile for it, is as below:

debug: all
release: all

CXXFLAGS :=	-O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_


ifeq ($(MAKECMDGOALS),debug)
	CXXFLAGS := -g3 -O0 -std=c++17 -D_DEBUG -D_GLIBCXX_DEBUG -Wall -Wno-unknown-pragmas -Wno-format
endif



MBDYN_ROOT = /usr/local/mbdyn
VTK_ROOT = /usr/include/vtk-9.1

EIGEN_ROOT = /usr/include/eigen3

PRECICE_ROOT = /usr/local/precice

XML_ROOT = /usr/include/libxml2

#include paths
PRECICE_INCLUDE	:= /usr/include #$(shell pkg-config --cflags libprecice)
INCLUDE_DIRS 	:= -I$(MBDYN_ROOT)/include -I$(VTK_ROOT) -I$(EIGEN_ROOT) -I$(XML_ROOT) -I$(PRECICE_INCLUDE)
PRECICE_LIBS	:= -L/usr/local/lib -lprecice #$(shell pkg-config --libs   libprecice)
#PRECICE_LIBS	:= -L/usr/lib64/ -lprecice #$(shell pkg-config --libs   libprecice)

#VTK_LIBS        := -L/usr/lib64 -lvtkCommonCore -lvtkCommonDataModel -lvtkFiltersGeneral \
       			    -lvtkIOXML -lvtkInteractionStyle 
VTK_LIBS        := -L/usr/lib/x86_64-linux-gnu/ -lvtkCommonCore-9.1 -lvtkCommonDataModel-9.1 -lvtkFiltersGeneral-9.1 \
       			   -lvtkIOXML-9.1 -lvtkInteractionStyle-9.1

XML_LIBS        := -lxml2

# libraries
LIBS = -L$(MBDYN_ROOT)/lib -lmbc \
       $(VTK_LIBS) \
       $(XML_LIBS) \
       $(PRECICE_LIBS)

# project directories
SRC_DIR = ./src
OBJ_DIR = ./build
DEP_DIR = ./depend

# project sources
SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))

# project dependencies
DEP_FILES:=$(patsubst $(SRC_DIR)/%.cpp,$(DEP_DIR)/%.d,$(SRC_FILES))

PROGRAM = mbdyn-esm-adapter



all: $(PROGRAM)

# phony targets
.PHONY: clean

NO_DEPS := clean

# the program build just objects to be linked to the examples
$(PROGRAM): $(OBJ_FILES)
	@echo "Program files"
	@echo $(MAKECMDGOALS)
	@echo $(SRC_FILES)
	@echo $(OBJ_FILES)
	g++ $(CXXFLAGS) -o $@ $(OBJ_FILES) $(LIBS)


# build program objects
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(DEP_DIR)/%.d
	g++ $(CXXFLAGS) $(INCLUDE_DIRS) -c -o $@ $<


# -MM dependencies excluding system deps
# -MT ovveride target dependency, otherwise it would be *.o
# -MF file to write the dependency to
$(DEP_DIR)/%.d: $(SRC_DIR)/%.cpp
	$(CXX) $(CXXFLAGS) -MM -MT $(OBJ_DIR)/$(patsubst %.cpp,%.o,$(notdir $<)) $< -MF $@
#	$(CXX) $(CXXFLAGS) -MM -MT $(patsubst $(SRC_DIR)/%,$(OBJ_DIR)/%,$(patsubst %.cpp,%.o,$<)) $< -MF $@
#	$(CXX) $(CXXFLAGS) -MM -MT '$(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$<)' $< -MF $@

# create depenency files
depend:	$(DEP_FILES)
	@echo "make dependencies"

#Don't create dependencies when we're cleaning, for instance
ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NO_DEPS))))
    #Chances are, these files don't exist.  GMake will create them and
    #clean up automatically afterwards
    -include $(DEP_FILES)
endif

CPP_FILES := $(shell find ./src -name "*.cpp")
HEADER_FILES := $(shell find ./src -name "*.h")

cppcheck:
	cppcheck --enable=all --suppress=missingIncludeSystem --inconclusive --std=c++17 --force $(CPP_FILES) $(HEADER_FILES)

# clean everything
clean:
	@echo "remove program"
	rm -f $(PROGRAM)
	@echo "remove example objects"
	rm -f $(OBJS)
	@echo "remove project objects"
	rm -f $(OBJ_FILES)
	@echo "remove dependencies"
	rm -f $(DEP_FILES)

There are two issues I am seeing here (not sure if there are more).

  1. No folder named ‘precice’ exists in the default path given in PRECICE_ROOT.

and I do not know how to locate the precice root folder (precice was installed with ‘sudo apt install’).

  1. When I try to extract the flags with the mentioned commands, I am getting an output like this:
joseph@joseph:~$ pkg-config --cflags libprecice
pkg-config --libs   libprecice

-lprecice

which do not resemble the expected output.

The generated ‘libprecice.pc’ file has the following content:

includedir=/usr/include
libdir=/usr/lib/x86_64-linux-gnu

Name: preCICE
Description: preCICE coupling library
Version: 3.1.2
URL: https://www.precice.org
Libs: -L${libdir} -lprecice
Cflags: -I${includedir}

I manually entered the paths given in the libprecice.pc file into the MBDyn adapter Makefile and it seemed to compile without any apparent issues:

joseph@joseph:~/mbdyn-esm-adapter/adapter$ make release 
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/Adapter.o src/Adapter.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynAdapter.o src/MBDynAdapter.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynAdapterRestart.o src/MBDynAdapterRestart.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynAdapterTimeStep.o src/MBDynAdapterTimeStep.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynBeamConnector.o src/MBDynBeamConnector.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynConnector.o src/MBDynConnector.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynConnectorInOut.o src/MBDynConnectorInOut.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynMapConnector.o src/MBDynMapConnector.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynNodeConnector.o src/MBDynNodeConnector.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MBDynRigidConnector.o src/MBDynRigidConnector.cpp
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -I/usr/local/mbdyn/include -I/usr/include/vtk-9.1 -I/usr/include/eigen3 -I/usr/include/libxml2 -I/usr/include  -c -o build/MovingAverage.o src/MovingAverage.cpp
Program files
release
./src/Adapter.cpp ./src/MBDynAdapter.cpp ./src/MBDynAdapterRestart.cpp ./src/MBDynAdapterTimeStep.cpp ./src/MBDynBeamConnector.cpp ./src/MBDynConnector.cpp ./src/MBDynConnectorInOut.cpp ./src/MBDynMapConnector.cpp ./src/MBDynNodeConnector.cpp ./src/MBDynRigidConnector.cpp ./src/MovingAverage.cpp
./build/Adapter.o ./build/MBDynAdapter.o ./build/MBDynAdapterRestart.o ./build/MBDynAdapterTimeStep.o ./build/MBDynBeamConnector.o ./build/MBDynConnector.o ./build/MBDynConnectorInOut.o ./build/MBDynMapConnector.o ./build/MBDynNodeConnector.o ./build/MBDynRigidConnector.o ./build/MovingAverage.o
g++ -O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_ -o mbdyn-esm-adapter ./build/Adapter.o ./build/MBDynAdapter.o ./build/MBDynAdapterRestart.o ./build/MBDynAdapterTimeStep.o ./build/MBDynBeamConnector.o ./build/MBDynConnector.o ./build/MBDynConnectorInOut.o ./build/MBDynMapConnector.o ./build/MBDynNodeConnector.o ./build/MBDynRigidConnector.o ./build/MovingAverage.o -L/usr/local/mbdyn/lib -lmbc -L/usr/lib/x86_64-linux-gnu/ -lvtkCommonCore-9.1 -lvtkCommonDataModel-9.1 -lvtkFiltersGeneral-9.1 -lvtkIOXML-9.1 -lvtkInteractionStyle-9.1 -lxml2 -L/usr/lib/x86_64-linux-gnu -lprecice

But when I try running any included example case with the adapter, it fails and gives a message similar to the following one:

joseph@joseph:~/mbdyn-esm-adapter/testcases/TurekHron/FSI/FSI1$ mbdyn-esm-adapter -f config_new.json 
Using config_new.json configuration file
[MBDyn-adapter] WARNING: using OLD definition of connector
[MBDyn-adapter] set up MAPPING connection to MBDyn
[MBDyn-adapter] finished setting up interface named flap
[MBDyn-adapter] set up DISPLACEMENT as exchange data
[MBDyn-adapter] setup base-name for VTU output: MBDyn_OF_
[MBDyn-adapter] setup name for PVD output: 00_out.pvd
[MBDyn-adapter] setup name for resultant file: resultant.txt
[MBDyn-adapter] setup ASCII format for VTU files: 1
[MBDyn-adapter] setup write output for every iteration: 0
[MBDyn-Connector] ERROR opening resultant file
[MBDyn-adapter] WARNING: defaulting to mapping without REFERENCE NODE
[MBDyn-connector] Reading mesh file: ./MBDyn/mesh/root0.dat
[MBDyn-connector] Number of points in the mesh: 182
[MBDyn-connector] Number of cells in the mesh: 90
I/O error : No such file or directory
I/O error : No such file or directory
[MBDyn-adapter] set directory for MBDyn log file...
[MBDyn-connector] Error opening log file.: No such file or directory
[MBDyn-adapter] MBDyn started with input file: ./MBDyn/map_5n_3x_11j.mbd
[MBDyn-adapter] Checking for time step parameters...
[MBDyn-adapter] NO variable time step is required
[MBDyn-adapter] Socket defined in config file.
unable to connect to peer (111: Connection refused)
[MBDyn-connector] Init NODE_SOCK_PATH:/tmp/mbdyn3.node.sock failed. Exiting...
[MBDyn-adapter] Error in MBDyn sockets for interfaces. Exiting...
Adapter not Initialized. Exiting...

I am not sure whether this is an issue of the adapter not getting properly linked with preCICE or is there something that I am missing?

Uninstalled and re-installed preCICE, but I am getting the same output.

Sorry for the long message but any help with this would be appreciated :slightly_smiling_face:

Thank you and kind regards,
Joseph

Hi @Joseph,
my apologies for the delay. I am probably the one who should give you an answer.
It looks like you managed to compile the the adapter and there are a couple of things you need to adjust. You have a couple of I/O errors, which means that the adapter is trying to write some log files in a non-existent directory. Which case are you trying to run?
Claudio

1 Like

Hi Claudio,

thanks a lot for your reply!

I am currently trying to do the Turek-Hron FSI1 case, just trying to figure out how this works to try and apply it for my own MBDyn model. Since I was thinking it was an issue of precice not getting properly linked, I tried building precice from source, installed precice at the default root path as given in the Makefile. This time the pkg-config commands did give output.

precice ‘Quickstart’ tutorial runs alright, but other precice tutorials seem to be giving an issue, as in one participant will wait for precice, while the other runs without waiting and completes its simulation. So I am wondering again whether there is any issue with precice getting linked. Should I re-install precice using the debian package (but there was the issue with the cflags and libs commands not giving proper outputs) or will continuing with the ‘built’ version be sufficient?


debug: all
release: all

CXXFLAGS :=	-O2 -g -Wall -fmessage-length=0 -Wall -std=c++17 -D_USE_VTK_


ifeq ($(MAKECMDGOALS),debug)
	CXXFLAGS := -g3 -O0 -std=c++17 -D_DEBUG -D_GLIBCXX_DEBUG -Wall -Wno-unknown-pragmas -Wno-format
endif



MBDYN_ROOT = /usr/local/mbdyn
VTK_ROOT = /usr/include/vtk-9.1

EIGEN_ROOT = /usr/include/eigen3

PRECICE_ROOT = /usr/local/precice

XML_ROOT = /usr/include/libxml2

#include paths
PRECICE_INCLUDE	:= /usr/local/precice/include #$(shell pkg-config --cflags libprecice)
INCLUDE_DIRS 	:= -I$(MBDYN_ROOT)/include -I$(VTK_ROOT) -I$(EIGEN_ROOT) -I$(XML_ROOT) -I$(PRECICE_INCLUDE)
PRECICE_LIBS	:= -L/usr/local/precice/lib -lprecice #$(shell pkg-config --libs   libprecice)
#PRECICE_LIBS	:= -L/usr/lib64/ -lprecice #$(shell pkg-config --libs   libprecice)

#VTK_LIBS        := -L/usr/lib64 -lvtkCommonCore -lvtkCommonDataModel -lvtkFiltersGeneral \
       			    -lvtkIOXML -lvtkInteractionStyle 
VTK_LIBS        := -L/usr/lib/x86_64-linux-gnu/ -lvtkCommonCore-9.1 -lvtkCommonDataModel-9.1 -lvtkFiltersGeneral-9.1 \
       			   -lvtkIOXML-9.1 -lvtkInteractionStyle-9.1

XML_LIBS        := -lxml2

# libraries
LIBS = -L$(MBDYN_ROOT)/lib -lmbc \
       $(VTK_LIBS) \
       $(XML_LIBS) \
       $(PRECICE_LIBS)

# project directories
SRC_DIR = ./src
OBJ_DIR = ./build
DEP_DIR = ./depend

# project sources
SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))

# project dependencies
DEP_FILES:=$(patsubst $(SRC_DIR)/%.cpp,$(DEP_DIR)/%.d,$(SRC_FILES))

PROGRAM = mbdyn-esm-adapter



all: $(PROGRAM)

# phony targets
.PHONY: clean

NO_DEPS := clean

# the program build just objects to be linked to the examples
$(PROGRAM): $(OBJ_FILES)
	@echo "Program files"
	@echo $(MAKECMDGOALS)
	@echo $(SRC_FILES)
	@echo $(OBJ_FILES)
	g++ $(CXXFLAGS) -o $@ $(OBJ_FILES) $(LIBS)


# build program objects
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(DEP_DIR)/%.d
	g++ $(CXXFLAGS) $(INCLUDE_DIRS) -c -o $@ $<


# -MM dependencies excluding system deps
# -MT ovveride target dependency, otherwise it would be *.o
# -MF file to write the dependency to
$(DEP_DIR)/%.d: $(SRC_DIR)/%.cpp
	$(CXX) $(CXXFLAGS) -MM -MT $(OBJ_DIR)/$(patsubst %.cpp,%.o,$(notdir $<)) $< -MF $@
#	$(CXX) $(CXXFLAGS) -MM -MT $(patsubst $(SRC_DIR)/%,$(OBJ_DIR)/%,$(patsubst %.cpp,%.o,$<)) $< -MF $@
#	$(CXX) $(CXXFLAGS) -MM -MT '$(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$<)' $< -MF $@

# create depenency files
depend:	$(DEP_FILES)
	@echo "make dependencies"

#Don't create dependencies when we're cleaning, for instance
ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NO_DEPS))))
    #Chances are, these files don't exist.  GMake will create them and
    #clean up automatically afterwards
    -include $(DEP_FILES)
endif

CPP_FILES := $(shell find ./src -name "*.cpp")
HEADER_FILES := $(shell find ./src -name "*.h")

cppcheck:
	cppcheck --enable=all --suppress=missingIncludeSystem --inconclusive --std=c++17 --force $(CPP_FILES) $(HEADER_FILES)

# clean everything
clean:
	@echo "remove program"
	rm -f $(PROGRAM)
	@echo "remove example objects"
	rm -f $(OBJS)
	@echo "remove project objects"
	rm -f $(OBJ_FILES)
	@echo "remove dependencies"
	rm -f $(DEP_FILES)

After MBDyn adapter compilation (I think I compiled it correctly, not sure), running the case again gave the same message:

joseph@joseph:~/mbdyn-esm-adapter/testcases/TurekHron/FSI/FSI1$ mbdyn-esm-adapter -f config_new.json 
Using config_new.json configuration file
[MBDyn-adapter] WARNING: using OLD definition of connector
[MBDyn-adapter] set up MAPPING connection to MBDyn
[MBDyn-adapter] finished setting up interface named flap
[MBDyn-adapter] set up DISPLACEMENT as exchange data
[MBDyn-adapter] setup base-name for VTU output: MBDyn_OF_
[MBDyn-adapter] setup name for PVD output: 00_out.pvd
[MBDyn-adapter] setup name for resultant file: resultant.txt
[MBDyn-adapter] setup ASCII format for VTU files: 1
[MBDyn-adapter] setup write output for every iteration: 0
[MBDyn-Connector] ERROR opening resultant file
[MBDyn-adapter] WARNING: defaulting to mapping without REFERENCE NODE
[MBDyn-connector] Reading mesh file: ./MBDyn/mesh/root0.dat
[MBDyn-connector] Number of points in the mesh: 182
[MBDyn-connector] Number of cells in the mesh: 90
I/O error : No such file or directory
I/O error : No such file or directory
[MBDyn-adapter] set directory for MBDyn log file...
[MBDyn-connector] Error opening log file.: No such file or directory
[MBDyn-adapter] MBDyn started with input file: ./MBDyn/map_5n_3x_11j.mbd
[MBDyn-adapter] Checking for time step parameters...
[MBDyn-adapter] NO variable time step is required
[MBDyn-adapter] Socket defined in config file.
unable to connect to peer (111: Connection refused)
[MBDyn-connector] Init NODE_SOCK_PATH:/tmp/mbdyn3.node.sock failed. Exiting...
[MBDyn-adapter] Error in MBDyn sockets for interfaces. Exiting...
Adapter not Initialized. Exiting...

Hi @Joseph
thank you for your patience. I have been working on some updates on the adapter and, unfortunately, I introduced some incompatibilities in the test cases. It looks like you were able to compile everything, so I’ 'd ask you to check out the latest develop branch, compile the adapter again and run the TH FSI cases. I have just updated the test cases and they are running on my machine. Please let me know if everything looks good on your side and if you need further assistance.
Claudio

Hi @Claudio,

Sorry for the delay in replying. I have ‘reset’ my local git branch to develop, compiled the adapter again and ran the test case again. Unfortunately, it is again giving a failed message, but the details in the message have changed a bit (from previously) as given below:

joseph@joseph:~/mbdyn-esm-adapter/testcases/TurekHron/FSI/FSI1$ mbdyn-esm-adapter -f config.json 
Using config.json configuration file
[MBDyn-adapter] WARNING: using OLD definition of connector
[MBDyn-adapter] set up MAPPING connection to MBDyn
[MBDyn-adapter] set up DISPLACEMENT as exchange data
[MBDyn-adapter] setup base-name for VTU output: MBDyn_OF_
[MBDyn-adapter] setup name for PVD output: 00_out.pvd
[MBDyn-adapter] setup name for resultant file: resultant.txt
[MBDyn-adapter] setup ASCII format for VTU files: 1
[MBDyn-adapter] setup write output for every iteration: 0
[MBDyn-adapter] WARNING: defaulting to mapping without REFERENCE NODE
[MBDyn-connector] Reading mesh file: ./MBDyn/mesh/root0.dat
[MBDyn-connector] Number of points in the mesh: 182
[MBDyn-connector] Number of cells in the mesh: 90
[MBDyn-adapter] set directory for MBDyn log file...
[MBDyn-adapter] MBDyn run failed. Exiting...
Connector not Initialized. Exiting...
[MBDyn-adapter] MBDyn started with input file: ./MBDyn/map_5n_3x_11j.mbd
[MBDyn-adapter] Checking for time step parameters...
[MBDyn-adapter] NO variable time step is required
[MBDyn-adapter] Socket defined in config file.
unable to connect to peer (111: Connection refused)
[MBDyn-connector] Init NODE_SOCK_PATH:/tmp/mbdyn3.node.sock failed. Exiting...
[MBDyn-connector] MBC Negotiate failed. Exiting....
Connector not Initialized. Exiting...

Could I be missing something?

Hi @Joseph,
it looks like you cannot open the socket to communicate with MBDyn, which is:/tmp/mbdyn3.node.sock. Can you check if you can write in that folder and delete any socket left from a previous simulation?
Claudio

Hi @Claudio,

yes, I am able to access and delete the .sock file. But running the FSI again gives the above message. I previously also had deleted the .sock file as running the .mbd file again after running it once gives the message:

joseph@joseph:~/mbdyn-esm-adapter/testcases/TurekHron/FSI/FSI1/MBDyn$ mbdyn map_5n_3x_11j.mbd 

MBDyn - MultiBody Dynamics develop
configured on Jan 29 2025 at 12:56:25

Copyright 1996-2023 (C) Paolo Mantegazza and Pierangelo Masarati,
Dipartimento di Ingegneria Aerospaziale <http://www.aero.polimi.it/>
Politecnico di Milano                   <http://www.polimi.it/>

MBDyn is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it
under certain conditions.  Use 'mbdyn --license' to see the conditions.
There is absolutely no warranty for MBDyn.  Use "mbdyn --warranty"
for details.

reading from file "map_5n_3x_11j.mbd"
Creating scalar solver with Naive linear solver
Reading Structural(1)
Reading Structural(2)
Reading Structural(3)
Reading Structural(4)
Reading Structural(5)
Reading Structural(6)
Reading Structural(7)
Reading Structural(8)
Reading Structural(9)
Reading Structural(10)
Reading Structural(11)
Reading Joint(501)
Reading Body(1002)
Reading Body(1003)
Reading Beam(101)
Reading Joint(502)
Reading Joint(503)
Reading Body(1004)
Reading Body(1005)
Reading Beam(102)
Reading Joint(504)
Reading Joint(505)
Reading Body(1006)
Reading Body(1007)
Reading Beam(103)
Reading Joint(506)
Reading Joint(507)
Reading Body(1008)
Reading Body(1009)
Reading Beam(104)
Reading Joint(508)
Reading Joint(509)
Reading Body(1010)
Reading Body(1011)
Reading Beam(105)
Reading Joint(510)
Reading Joint(511)
Reading Force(1)
UseLocalSocket("/tmp/mbdyn3.node.sock"): bind() failed (98: Address already in use)
An error occurred during the execution of MBDyn; aborting...

So I had to delete the .sock file, run the .mbd file again (un-commenting and commenting the ‘echo’ line), and then proceeded to run the config.json file, but the output is the same.

Hi @Joseph,
in order to start the FSI simulation you basically need to run, from the root folder of the case, the fluid (./runFluid) and the multibody (mbdyn-esm-adapter -f config.json). You don’t need to run MBDyn itself. The adapter starts it.
Claudio

Hi @Claudio,

I understand. So, just to be safe, I reset my local git branch again, re-compiled the adapter and deleted any previous .sock file from the /tmp folder. Without running the .mbd file, I proceeded to run the ‘runFluid’ script (runs okay) and the ‘config.json’ file again from the root folder (FSI1) with ‘mbdyn-esm-adapter -f config.json’, but the output is the same it seems:

joseph@joseph:~/mbdyn-esm-adapter/testcases/TurekHron/FSI/FSI1$ mbdyn-esm-adapter -f config.json 
Using config.json configuration file
[MBDyn-adapter] WARNING: using OLD definition of connector
[MBDyn-adapter] set up MAPPING connection to MBDyn
[MBDyn-adapter] set up DISPLACEMENT as exchange data
[MBDyn-adapter] setup base-name for VTU output: MBDyn_OF_
[MBDyn-adapter] setup name for PVD output: 00_out.pvd
[MBDyn-adapter] setup name for resultant file: resultant.txt
[MBDyn-adapter] setup ASCII format for VTU files: 1
[MBDyn-adapter] setup write output for every iteration: 0
[MBDyn-adapter] WARNING: defaulting to mapping without REFERENCE NODE
[MBDyn-connector] Reading mesh file: ./MBDyn/mesh/root0.dat
[MBDyn-connector] Number of points in the mesh: 182
[MBDyn-connector] Number of cells in the mesh: 90
[MBDyn-adapter] set directory for MBDyn log file...
[MBDyn-adapter] MBDyn run failed. Exiting...
Connector not Initialized. Exiting...
[MBDyn-adapter] MBDyn started with input file: ./MBDyn/map_5n_3x_11j.mbd
[MBDyn-adapter] Checking for time step parameters...
[MBDyn-adapter] NO variable time step is required
[MBDyn-adapter] Socket defined in config file.
unable to connect to peer (2: No such file or directory)
[MBDyn-connector] Init NODE_SOCK_PATH:/tmp/mbdyn3.node.sock failed. Exiting...
[MBDyn-connector] MBC Negotiate failed. Exiting....
Connector not Initialized. Exiting...

Also, when I was running the .mbd files previously, it had shown a message saying the non-availability of ‘klu’ solver. So, I had commented the ‘klu’ solver line and uncommented the ‘naive’ solver, only then the .mbd file had successfully run. I am not sure whether this detail holds any relevance.

Although it shows the “.sock failed” message after the current run, no .sock file is present in the /tmp folder. It was my understanding from the docs that the .mbd file is run to create the socket.

Am I required to install anything extra apart from precice? I had installed the python bindings.

Hi @Joseph,
I don’t think you should need to install anything else. The fact that you don’t have klu (I think the compilation didn’t link the suitesparse library) should not be blocking. Nevertheless, it looks like the MBDyn case does not start. In your mbd file the “echo” line should be commented. You don’t need to uncomment and comment it because it is needed only to generate the mapping files during preparation, they are already available. You should start the two parts, checking that you don’t a socket from a previous simulation. I think that ./Allclean, (run after sourcing openfoam) should remove any leftovers.
If your case does not start yet, within the MBDyn folder, you should find an “mbd” subfolder with log.mbdyn in it. Can you send it to me?
Claudio

Hi @Claudio,

I understand. No .sock file is currently there in /tmp, ran ./Allclean and the case does not start. PFA the log file.

log.tar (10 KB)

Hi,
if I run the case on my machine, before startign to couple (i.e. starting the structural part only) log.mbdyn looks like the following: log.mbdyn.txt (40.9 KB). It looks like your MBDyn case is not starting. I updated Allclean of FSI1 to remove the .sock file for you. Now it should clean everything before a new start. Please check that mbdyn is able to start when running the adapter.
Claudio

Hi @Claudio,
I am running the ./Allclean of FSI1 prior to running the adapter. Unfortunately, there is no change. Also, re-installed mbdyn since there was the issue of the klu solver, but it still persists even after re-installation. Just asking as part of troubleshooting, why do you think mbdyn is not getting started? Also, what is the difference between the mbdyn connector and adapter?
Joseph

In the end we managed to find the issue.
the mbdyn executable was not in the PATH and that prevented the adapter to find it and start the simulation.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.