Using xvfb for Flow5 software

hildogjr

New Member
Joined
May 21, 2024
Messages
1
Reaction score
0
Credits
15
I have an Ubuntu 20.04 server with only CLI (SSH) interface and trying to run Flow5. So, I am using xvfb library to emulate a physical display.

I am using the below bash script to test it. The script works fine in a computer with a physical display but, in a computer without it, the Flow5 software finishes running without a printed error in the CLI interface and without any results in the $HOME/flow5_test/Output/script_*/Aviao1/analysis/ folder.

I tried to activate the plugin's debug through the export QT_DEBUG_PLUGINS=1 but could not get any useful information in the CLI interface not flow5.log file that helped me to track the issue. Am I configuring xvfb wrong? Because xvfb-run -a ~/Downloads/flow5/flow5 --version (or --help) command works fine.

The needed data folder is attached to the thread.

Bash:
#!/bin/sh

# Define the default values of environment variables.
DOWNLOADS="$HOME/Downloads"
if [ -z "${FLOW5}" ]; then
    FLOW5="$DOWNLOADS/flow5/flow5"
fi
# Define the correct execution command for Flow5.
found_monitor=$(xrandr --listactivemonitors | grep -i 'monitor')
if [ -z "$found_monitor" ]; then
    which xvfb-run || apt install xvfb-run || sudo apt install xvfb-run  # Install the dependency.
    FLOW5_EXEC="xvfb-run -a $FLOW5"  # Add the virtual display emulation.
    if [ -z $QT_DEBUG_PLUGINS ]; then
        export QT_DEBUG_PLUGINS=1
        # export DISPLAY=':0'
        # export QML_IMPORT_TRACE=1
        # export QT_QPA_PLATFORM='offscreen'
        # export QT_QPA_PLATFORM='wayland'
    fi
else
    FLOW5_EXEC="$FLOW5"
fi
#SRC_DIR=$(cd "$(dirname "$0")/.."; pwd)
SRC_DIR=$(cd "${0%/*}"; pwd)
# Base run test to recognize Flow5 (check teh version).
$FLOW5_EXEC --version
# Define standard folders and files names.
# For libraries.
flow5_lib_folder="$SRC_DIR/data"
flow5_lib_script="$flow5_lib_folder/simulation_script.xml"
# For current test and simulation.
flow5_test_folder="$DOWNLOADS/flow5_test"
flow5_test_script="$flow5_test_folder/simulation_script.xml"
flow5_test_output="$flow5_test_folder/Output"
# Copy the project to a test folder.
rm -fr "$flow5_test_folder"
mkdir -p "$flow5_test_folder"
# cp -r `dirname "$0"`/example/. "$flow5_test_folder"
mkdir -p "$flow5_test_output"  # Simulation output folder.
# Replace the specific line of the template project to point to specific folders.
# 's|\b\(output_dir>\)[^<]*|\1teste|g'
cat "$flow5_lib_script" \
    | sed -r "s|(<output_dir>).+?(<\/)|\1$flow5_test_output\2|" \
    | sed -r "s|(<plane_definition_xml_dir>).+?(<\/)|\1$flow5_lib_folder/airplane_model\2|" \
    | sed -r "s|(<plane_analysis_xml_dir>).+?(<\/)|\1$flow5_lib_folder/analysis\2|" \
    | sed -r "s|(<foil_files_dir>).+?(<\/)|\1$flow5_lib_folder/wing_profiles/airfoils/wing\2|" \
    | sed -r "s|(<foil_polars_dir>).+?(<\/)|\1$flow5_lib_folder/wing_profiles/polars\2|" \
    | sed -r "s|(<xfoil_polars_dir>).+?(<\/)|\1$flow5_lib_folder/wing_profiles/polars\2|" \
| tee "$flow5_test_script"
# # Run a simulation test.
$FLOW5_EXEC -p -s "$flow5_test_script" -t "$flow5_test_folder/flow5.log"
# Delete the project and result in folders to not keep the cache in the system.
# rm -rf "$flow5_test_folder"
 

Attachments



Follow Linux.org

Staff online

Members online


Top