Wednesday, 30 May 2012

Python pip for package management

Unlike easy_install, pip features an uninstall command. :) I was able to install pip after python-setuptools as,
cd ~/downloads
git clone https://github.com/pypa/pip.git
cd pip/
sudo python setup.py install # root required.
This allowed a nice installation of ipython, removal of broken matplotlib, reinstallation of matplot lib including some compiling. I wonder if it plays nicely with numpy and scipy.... Ares showed,
sudo pip install scipy --upgrade
worked but that the BLAS libraries are not available. So close.... :| Also missing:
 f77blas,cblas,atlas.
Yet,
sudo pip install atlas
did work. tests failed though

system/fvSolution

From http://www.foamcfd.org/Nabla/guides/UserGuidese15.html
Equation solvers, tolerances and algorithms.

solvers {  // specify the linear solver.
   p       ICCG  1e-06 0;  // Incomplete-Cholesky preconditioned conjugate gradient for symmetric sparse matrices.   
   p       DCG   1e-06 0;  // Diagonally preconditioned conjugate gradient for symmetric sparse matrices.      
   p       AMG   1e-06 0 100;  // Algebraic multi-grid for symmetric sparse matrices.    

   U       BICCG 1e-05 0; // Incomplete-Cholesky preconditioned biconjugate gradient for asymmetric sparse matrices.   
   U       BDCG  1e-05 0; // Diagonally preconditioned biconjugate gradient for asymmetric sparse matrices.   
   U       BICCG 1e-05 0 2; // Gauss-Seidel for asymmetric sparse matrices.    


   U { solver smoothSolver; smoother GaussSeidel; tolerance 1e-06; relTol 0.01; nSweeps 1; maxIter 100; }
   k       BICCG 1e-05 0.1;

   epsilon BICCG 1e-05 0.1;
   epsilon{solver PBiCG; preconditioner DILU; tolerance 1E-9; relTol 0;}

   nuTilda BICCG 1e-05 0.1;

   R{solver PBiCG; preconditioner DILU; tolerance 1E-9; relTol 0;}

   }

Solution stops when tol or relTol are reached.  The tolerance is the difference between the lhs and rhs of the equation being solved.
 is often 0.

AMG:  Quick solution on coarse mesh; map results; second solution on fine mesh.




relaxationFactors { 
   p       0.3;
   U       0.7;
   k       0.7;
   epsilon 0.7;
   R       0.7;
   nuTilda 0.7;
   }

// ---------------------

PISO { // Pressure Implicit Split Operator
   nCorrectors 2;
   nNonOrthogonalCorrectors 0;
   }

OR

SIMPLE { // Semi-implicit method for pressure-linked equations.
   nNonOrthogonalCorrectors 0;  // I've have best residuals with 1 with structured 2D mesh; blow with 2; good with 3, 4, 5.
   }

SIMPLE makes one correction to an initial solution; PISO requires more but usually < 4.
This sets nCorrectors.  nNonOrthogonalCorrectors is used to compensate for a face not
being normal to the cell centre.
// ---------------------------

Friday, 25 May 2012

OpenFoam: ill defined primitiveEntry starting at keyword

Usually indicates the lack of a space between the keyword and the following parenthesis.

Tuesday, 22 May 2012

vnc

Server: $ sudo apt-get install tightvncserver $ vi ~/.vnc/xstartup and replace /etc/X11/Xsession & with fluxbox & then, $ tightvncserver Displays new display number. Client: $ sudo apt-get install xtightvncserverviewer $ xtightvncviewer ipaddress:1 where `1' is the display number.

Thursday, 17 May 2012

Decimating (and more) CFD results with Python

This two liner removes all time directories for times smaller than 0.1ms. It's native Python. import os, shutil d = '/home/me/CFD/tilt3D_9/p50'; a = os.listdir(d); b = [i for i in a if len(i) in [7,8] and i[0] in ['0','1','2','3','4','5','6','7','8','9']]; [shutil.rmtree(d + '/' + i) for i in b]

Wednesday, 16 May 2012

Enabling boot logging on ubuntu

Edit /etc/default/bootlogd Change BOOTLOGD_ENABLE=No to BOOTLOGD_ENABLE=yes

Friday, 4 May 2012

listing the unique login user name attempts

:$ zgrep ssh /var/log/auth*|grep "Invalid user"|cut -d ' ' -f 8|sort|uniq -c|sort -n|tail -n 17

I've got,

       1 router
       1 sido
       1 test
       1 ubuntu
       3 oracle
 2381 user

Great script, that....