Skip to content
Snippets Groups Projects
ansys-fluent.md 6.66 KiB
Newer Older
Lukáš Krupčík's avatar
Lukáš Krupčík committed
ANSYS Fluent
Lukáš Krupčík's avatar
Lukáš Krupčík committed
============

[ANSYS Fluent](http://www.ansys.com/Products/Simulation+Technology/Fluid+Dynamics/Fluid+Dynamics+Products/ANSYS+Fluent)
Lukáš Krupčík's avatar
Lukáš Krupčík committed
software contains the broad physical modeling capabilities needed to model flow, turbulence, heat transfer, and reactions for industrial applications ranging from air flow over an aircraft wing to combustion in a furnace, from bubble columns to oil platforms, from blood flow to semiconductor manufacturing, and from clean room design to wastewater treatment plants. Special models that give the software the ability to model in-cylinder combustion, aeroacoustics, turbomachinery, and multiphase systems have served to broaden its reach.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

1. Common way to run Fluent over pbs file
-----------------------------------------
Lukáš Krupčík's avatar
Lukáš Krupčík committed
To run ANSYS Fluent in batch mode you can utilize/modify the default fluent.pbs script and execute it via the qsub command.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
#!/bin/bash
#PBS -S /bin/bash
#PBS -l nodes=2:ppn=16
#PBS -q qprod
#PBS -N $USER-Fluent-Project
#PBS -A XX-YY-ZZ

#! Mail to user when job terminate or abort
#PBS -m ae

#!change the working directory (default is home directory)
#cd <working directory> (working directory must exists)
WORK_DIR="/scratch/$USER/work"
cd $WORK_DIR

echo Running on host `hostname`
echo Time is `date`
echo Directory is `pwd`
echo This jobs runs on the following processors:
echo `cat $PBS_NODEFILE`

#### Load ansys module so that we find the cfx5solve command
module load ansys

# Use following line to specify MPI for message-passing instead
NCORES=`wc -l $PBS_NODEFILE |awk '{print $1}'`

/ansys_inc/v145/fluent/bin/fluent 3d -t$NCORES -cnf=$PBS_NODEFILE -g -i fluent.jou
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```

Lukáš Krupčík's avatar
Lukáš Krupčík committed
Header of the pbs file (above) is common and description can be find on [this site](../../resource-allocation-and-job-execution/job-submission-and-execution.md). [SVS FEM](http://www.svsfem.cz) recommends to utilize sources by keywords: nodes, ppn. These keywords allows to address directly the number of nodes (computers) and cores (ppn) which will be utilized in the job. Also the rest of code assumes such structure of allocated resources.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Working directory has to be created before sending pbs job into the queue. Input file should be in working directory or full path to input file has to be specified. Input file has to be defined by common Fluent journal file which is attached to the Fluent solver via parameter -i fluent.jou

Journal file with definition of the input geometry and boundary conditions and defined process of solution has e.g. the following structure:
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
    /file/read-case aircraft_2m.cas.gz
    /solve/init
    init
    /solve/iterate
    10
    /file/write-case-dat aircraft_2m-solution
    /exit yes
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
The appropriate dimension of the problem has to be set by parameter (2d/3d).
Lukáš Krupčík's avatar
Lukáš Krupčík committed

2. Fast way to run Fluent from command line
--------------------------------------------------------

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
fluent solver_version [FLUENT_options] -i journal_file -pbs
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```

This syntax will start the ANSYS FLUENT job under PBS Professional using the  qsub command in a batch manner. When resources are available, PBS Professional will start the job and return a job ID, usually in the form of *job_ID.hostname*. This job ID can then be used to query, control, or stop the job using standard PBS Professional commands, such as  qstat or qdel. The job will be run out of the current working directory, and all output will be written to the file fluent.o *job_ID*.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

3. Running Fluent via user's config file
----------------------------------------
Lukáš Krupčík's avatar
Lukáš Krupčík committed
The sample script uses a configuration file called pbs_fluent.conf  if no command line arguments are present. This configuration file should be present in the directory from which the jobs are submitted (which is also the directory in which the jobs are executed). The following is an example of what the content of  pbs_fluent.conf can be:
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
input="example_small.flin"
case="Small-1.65m.cas"
fluent_args="3d -pmyrinet"
outfile="fluent_test.out"
mpp="true"
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```
Lukáš Krupčík's avatar
Lukáš Krupčík committed

The following is an explanation of the parameters:

Lukáš Krupčík's avatar
Lukáš Krupčík committed
input is the name of the input file.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
case is the name of the .cas file that the input file will utilize.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
fluent_args are extra ANSYS FLUENT arguments. As shown in the previous example, you can specify the interconnect by using the  -p interconnect command. The available interconnects include ethernet (the default), myrinet, infiniband,  vendor, altix, and crayx. The MPI is selected automatically, based on the specified interconnect.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
outfile is the name of the file to which the standard output will be sent.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
 mpp="true" will tell the job script to execute the job across multiple processors.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
To run ANSYS Fluent in batch mode with user's config file you can utilize/modify the following script and execute it via the qsub command.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
#!/bin/sh
#PBS -l nodes=2:ppn=4
#PBS -1 qprod
#PBS -N $USE-Fluent-Project
#PBS -A XX-YY-ZZ

 cd $PBS_O_WORKDIR
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
 #We assume that if they didn’t specify arguments then they should use the
 #config file if [ "xx${input}${case}${mpp}${fluent_args}zz" = "xxzz" ]; then
   if [ -f pbs_fluent.conf ]; then
     . pbs_fluent.conf
   else
     printf "No command line arguments specified, "
     printf "and no configuration file found.  Exiting n"
   fi
 fi
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed

 #Augment the ANSYS FLUENT command line arguments case "$mpp" in
   true)
     #MPI job execution scenario
     num_nodes=‘cat $PBS_NODEFILE | sort -u | wc -l
     cpus=‘expr $num_nodes * $NCPUS
     #Default arguments for mpp jobs, these should be changed to suit your
     #needs.
     fluent_args="-t${cpus} $fluent_args -cnf=$PBS_NODEFILE"
     ;;
   *)
     #SMP case
     #Default arguments for smp jobs, should be adjusted to suit your
     #needs.
     fluent_args="-t$NCPUS $fluent_args"
     ;;
 esac
 #Default arguments for all jobs
 fluent_args="-ssh -g -i $input $fluent_args"

 echo "---------- Going to start a fluent job with the following settings:
 Input: $input
 Case: $case
 Output: $outfile
 Fluent arguments: $fluent_args"
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
 #run the solver
 /ansys_inc/v145/fluent/bin/fluent $fluent_args  > $outfile
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
It runs the jobs out of the directory from which they are submitted (PBS_O_WORKDIR).
Lukáš Krupčík's avatar
Lukáš Krupčík committed

4. Running Fluent in parralel
-----------------------------
Lukáš Krupčík's avatar
Lukáš Krupčík committed
Fluent could be run in parallel only under Academic Research license. To do so this ANSYS Academic Research license must be placed before ANSYS CFD license in user preferences. To make this change anslic_admin utility should be run
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
```bash
Lukáš Krupčík's avatar
Lukáš Krupčík committed
/ansys_inc/shared_les/licensing/lic_admin/anslic_admin
Lukáš Krupčík's avatar
Lukáš Krupčík committed
```
Lukáš Krupčík's avatar
Lukáš Krupčík committed

ANSLIC_ADMIN Utility will be run

Lukáš Krupčík's avatar
Lukáš Krupčík committed
![](../../../img/Fluent_Licence_1.jpg)
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
![](../../../img/Fluent_Licence_2.jpg)
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
![](../../../img/Fluent_Licence_3.jpg)
Lukáš Krupčík's avatar
Lukáš Krupčík committed

Lukáš Krupčík's avatar
Lukáš Krupčík committed
ANSYS Academic Research license should be moved up to the top of the list.
Lukáš Krupčík's avatar
Lukáš Krupčík committed

![](../../../img/Fluent_Licence_4.jpg)