Saturday, February 16, 2019

Friday, February 15, 2019

How to find empty boundary file folders in linux

find ./*/0 -type d -empty

Following: https://stackoverflow.com/questions/9417967/how-to-list-empty-folders-in-linux

Thursday, February 14, 2019

Creating Mesh for CFD

Create Mesh in Salome Meca

Export to UNV

transformPoints -scale '(0.00002955 0.00002955 0.00002955)'


Debugging recursive program with gdb Listing 5.10 in Sams Teach Yourself C in days

Debugging Listing 5.10 in Sam's Teach Yourself C++ in 21 days by Jesse Liberty with GDB. Referencing: https://www.thegeekstuff.com/2010/03/debug-c-program-using-gdb/
https://cets.seas.upenn.edu/answers/gcc.html

Output: g++ -d listing5.1.c
Output: $ gdb a.out

(gdb) break 21
Breakpoint 1 at 0x40096e: file listing5.10.c, line 21.
(gdb) run
Starting program: /home/brent/Downloads/Cpp/Debugger/a.out
Enter number to find: 5



Breakpoint 1, fib (n=5) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) print n
$1 = 5
(gdb) c
Continuing.
Processing fib(5)... Call fib(3) and fib(4).

Breakpoint 1, fib (n=3) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) print n
$2 = 3
(gdb) c
Continuing.
Processing fib(3)... Call fib(1) and fib(2).

Breakpoint 1, fib (n=1) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) print n
$3 = 1
(gdb) c
Continuing.
Processing fib(1)... Return 1!

Breakpoint 1, fib (n=2) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) c
Continuing.
Processing fib(2)... Return 1!

Breakpoint 1, fib (n=4) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) print n
$4 = 4
(gdb) c
Continuing.
Processing fib(4)... Call fib(2) and fib(3).

Breakpoint 1, fib (n=2) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) print n
$5 = 2
(gdb) c
Continuing.
Processing fib(2)... Return 1!

Breakpoint 1, fib (n=3) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) print n
$6 = 3
(gdb) c
Continuing.
Processing fib(3)... Call fib(1) and fib(2).

Breakpoint 1, fib (n=1) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) print n
$7 = 1
(gdb) c
Continuing.
Processing fib(1)... Return 1!

Breakpoint 1, fib (n=2) at listing5.10.c:24
24       std::cout << "Processing fib(" << n << ")... ";
(gdb) print n
$8 = 2
(gdb) c
Continuing.
Processing fib(2)... Return 1!
5 is the 5th Fibonacci number
[Inferior 1 (process 19913) exited normally]

Wednesday, February 6, 2019

Boundary Condition and Solver Study for OpenFoam

Interesting Source to Reference:
1Lecture 5 - Solution MethodsApplied Computational Fluid Dynamics ,
Instructor: André Bakker
http://www.bakker.org/dartmouth06/engs150/05-solv.pdf

From the OpenFoam user manual:

rhoSimpleFoam Steady-state solver for turbulent flow of compressible fluids.

rhoPimpleFoam of compressible fluids for HVAC and similar applications, with optional
mesh motion and mesh topology changes.

potentialFoam Potential flow solver which solves for the velocity potential, to calculate the
flux-field, from which the velocity field is obtained by reconstructing the flux.

simpleFoam Steady-state solver for incompressible, turbulent flow, using the SIMPLE algo-
rithm.

pisoFoam Transient solver for incompressible, turbulent flow, using the PISO algorithm.

icoFoam Transient solver for incompressible, laminar flow of Newtonian fluids.


===================================================



5.2.3.2
Entrainment boundary conditions
The combination of the totalPressure condition on pressure and pressureInletOutletVelocity
on velocity is extremely common for patches where some inflow occurs and the inlet flow
velocity is not known. That includes the atmosphere boundary in the damBreak tutorial,
inlet conditions where only pressure is known, outlets where flow reversal may occur, and
where flow in entrained, e.g. on boundaries surrounding a jet through a nozzle.
The totalPressure condition specifies
(
p 0
for outflow
p =
(5.2)
p 0 − 12 |U 2 | for inflow (incompressible, subsonic)
where the user specifies p 0 through the p0 keyword. The pressureInletOutletVelocity condition
specifies zeroGradient at all times, except on the tangential component which is set to fixed-
Value for inflow, with the tangentialVelocity defaulting to 0.

Source: http://foam.sourceforge.net/docs/Guides-a4/OpenFOAMUserGuide-A4.pdf

Compare to:
https://www.afs.enea.it/project/neptunius/docs/fluent/html/ug/node244.htm

=================================================

 https://www.openfoam.com/documentation/user-guide/standard-boundaryconditions.php
pressureDirectedInletOutletVelocity
This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is specified. A zero-gradient condtion is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the flux with the specified inlet direction
pressureDirectedInletVelocity
This velocity inlet boundary condition is applied to patches where the pressure is specified. The inflow velocity is obtained from the flux with the specified inlet direction” direction
pressureInletOutletParSlipVelocity
This velocity inlet/outlet boundary condition for pressure boundary where the pressure is specified. A zero-gradient is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the flux with the specified inlet direction
pressureInletOutletVelocity
This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the patch-face normal component of the internal-cell value
pressureInletUniformVelocity
This velocity inlet boundary condition is applied to patches where the pressure is specified. The uniform inflow velocity is obtained by averaging the flux over the patch, and then applying it in the direction normal to the patch faces
pressureInletVelocity
This velocity inlet boundary condition is applied to patches where the pressure is specified. The inflow velocity is obtained from the flux with a direction normal to the patch faces
pressureNormalInletOutletVelocity
This velocity inlet/outlet boundary condition is applied to patches where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the flux with a direction normal to the patch faces
pressurePIDControlInletVelocity
This boundary condition tries to generate an inlet velocity that maintains a specified pressure drop between two face zones downstream. The zones should fully span a duct through which all the inlet flow passes


https://cfd.direct/openfoam/user-guide/v6-turbulence/