Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doku:cfd [2021/07/16 08:23]
sfrank [Job script]
doku:cfd [2023/12/23 09:58] (current)
amelic
Line 1: Line 1:
-====== Computational Fluid Dynamics ======+====== Engineering codes with Graphical User Interface ====== 
 + 
 +<html><b><font color=#cc3300>read here &#8611;</b></font></html> [[https://colab.tuwien.ac.at/display/IAVSC/CAE+Software|how to start the GUI of your CAE software]]
  
   * [[https://www.3ds.com/de/produkte-und-services/simulia/produkte/abaqus/|Simulia ABAQUS]],    * [[https://www.3ds.com/de/produkte-und-services/simulia/produkte/abaqus/|Simulia ABAQUS]], 
   * [[https://www.ansys.com/products/fluids/ansys-fluent|ANSYS CFD]],    * [[https://www.ansys.com/products/fluids/ansys-fluent|ANSYS CFD]], 
   * [[https://www.openfoam.com|OpenFOAM]]   * [[https://www.openfoam.com|OpenFOAM]]
- +  [[https://www.comsol.de/|COMSOL]] 
-====== ANSYS-Fluent (CFD) ====== +Please be mindful that not every research institution (e.g. universitieshas licenses for the respective software packagesPlease check whether each package (ComsolAnsysOpenFOAM,...is accessible for your research institution.
- +
-===== Module ===== +
- +
-Check available versions of Ansys: +
- +
-<code> +
-module avail 2>&1 | grep -i Ansys +
-</code> +
-Load the correct version of Ansys, e.g., +
- +
-<code> +
-module load *your preferred module* +
-</code> +
- +
-available modules on VSC-4: +
-  * ANSYS/2019R3 +
-  * ANSYS/2020R2 +
-  * ANSYS/2021R1 +
- +
----- +
- +
-===== General Workflow ===== +
- +
-The subsequent figure shows an overview of the general workflow if you use Fluent on your local machine for Pre- and Postprocessing and the cluster for solving your case, respectively.\\ For this workflow a graphical connection isn't necessary. +
- +
-All files needed for this testcase are provided here: +
-{{ :doku:fluent_testcase.zip |}} +
- +
-{{ :doku:fluent_workflow.png?nolink |}} +
- +
- +
-===== Input file ===== +
- +
-Create a journal file (fluent.jou) which is written in a dialect of Lisp called Scheme and contains all the instructions that are to be executed during the run. A basic form of this file, is as follows: +
- +
-<code> +
-# ----------------------------------------------------------- +
-# SAMPLE JOURNAL FILE +
-+
-# read case file (*.cas.gz) that had previously been prepared +
-file/read-case "tubench1p4b.cas.gz" +
-file/autosave/data-frequency 10 +
-solve/init/initialize-flow +
-solve/iterate 500 +
-file/write-data "tubench1p4b.dat.gz" +
-exit yes +
-</code> +
-The ''%%autosave/data-frequency%%'' setting will save a *.dat file every 10 iterations.\\ But preferably do this settings in the GUI as shown in subsequent graphic. +
- +
-{{ :doku:autosave_gui_bearb.png?nolink |}} +
- +
-Keep in mind to set the appropriate path for the cluster. Here the files will be saved in the same directory as the journal file is located. It could be better for the sake of clarity to create a additional directory for this backupfiles, i.e. <code>./Autosave/*your_filename*.gz</code> +
- +
----- +
- +
- +
-===== Job script ===== +
- +
-A script for running Ansys/Fluent called fluent_run.sh is shown below. +
- +
-<code> +
-#!/bin/sh +
-#SBATCH -J fluent +
-#SBATCH -N 2 +
-#SBATCH -o job.%j.out +
-#SBATCH --ntasks-per-node=24 +
-#SBATCH --threads-per-core=1 +
-#SBATCH --time=04:00:00 +
- +
-module purge +
-module load *your preferred module* +
- +
-JOURNALFILE=fluent.jou +
- +
-if [ $SLURM_NNODES -eq 1 ]; then +
-    # Single node with shared memory +
-    fluent 3ddp --t $SLURM_NTASKS -i $JOURNALFILE > fluent.log  +
-else +
-    # Multi-node +
-    fluent 3ddp  \                # call fluent with 3D double precision solver +
-    -g \                          # run without GUI +
-    -slurm -t $SLURM_NTASKS \     # run via SLURM with NTASKS +
-    -pinfiniband \                # use Infiniband interconnect +
-    -mpi=openmpi \                # use IntelMPI +
-    -i $JOURNALFILE > fluent.log  # input file +
-fi +
- +
-</code> +
- +
-This job script allows a variable definition of desired configuration. You can manipulate the number of compute nodes very easily and the job script generates the appropriate command to start the calculation with Fluent. +
- +
----- +
- +
-===== License server settings ===== +
- +
-These variables are defined when loading the fluent module file: +
- +
-<code> +
-setenv       ANSYSLI_SERVERS 2325@LICENSE.SERVER +
-setenv       ANSYSLMD_LICENSE_FILE 1055@LICENSE.SERVER +
-</code> +
- +
----- +
- +
-===== Submit job ===== +
- +
-<code> +
-sbatch fluent_run.sh +
-</code> +
- +
----- +
- +
-===== Restarting a calculation ===== +
- +
-To restart a fluent job, you can read in the latest data file: +
- +
-<code> +
-# read case file (*.cas.gzthat had previously been prepared +
-file/read-case "MyCaseFile.cas.gz" +
-file/read-data "MyCase_-1-00050.dat.gz"   # read latest data file and continue calculation +
-solve/init/initialize-flow +
-solve/iterate 500 +
-file/write-data "MyCase.dat.gz" +
-exit yes +
-</code> +
- +
----- +
- +
-====== ABAQUS ====== +
- +
-===== ABAQUS 2016 ===== +
- +
-==== Sample job script ==== +
- +
-''%%/opt/ohpc/pub/examples/slurm/mul/abaqus%%'' +
- +
-<code> +
-#!/bin/bash +
-+
-#SBATCH -J abaqus +
-#SBATCH -N 2 +
-#SBATCH -o job.%j.out +
-#SBATCH -p E5-2690v4 +
-#SBATCH -q E5-2690v4-batch +
-#SBATCH --ntasks-per-node=8 +
-#SBATCH --mem=16G +
- +
-module purge +
-module load Abaqus/2016 +
- +
-export LM_LICENSE_FILE=<license_port>@license_server>:$LM_LICENSE_FILE +
- +
-# specify some variables: +
-JOBNAME=My_job_name +
-INPUT=My_Abaqus_input.inp +
-SCRATCHDIR="/scratch" +
- +
-# MODE can be 'mpi' or 'threads': +
-#MODE="threads" +
-MODE="mpi" +
- +
-scontrol show hostname $SLURM_NODELIST | paste -d -s > hostlist +
-cpu=`expr $SLURM_NTASKS / $SLURM_JOB_NUM_NODES` +
-echo $cpu +
- +
-mp_host_list="(" +
-for i in $(cat hostlist) +
-do +
-  mp_host_list="${mp_host_list}('$i',$cpu)," +
-done +
- +
-mp_host_list=`echo ${mp_host_list} | sed -e "s/,$/,)/"+
- +
-echo "mp_host_list=${mp_host_list}" >> abaqus_v6.env +
- +
-abaqus interactive job=$JOBNAME cpus=$SLURM_NTASKS mp_mode=$MODE scratch=$SCRATCHDIR input=$INPUT +
-</code> +
- +
- +
----- +
- +
-===== ABAQUS 2016 ===== +
- +
-==== Checkpointing and restart ==== +
- +
-Users sometimes find that their jobs take longer than the maximaum runtime permitted by the scheduler to completeProviding that your model does not automatically re-mesh (for exampleafter a fracture)you may be able to make use of Abaqus’ built-in checkpointing function. +
- +
-This will create a restart file (.res file extension) from which a job that is killed can be restarted. +
- +
-  - Activate the restart feature by adding the line: +
- +
-<code> +
-*restartwrite +
-</code> +
-at the top of your input file and run your job as normalIt should produce a restart file with a .res file extension. +
- +
-<HTML><ol start="2" style="list-style-type: decimal;"></HTML> +
-<HTML><li></HTML>Run the restart analysis with<HTML></li></HTML><HTML></ol></HTML> +
- +
-<code> +
-abaqus job=jobName oldjob=oldjobName ... +
-</code> +
-where oldJobName is the initial input file and newJobName is a file which contains only the line: +
- +
-<code> +
-*restart, read +
-</code> +
- +
- +
----- +
- +
-===== ABAQUS 2016 ===== +
- +
-==== Checkpointing and restart ==== +
- +
-Example: +
- +
-INPUT: [[examples/ABAQUS/dynam.inp|dynam.inp]] +
- +
-JOB SCRIPT: [[examples/ABAQUS/job.sh|job.sh]] +
- +
-INPUT FOR RESTART: [[examples/ABAQUS/dynamr.inp|dynamr.inp]] +
- +
- +
----- +
- +
-====== COMSOL ====== +
- +
-===== Module ===== +
- +
-Available version of Comsol can be found by executing the following line: +
- +
-<code> +
-module avail 2>&1 | grep -i comsol +
-</code> +
-Currently these versions can be loaded: +
-  * Comsol/5.5 +
-  * Comsol/5.6 +
- +
-<code> +
-module load *your preferred module* +
-</code> +
- +
----- +
- +
-===== Workflow ===== +
- +
-In general you define your complete case on your local machine and save it as *.mph file.\\ These file contains all necessary information to run a successfull calculation. +
- +
----- +
- +
-===== Job script ===== +
- +
-An example of a Job script is shown below. +
- +
-<code> +
-#!/bin/bash +
-# slurmsubmit.sh +
- +
-#SBATCH --nodes=1 +
-#SBATCH --ntasks-per-node=24 +
-#SBATCH --job-name="sphere" +
-#SBATCH --partition=mem_0384 +
-#SBATCH --qos=mem_0384 +
- +
-module purge +
-module load Comsol/5.6 +
- +
-MODELTOCOMPUTE="sphere" +
-path=$(pwd) +
- +
-INPUTFILE="${path}/input/${MODELTOCOMPUTE}.mph" +
-OUTPUTFILE="${path}/output/${MODELTOCOMPUTE}_result.mph" +
-BATCHLOG="${path}/logs/${MODELTOCOMPUTE}.log" +
- +
-echo "reading the inputfile" +
-echo $INPUTFILE +
-echo "writing the resultfile to" +
-echo $OUTPUTFILE +
-echo "COMSOL logs written to" +
-echo $BATCHLOG +
-echo "and the usual slurm...out" +
- +
-# COMSOL's internal command for number of nodes -nn and so on (-np, -nnhost, ...) are deduced from SLURM +
-comsol batch -mpibootstrap slurm -inputfile ${INPUTFILE} -outputfile ${OUTPUTFILE} -batchlog ${BATCHLOG} -alivetime 15 -recover -mpidebug 10 +
-</code> +
- +
-Be sure the following folder structure is predefined:\\ +
- +
- +
-The lines below creates the necessary folders: +
- +
-<code> +
-mkdir input +
-mkdir logs +
-mkdir output +
-</code> +
- +
-This structure is only an example to ensure the clarity.+
  
  • doku/cfd.1626423805.txt.gz
  • Last modified: 2021/07/16 08:23
  • by sfrank