Skip to content

Setting the Number of OpenMP Threads

Setting the Number of OpenMP Threads published on No Comments on Setting the Number of OpenMP Threads

Using the OpenMP* API
The OpenMP* API specification provides the following standard ways to change the desired number of threads on the coprocessor:

1. Calling the function omp_set_num_threads(n) before the omp parallel region
2. Using the clause #pragma omp parallel num_threads(n)
3. Setting the environment variable OMP_NUM_THREADS=n

Linux查找的一些实用用法

Linux查找的一些实用用法 published on No Comments on Linux查找的一些实用用法

1. 要复制OpenFOAM的case,但不复制processor*下面的结果文件

find ../ship/ -maxdepth 1 -mindepth 1| grep -v 'proc*' | xargs -I{} cp {} ./ -r

2. 找所有和dict有关的文件

find $FOAM_TUTORIALS -iname "*dict"

-iname表示大小写无关

3. 查找内容

grep -r -n LES $FOAM_SOLVERS

4. 在某些文件内查找内容

find $FOAM_TUTORIALS -name controlDict | xargs grep 'functions' -sl

intel c compiler error, catastrophic error: cannot open source file "bits/c++config.h"

intel c compiler error, catastrophic error: cannot open source file "bits/c++config.h" published on No Comments on intel c compiler error, catastrophic error: cannot open source file "bits/c++config.h"

export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/x86_64-linux-gnu/c++/4.8

使用ccm26ToFoam把Star-CCM+网格转换为OpenFOAM网格

使用ccm26ToFoam把Star-CCM+网格转换为OpenFOAM网格 published on No Comments on 使用ccm26ToFoam把Star-CCM+网格转换为OpenFOAM网格

Star-CCM+划多画体网格太牛逼了,基本不需要人工干预就可以画出极为漂亮的网格。于是开始yy能不能把这些网格用在OpenFOAM里。Star-CCM+本身提供export网格的种类很少,而且不支持ascii导出,很无语。还好OpenFOAM里面有转换工具。不过再次无语的是居然不是默认带的,需要自己编译,晕死,你们家的Star-CD的网格都有直接的工具啊。。。。。

不过还好,过程很简单,参考,https://openfoamwiki.net/index.php/Ccm26ToFoam#Installation

虽说网站上显示只支持到OF2.2,不过2.3也是一样的,没有问题。具体方法在这个网页上:http://www.cfd-online.com/Forums/openfoam-installation/124385-how-install-ccm26tofoam-of2-2-x-convert-ccm-file.html

现把过程简要列一下

1. 下载库libccmio-2.6.1,很多网页上应该都有, 搜搜就行了

2. 解压到OpenFOAM/ThirdParty-2.3.x/下

3. 编译这个库
cd /your.OpenFOAMinstallation.path.../OpenFOAM/ThirdParty-2.2.x/
./AllwmakeLibccmio

4. 可以编译ccm26ToFoam了
cd /your.OpenFOAMinstallation.path.../OpenFOAM/OpenFOAM-2.2.x/applications/utilities/mesh/conversion/Optional
./Allwmake

5. 随便找个模板,建一个空of工程

6. 可以转换了
ccm26ToFoam nameFile.ccm

 

文件(夹)权限

文件(夹)权限 published on No Comments on 文件(夹)权限

权限以三位数来表示

第一位表示文件拥有者(user),第二位表示用户组(group),第三位表示其它用户(others)

读(r): 4

写(w): 2

执行(x): 1

然后相加就可以了

比如: chmod 755 filename

+表示增加权限,-表示取消权限

比如: chmod u+x filename,将filename设为文件拥有者可执行文件

Config Lapack in VS2005/2008

Config Lapack in VS2005/2008 published on No Comments on Config Lapack in VS2005/2008

Using Lapack lib on the Internet

1. Download lib file

http://icl.cs.utk.edu/lapack-for-windows/lapack/

2. Copy it into runtime(debug) dir

3. VS, project-properties-Linker-Input

Add "lapack.lib blas.lib" in the Additional Dependencies

 

Using MKL Lapack lib

1. VS, project-properties-Linker-Input

mkl_lapack95.lib mkl_blas95.lib mkl_intel_c.lib mkl_core.lib libguide.lib

2. VS, project-properties-Fortran-Libraries

Use IMKL, Yes

 

 

Access NUS Webvpn in Ubuntu

Access NUS Webvpn in Ubuntu published on No Comments on Access NUS Webvpn in Ubuntu

1. Install the JDK&JRE environment

sudo aptitude install sun-java6-plugin sun-java6-jdk sun-java6-jre

(In Ubunt 10.10, it seems like to be OPEN-java-6-jdk(jre),

anyway it works well on my computer)

2. Get the junipernc Script 

 

wget -q -O /tmp/junipernc http://mad-scientist.net/junipernc

chmod 755 /tmp/junipernc

sudo cp /tmp/junipernc /usr/bin

 

3. Run the Script

./junipernc

4.  NUS webvpn information

Server Name:                http://webvpn.nus.edu.sg

Username:                     Your NUSNET username

VPN Service Realm:    NUSSTU or NUSSTF or NUSEXT

Reference:

http://opensource.nus.edu.sg/wiki/index.php/Connecting_to_NUS_WebVPN_using_Ubuntu

http://www.mad-scientist.net/juniper.html   

Matlab导出高分辨率图

Matlab导出高分辨率图 published on No Comments on Matlab导出高分辨率图
clear all
clc

figure
a = load('SimuD1_T3_20X40_right_rst_ss.dat');
plot(a(:,2),a(:,1),'-b','linewidth',2,'MarkerSize',10)
hold on
b = load('SimuD1_T3_20X40_free_rst_ss.dat');
plot(b(:,2),b(:,1),'-r','linewidth',2,'MarkerSize',10)
hold on

xlabel('Nominal strain','FontSize',12,'fontname','times')
ylabel('Nominal stress','FontSize',12,'fontname','times')

glegend = legend('Simulation F (without non-local term)','Simulation D1 (with non-local term)');
grid

set(glegend, 'fontsize', 12,'fontname','times')
set(gca, 'color', 'none')
set(gcf, 'color', 'none')
set(glegend, 'color', 'w')

set(gca,'fontsize',12,'fontname','times') 
set(gcf,'PaperPositionMode','auto')
set(gcf,'color','w','position',[100,100,600,400])
print(gcf,'-depsc','-r300',['E:\BMG\MG_room_temperature_explicit_2D_T3\result\stressstrain']);

Ubuntu 10.10更新源列表

Ubuntu 10.10更新源列表 published on No Comments on Ubuntu 10.10更新源列表

1.sudo cp /etc/apt/sources.list /etc/apt/sources.list.bk

sudo gedit /etc/apt/sources.list

2.sudo apt-get update 更新源列表信息

可以在运行“sudo apt-get update ”时查看一下错误信息,把不能连接的源删除再重新运行“sudo apt-get update ”。

3.sudo apt-get upgrade 升级

或者用ubuntu自带的更新管理器升级也可

Ubuntu 10.10源列表:

台湾源 

deb http://tw.archive.ubuntu.com/ubuntu/ maverick main universe restricted multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu/ maverick main universe restricted multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ maverick-security universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ maverick-security universe main multiverse restricted
deb http://tw.archive.ubuntu.com/ubuntu/ maverick-updates universe main multiverse restricted
deb-src http://tw.archive.ubuntu.com/ubuntu/ maverick-updates universe main multiverse restricted

新加坡源

deb http://download.nus.edu.sg/mirror/ubuntu maverick universe main restricted multiverse
deb-src http://download.nus.edu.sg/mirror/ubuntu maverick universe main restricted multiverse
deb http://download.nus.edu.sg/mirror/ubuntu maverick-updates universe main restricted multiverse
deb-src http://download.nus.edu.sg/mirror/ubuntu maverick-updates universe main restricted multiverse