# This is a Makefile
georoot=hfvmd001
geofile=$(georoot).geo
stlfile=$(georoot)_000.stl
netgenSTL:
netgen -batchmode -geofile=$(geofile) -meshfile=$(stlfile) -meshfiletype="STL Format"
This is not a blog, but my notes and tips for research. Feel free to take any information and leave any comments or questions.
Search This Blog
Saturday, October 28, 2017
Thursday, August 17, 2017
How to add and remove path
# in ~/bin/bashfun file
# add the following line in .bashrc
# . ~/bin/bashfun
add-intel ()
{
export PATH=/opt/intel/bin/:/opt/intel/compilers_and_libraries_2017.0.098/linux/mpi/intel64/bin/:$PATH
}
rm-intel ()
{
newpath=`echo $PATH | sed -e "s/\/opt\/intel\/bin\/://" | sed -e 's/\/opt\/intel\/compilers_and_libraries_2017.0.098\/linux\/mpi\/intel64\/bin\/://' `
# echo $newpath
export PATH=$newpath
}
# add the following line in .bashrc
# . ~/bin/bashfun
add-intel ()
{
export PATH=/opt/intel/bin/:/opt/intel/compilers_and_libraries_2017.0.098/linux/mpi/intel64/bin/:$PATH
}
rm-intel ()
{
newpath=`echo $PATH | sed -e "s/\/opt\/intel\/bin\/://" | sed -e 's/\/opt\/intel\/compilers_and_libraries_2017.0.098\/linux\/mpi\/intel64\/bin\/://' `
# echo $newpath
export PATH=$newpath
}
Tuesday, February 7, 2017
How to open google chrome with incognito mode as default
- Open /usr/share/applications/google-chrome.desktop
- sudo vi /usr/share/applications/google-chrome.desktop
- Find lines beginning with Exec and change
- /usr/bin/google-chrome-stable
- to
- /usr/bin/google-chrome-stable --incognito
Saturday, October 29, 2016
How to install OpenFOAM3+ on Ubuntu 16
- Compilers (default): gcc and openmpi
- Go to home directory and make "OpenFOAM" directory
- cd
- mkdir -p OpenFOAM
- cd OpenFOAM
- Download: OpenFOAM-v3.0+.tgz HERE
- Unzip
- tar -xzf OpenFOAM-v3.0+.tgz
- cd OpenFOAM-v3.0+
- Disable graphics compiling part
- Open
- vi src/postProcessing/functionObjects/Allwmake
- Comment out the last line
- # ./graphics/Allwmake
- Open
- Take care of conflict due to flex++ version
- Open the following files
- $WM_PROJECT_DIR/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L
- $WM_PROJECT_DIR/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
- $WM_PROJECT_DIR/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
- $WM_PROJECT_DIR/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
- $WM_PROJECT_DIR/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
- Make change
- from
- #if YY_FLEX_SUBMINOR_VERSION < 34
- extern "C" int yywrap()
- #else
- int yyFlexLexer::yywrap()
- #endif
- to
- // #if YY_FLEX_SUBMINOR_VERSION < 34
- // extern "C" int yywrap()
- // #else
- int yyFlexLexer::yywrap()
- // #endif
- from
- Open the following files
- Set up compiling environment
- source OpenFOAM/OpenFOAM-v3.0+/etc/bashrc
- echo " alias of30plus='source OpenFOAM/OpenFOAM-v3.0+/etc/bashrc'" >> $HOME/.bahsrc
- Compile
- ./Allwmake
Friday, July 8, 2016
to reset KDE screen
cp -a ~/.kde/share/apps/kscreen ~/.kde/share/apps/kscreen.bak
rm -f ~/.kde/share/apps/kscreen/*
sudo update-grub
shutdown -r now
rm -f ~/.kde/share/apps/kscreen/*
sudo update-grub
shutdown -r now
Thursday, May 19, 2016
Emacs short-cut
M-x
org-emphasizeorg-mode You can make words *bold*, /italic/, _underlined_,
=verbatim=
and ~code~, and, if you must, ‘+strike-through+’. Text
in the code and verbatim string is not processed for Org mode specific
syntax, it is exported verbatim.
Wednesday, March 23, 2016
Adding latex template in Ubuntu
Make a new directory for
Class files under
/usr/share/texlive/texmf-dist/tex/latex/
BST files under
/usr/share/texlive/texmf-dist/bibtex/bst/
STY files under
/usr/share/texlive/texmf-dist/tex/latex/
Tuesday, October 6, 2015
Friday, September 18, 2015
pdfcrop with margins
http://askubuntu.com/questions/124692/command-line-tool-to-crop-pdf-files
If you wish to crop a pdf with left, top, right and bottom margins of 5, 10, 20, and 30 pt (points), then run
pdfcrop --margins '5 10 20 30' input.pdf output.pdf
in terminal. To actually crop something away, use negative values in the argument for crop. For example,
pdfcrop --margins '-50 -50 -50 -50' input.pdf output.pdf
crops 50 pts from the left, top, right, bottom (in this order).
If you run only the command
pdfcrop input, it will output a file titled input-crop.pdf with zero margins. I find this very handy when including pdf illustrations in documents.
Cropping multiple files
Unfortunately, pdfcrop cannot crop multiple files at the time. It is however easy to write a script that will crop all pdfs in the folder the script is located in.
Create a new empty file, and call it
something.sh. Open it with a text editor and insert the following:#!/bin/bash
for FILE in ./*.pdf; do
pdfcrop "${FILE}"
done
Save it, and close. Then right click the file, go to Properties > Permissions and check the field Allow executing file as program. Now close the dialog. Run the script by double clicking it and choosingRun in Terminal. And new, zero-margin cropped version of all pdfs with suffix -crop will now be printed in the folder. If you want margins or other things, you can of course just open the script and add arguments after
pdfcrop.Saturday, September 12, 2015
linear regression matlab script
function [p,Rsq] = LinearRegression (Xin,Yin)
% LinearRegression example
% x=0:1:9;
% y=3.0 * x + 7 + rand(1,length(x)) ;
% [p,Rsq] = LinearRegression (x,y) ;
% yfit = p(1)*x + p(2) ;
% plot(x,y,"o",x,yfit) ;
p = polyfit(Xin,Yin,1);
Yfit = p(1) * Xin + p(2);
Yresid = Yin - Yfit;
SSresid = sum(Yresid.^2);
SStotal = (length(Yin)-1) * var(Yin);
Rsq = 1 - SSresid/SStotal;
% LinearRegression example
% x=0:1:9;
% y=3.0 * x + 7 + rand(1,length(x)) ;
% [p,Rsq] = LinearRegression (x,y) ;
% yfit = p(1)*x + p(2) ;
% plot(x,y,"o",x,yfit) ;
p = polyfit(Xin,Yin,1);
Yfit = p(1) * Xin + p(2);
Yresid = Yin - Yfit;
SSresid = sum(Yresid.^2);
SStotal = (length(Yin)-1) * var(Yin);
Rsq = 1 - SSresid/SStotal;
Wednesday, September 9, 2015
lyx shortcuts
https://pepebioinformatics.wordpress.com/2014/03/06/lyx-keyboard-shortcuts/
LyX Keyboard Shortcuts
- ⇧ + ⌘ + L -> Insert Label (label-insert);
- ⌘ + L -> Insert ERT (ert-insert);
- ⇧ + ⌘ + G -> Insert Graphic (dialog-show-new-inset graphics);
- ⇧ + ⌘ + FF -> Insert FloatFigure (float-insert figure);
- ⇧ + ⌘ + FT -> Insert FloatTable (float-insert table);
- ⇧ + ⌘ + P -> Typewriter font;
- ⇧ + ⌘ + C -> Insert Cross-reference (dialog-show-new-inset ref);
- ^ + A + [C, L or R] -> paragraph-params \align Center, Left or Right;
- ⌘ + E -> Italic (font-emph);
- ⌘ + B -> Bold (font-bold);
- ⌘ + M -> Insert Math (math-mode);
- ⌘ + ⇧ + R -> Refresh Run
- ⌘ + R -> Run
- ^ + P + [*] + [234]; layout [without numbers] [S/SubS/SubSubS]
Thursday, August 20, 2015
Netgen on Mac
Netgen installation on Mac is hopeless.
It is better to use Ubuntu virtual machine or Windows laptop.
It is better to use Ubuntu virtual machine or Windows laptop.
Tuesday, August 18, 2015
Netgen command line approach
This works for version 4.9 but does not for 5.3.1 (only GUI mode).
$ netgen -batchmode -geofile=cone.geo -meshfile=cone.ng -coarse
$ netgen -batchmode -geofile=cone.geo -meshfile=cone.ngn -meshfiletype="Neutral Format"
The possible mesh size options are
-verycoarse
-coarse
-moderate
-fine
-veryfine
$ netgen -batchmode -geofile=cone.geo -meshfile=cone.ng -coarse
$ netgen -batchmode -geofile=cone.geo -meshfile=cone.ngn -meshfiletype="Neutral Format"
-verycoarse
-coarse
-moderate
-fine
-veryfine
Wednesday, July 29, 2015
Compilation with NETGEN Ubuntu 14.04
Compilation with NETGEN Ubuntu 14.04
http://forum.freecadweb.org/viewtopic.php?t=6702
=== Mon Aug 17 22:47:36 HST 2015
OpenGL library is located in /usr/lib/x86_64-linux-gnu/
The netgen compilation did not give any error after installing libxmu-dev library. This will also install Togl1.7 library so that no separate installation of Togl 1.7 is necessary.
$ apt-get install libxmu-dev
After installation, execution of 'netgen' in ng directory gave:
symbol lookup error: /usr/lib/libTogl.so: undefined symbol: tkStubsPtr
-ltcl8.6 -ltk8.6 -ltkstub8.5
=== Mon Aug 17 10:00:36 HST 2015 ===
The next error came out of 'netgen' compiling. Togl cannot call XmuLookupStandardColormap function in OpenGL, which need to be fixed.
### error message ###
/bin/bash ../libtool --tag=CXX --mode=link g++ -g -O2 -fopenmp -export-dynamic -o netgen demoview.o ngappinit.o onetcl.o parallelfunc.o ngpkg.o ../libsrc/visualization/libvisual.la ../libsrc/csg/libcsgvis.la ../libsrc/csg/libcsg.la ../libsrc/interface/libinterface.la ../libsrc/meshing/libmesh.la -L/usr/lib/Togl1.7 -lTogl -lGLU -L/usr/lib/x86_64-linux-gnu -ltk8.6 -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -lGL -lXmu -lX11
libtool: link: g++ -g -O2 -fopenmp -o .libs/netgen \
demoview.o ngappinit.o onetcl.o parallelfunc.o ngpkg.o \
-Wl,--export-dynamic \
../libsrc/visualization/.libs/libvisual.a \
../libsrc/csg/.libs/libcsgvis.so \
../libsrc/csg/.libs/libcsg.so \
../libsrc/interface/.libs/libinterface.so \
../libsrc/meshing/.libs/libmesh.so \
-L/usr/lib/Togl1.7 -lTogl -lGLU \
-L/usr/lib/x86_64-linux-gnu -ltk8.6 -ltcl8.6 -lGL -lXmu -lX11 \
-fopenmp -Wl,-rpath -Wl,/opt/netgen/lib
/usr/lib/Togl1.7/libTogl.so: undefined reference to `XmuLookupStandardColormap'
collect2: error: ld returned 1 exit status
make: *** [netgen] Error 1
=== Sun Aug 16 23:37:50 HST 2015
Difficulties of compiling netgen source package is purely from Togl library.
In "configure" file of netgen, Togl version is specified as 1.7, but it does require functions included in Togl 2.0.
To overcome this issue, install Togl1.7 in
/opt/Togl1.7
make a link to it in /usr/lib
$ cd /usr/lib
ln -s /opt/Togl-1.7 /usr/lib/Togl1.7
Go do /opt/Togl-1.7 and make a link of Togl library:
$ ln -s libTogl1.7.so libTogl.so
Then the next is OpenGL:
http://xed.ch/help/opengl.html#check
Tuesday, October 28, 2014
How to directly launch Lyx on Mac
This tip is originally to work around the bug of Mac Yosemite that BASH environment is not inherited to child applications.
In terminal, type and enter
In terminal, type and enter
$ /Applications/LyX.app/Contents/MacOS/lyx &
If necessary, reconfigure and restart.
Tuesday, May 6, 2014
Compiliing openmpi using Intel compiler
# Download the source code from http://www.open-mpi.org/software/
# configuring
./configure --prefix=/opt/openmpi-1.8.1-Intel CC=icc CXX=icpc F77=ifort FC=ifort
# parallel make using 4 cores
make -j 4 all
# installation with sudo permission
sudo bash
make install
# "sudo make install" does not work due to environment settings.
Other source: https://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-open-mpi-with-the-intel-compilers
Installation/Linux/OpenFOAM-2.3.0/Ubuntu
sudo apt-get install build-essential cmake flex bison zlib1g-dev qt4-dev-tools libqt4-dev \
gnuplot libreadline-dev libncurses-dev libxt-dev libopenmpi-dev openmpi-bin \
libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev
cd ~ mkdir OpenFOAM cd OpenFOAM wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.3.0.tgz?use_mirror=mesh" -O OpenFOAM-2.3.0.tgz wget "http://downloads.sourceforge.net/foam/ThirdParty-2.3.0.tgz?use_mirror=mesh" -O ThirdParty-2.3.0.tgz tar -xzf OpenFOAM-2.3.0.tgz tar -xzf ThirdParty-2.3.0.tgz
source $HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc WM_NCOMPPROCS=4 WM_MPLIB=SYSTEMOPENMPI
echo "alias of230='source \$HOME/OpenFOAM/OpenFOAM-2.3.0/etc/bashrc $FOAM_SETTINGS'" \
>> $HOME/.bashrc
source $HOME/.bashrc
of230
cd $WM_THIRD_PARTY_DIR # This next command will take a while... somewhere between 5 minutes to 30 minutes. ./Allwmake > make.log 2>&1 #update the shell environment wmSET $FOAM_SETTINGS
#Go into OpenFOAM's main source folder cd $WM_PROJECT_DIR # This next command will take a while... somewhere between 30 minutes to 3-6 hours. ./Allwmake > make.log 2>&1 #Run it a second time for getting a summary of the installation ./Allwmake > make.log 2>&1
cd $WM_THIRD_PARTY_DIR ./makeParaView4 -qmake $(which qmake-qt4) cd $FOAM_UTILITIES/postProcessing/graphics/PV4Readers wmSET $FOAM_SETTINGS ./Allwclean ./Allwmake
http://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-2.3.0/Ubuntu#Ubuntu_14.04
Monday, March 31, 2014
How to install openlava in Ubuntu
1) prerequisite:
sudo apt-get install python-software-properties
2) add ppa
sudo add-apt-repository ppa:cansmith/ol
3) update repository
sudo apt-get update
4) install openlava
sudo apt-get install --yes openlava
5) edit /etc/hosts: the first line
from
127.0.0.1 localhost
to
127.0.0.1 myhostname localhost
6) setup configuration
- Go to openlava directory
cd /etc/openlava/
- open openlava.sh
sudo vi openlava.sh
- change
LSF_ENVDIR=/usr/etc
to
LSF_ENVDIR=/etc/openlava
- source it
. ./openlava.sh
- add it to ~/.bashrc
echo ". /etc/openlava/openlava.sh " >> ~/.bashrc
7) check openlava status in /etc/openlava
sudo ./openlava status
the output must look like
lim pid: <>
res pid: <>
sbatchd pid: <>
lim mbatchd: <>
(without any numbers in <>)
8) start openlava
sudo ./openlava start
the output must look like
Starting daemons...
lim started
res started
sbatchd started
9) Check a couple of commands:
albertsk@heyum:openlava$ bhosts
HOST_NAME STATUS JL/U MAX NJOBS RUN SSUSP USUSP RSV
heyum ok - 8 0 0 0 0 0
albertsk@heyum:openlava$ bjobs
No unfinished job found
albertsk@heyum:~$ bhist
No matching job found
10) run the first job
- go to home directory
cd
- make a test directory
mkdir bsub
cd bsub
- edit a job file job.bsub:
#BSUB-q normal # Job queue
#BSUB-J myfirstjob # name of the job
#BSUB -o lava-%J.out
#BSUB -e lava-%J.err
hostname
pwd
ls -laF
- submit the job
bsub < job.bsub
- try following commands: bjobs, bhist, bpeek
Sunday, March 23, 2014
how to use at command with output
at -m -f myscript.sh now > test.txt 2>&1
source: http://kb.iu.edu/data/aewo.html#examples
openssl installation on Mac
1. Download openssl: openssl-1.0.1f.tar.gz
2.
./configure darwin64-x86_64-cc --prefix=/usr/local/openssl-1.0.1f
make make install
http://mac-dev-env.patrickbougie.com/openssl/
Subscribe to:
Posts (Atom)
Labels
- Academic Notes (4)
- BLAS (1)
- CEE618 (2)
- CentOS (1)
- Computation (1)
- Conferences (1)
- Cross compiling (1)
- Graphics (1)
- Hawaii Tour (2)
- Intel compiler (1)
- Just (1)
- Laptop (1)
- LaTex (22)
- Life and Humanity (8)
- Linux and Computing (107)
- LSF (1)
- Lyx (3)
- Macintosh (5)
- MPI (1)
- News (11)
- OpenFoam (1)
- OpenMPI (1)
- PBS (2)
- Software (4)
- SSH (2)
- torque (1)
- Touchpad (1)
- VMD (1)
- yum (1)