Search code examples
linuxcondoropenfoam

HTCondor with OpenFOAM


I'm trying to launch some calculations in OpenFOAM from HTCondor. So far, we have only one multicore server OpenFOAM ready. OpenFOAM is installed from source (not using docker) following the instructions in: https://openfoam.org/download/4-1-source/

The PROBLEM: When I submit a job in HTCondor, it is launched correctly (I see that the result files are generated) but the output files are not copied back to the machine who made the submit (on Windows).

This is my job file:

Universe = vanilla
Executable = openfoamtest.sh

process_name = openfoamtest
input = /dev/null
requirements = ( (OpSys == "LINUX") && (Machine == "master") )

output = $(process_name).job.$(Process).out 
error = $(process_name).job.$(Process).err 
log = $(process_name).job.log

should_transfer_files = YES
when_to_transfer_output = ON_EXIT_OR_EVICT
transfer_executable = true

Queue 1

openfoamtest.sh:

#!/bin/bash
# Import the OpenFOAM environment
source /etc/bashrc
export PATH=$PATH:/usr/lib64/openmpi/bin/
source /opt/OpenFOAM/OpenFOAM-4.1/etc/bashrc

cd /tmp/openfoam/pitzDaily
blockMesh
simpleFoam
zip pitzDaily.zip *

Please note that I use a condorworker user to launch the process instead of user nobody. The submit is made from a windows computer. Thank you.


Solution

  • Solved. Problem was that "cd" in my script. This moved the current working directory to another folder, which HTCondor doesn't know. Solution was to add, at the beginning:

    # This is the folder where Condor starts
    CURRENT_FOLDER=$PWD
    

    And at the end:

    # Copy back the generated file to Condor's execute folder.
    cp pitzDaily.zip $CURRENT_FOLDER