CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Open Foam Version 8 Planing Hull Tutorial.

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Tobi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2021, 10:31
Default Open Foam Version 8 Planing Hull Tutorial.
  #1
New Member
 
Subodh
Join Date: Sep 2013
Location: Canada
Posts: 29
Rep Power: 13
Subodh21 is on a distinguished road
Hi,

OpenFoam Version 8 (year 2020) has a tutorial file for planing hull in multiphase RAS folder.
I am wondering if anyone had a chance to run it.

I am able to run it but when I try to investigate the codes, I am lost
and finding it difficult to understand what is actually happening.

So I am trying my luck here to see if any expert here had a chance to explore the planing hull tutorial and can give me some guidelines to what is happening
within the codes.

Thanks in advance!
Subodh21 is offline   Reply With Quote

Old   June 7, 2021, 09:21
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
What is your actual question and to which code do you refer? Do you mean the Allrun script?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 7, 2021, 09:30
Default
  #3
New Member
 
Subodh
Join Date: Sep 2013
Location: Canada
Posts: 29
Rep Power: 13
Subodh21 is on a distinguished road
Quote:
Originally Posted by Tobi View Post
What is your actual question and to which code do you refer? Do you mean the Allrun script?
Hi Tobias,
Thanks for the reply.
Yes the Allrun script, I am familiar with C++ programming
but a beginner in bash, so looking for some explanation on the
flow of Allrun script.

Thanks!
Subodh21 is offline   Reply With Quote

Old   June 7, 2021, 11:17
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hey, so I won´t say that but shame on you :P
If you are familiar with c++ the bash script should be just simple.

Code:
#!/bin/sh
Shows that it is a shell script and tells the OS to invoke the specific shell - here sh.
Code:
usage () {
    exec 1>&2
    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
    cat <<USAGE
Usage: ${0##*/} [OPTIONS]
Options:
  -i | -interface      no refinment in vertical direction of the mesh
  -l | -local          mesh with local refinment
  -h | -help           help
Ship hull simulation to demonstrate two different meshing strategies that can be
used with PLIC type schemes.
USAGE
    exit 1
}
This is a function definition. It will show the options you can use with the script such as:
Code:
~: ./Allrun -i
~: ./Allrun -l
~: ./Allrun -h
The other parts in the above code can be checked out using google or any search engine.
Code:
meshType=0

# OPTIONS
while [ "$#" -gt 0 ]
do
    case "$1" in
    -i | -interface)
        meshType=1
        break
        ;;
    -l | -local)
        meshType=2
        break
        ;;
    -h | -help)
        usage
        ;;
    -test)
        shift
        ;;
    -*)
        usage "Invalid option '$1'"
        ;;
    *)
        usage "Invalid option '$1'"
        break
        ;;
    esac
done
Here we define a variable named meshType and loop through a while loop if you added a parameter to the script, e.g., Allrun -i or Allrun -l. If you call Allrun -h you will call the usage function. If you call any other non-sense such as Allrun -foobar or Allrun noneSense you call the usage function while sending the parameter $1. The $1 includes the parameter you added to the Allrun script call. This parameter is used in the function usage later on (if needed). If you just call ./Allrun (without parameter) the meshType has the value zero.

Code:
# Run from this directory
cd "${0%/*}" || exit 1

# Source tutorial run functions
. "$WM_PROJECT_DIR/bin/tools/RunFunctions"
Should be obvious with the two comments
Code:
if [ $meshType -eq 0 ] || [ $meshType -eq 1 ]; then
{
    ./Allmesh.1
}
elif [$meshType -eq 2 ]; then
{
    ./Allmesh.2
}
fi
Depending which input you specified, you execute either the first or second script for meshing. The rest is just calling OpenFOAM applications:

Code:
runApplication setFields

runApplication decomposePar

runParallel $(getApplication)

runApplication reconstructPar
$(getApplication) is defined in the RunFunctions script we load in prior. However, you question is not related to OpenFOAM at all and is just a bash scripting question - was not expecting people who say
Quote:
I am familiar with C++ programming
ask such questions - okay. bash is sometimes a bit wired to read but, hey, you seem to be a programmer so its common that things look strange


Hope this was enough information and I was just kidding with the shame on you sentence
__________________
Keep foaming,
Tobias Holzmann

Last edited by Tobi; June 8, 2021 at 15:30.
Tobi is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 04:50
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 18:22
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
Trouble compiling utilities using source-built OpenFOAM Artur OpenFOAM Programming & Development 14 October 29, 2013 11:59
OpenFOAM 1.6.x - CentOS 5.3 x86_64 linnemann OpenFOAM Installation 68 April 22, 2013 12:03


All times are GMT -4. The time now is 00:59.