个人工具

“UbuntuHelp:OpenFOAM/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第241行: 第241行:
 
=== Getting started with OpenFOAM 开始 OpenFOAM 之旅 ===
 
=== Getting started with OpenFOAM 开始 OpenFOAM 之旅 ===
  
Library documentation is included in
+
Library documentation is included in&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''库文档位于'''<br>
 +
<pre>~/OpenFOAM/OpenFOAM-1.3/doc/Guides-a4
 +
</pre>
 +
you will find there some PDFs with tutorials and very useful examples, after a short reading you can start modelling right away.
  
<pre><nowiki>
+
'''在这里你会找到若干教程和实例的PDF文件,简单阅读后你就能开始立即建模了'''
~/OpenFOAM/OpenFOAM-1.3/doc/Guides-a4
+
</nowiki></pre>
+
 
+
you will find there some PDFs with tutorials and very useful examples, after a short reading you can start modelling right away.
+
  
 
=== Troubleshooting 常见问题 ===
 
=== Troubleshooting 常见问题 ===

2008年1月11日 (五) 20:24的版本

文章出处: http://wiki.ubuntu.org.cn/index.php?title=UbuntuHelp:OpenFOAM

翻译人员: HsChen07


编辑


How to install OpenFOAM CFD software 怎样安装OpenFOAM计算流体力学软件

Introduction 简介

This HowTo is aimed to all Engineers, Scientist, Students interested in learning/applying/experimenting Computational Fluids Dynamics (CFD)【本教程为那些对学习、应用、实验计算流体动力学(CFD)感兴趣的工程师、科学家和学生而创作】, CFD uses numerical approximation to the partial differential equations that govern flow of fluids in nature (i.e. Navier-Stokes equation, etc) the solution of the Navier-Stokes equation once it comply with the requirements of the Continuity equation gives the behavior of the fluids subject to the given boundary and initial conditions.【CFD采用数值逼近方法来求解控制自然流动的偏微分方程(如Navier-Stokes等),只要满足Navier-Stokes方程的连续性方程,就能求解出服从指定和初始条件下的流动现象】 This has a tremendous importance since practically any fluid can be simulated/modelled in a computer before doing any 'real life' experiment. 【这在实践中有着极大的重要性,任何流体现象在进行真实试验之前都可以在计算机上进行模拟/建模】For example you can test the design of a new aircraft using computational techniques before even build a small scale prototype for wind tunnel testing. 【例如,在进行缩尺样机风洞测试之前,你可以通过计算模拟技术来验证一个新的飞机设计方案】Thus a wide range of experimental conditions can be fully tested and corrected on the fly...【因而可以在实验中对各种飞行状态进行全面的测试和校正】 Since the basic equations (full) that govern fluid flow are in form of PDEs, the numerical methods to approximate the solution are complex, a very simple problem can be solved in a couple of minutes however if the problem is much more complicated the solver can take days in find a solution... in general CFD is not intended for common PCs but for high end computers designed to tackle this kind of problems. 【由于流动控制基本方程是偏微分方程,数值逼近求解方法非常复杂,一个简单问题的求解都需要几分钟,如果遇到更加复杂的问题,求解需要几天来得到一个结果……CFD通常不是运行在PC上的,而是专门运行在专门用于求解这类问题的高性能终端计算机上】Of course this cannot stop you, you can install this software in your computer and 'play' with simple geometries and doing a lot of assumptions to solve a given problem more easily.【当然这不是阻止你用,你可以在你的计算机上安装本软件,并求解简单的几何状态,为了求解容易做大量假设】 There are several CFD brands out there like Fluent, COMSOL, CFD-RC, CFD-ADAPCO, (which are quite expensive though) ... however there are also free alternatives like ELMER Multiphysics, OpenFOAM and many others. Inherently CFD software is a bit complicated to use, it requires a deep understanding of the physical phenomena involved in given problem, and a good mathematical background.【世界上已经存在一些CFD的商业程序如Fluent, COMSOL, CFD-RC, CFD-ADAPCO,但它们是非常昂贵的。然而,也有一些免费的选择如ELMER Multiphysics, OpenFOAM 等。使用CFD软件从来都有点复杂,需要对给定问题的物理现象有深入的理解,并有较好的数学背景】

AMD64 Systems 对于AMD64系统

If you are installing this on an AMD64 system, it is necessary to set the parameter $WM_64 to "on". To achieve this, do the following in a terminal: 如果要把它安装在 AMD64 系统上,必须把参数 $WM_64打开。在终端下按如下操作进行:

gedit ~/OpenFOAM/OpenFOAM-1.3/.bashrc

Then, I added directly above the Java section, the following: 然后,在 Java 段上面我直接添加了下面几句:

# 64 Bit Machine set to on else set to blank   64位系统设为 on, 否则留空即可
WM_64="on"

After doing so you must source your bashrc to make sure the changes take effect. 完后为了使这些变化生效,你必须把这些变化提供给 bashrc。

. ~/.bashrc

N.B. it is . space ~/... 注意这里是 .空格~/...

System requirements 系统要求

(based on the specs of the PC tested for the installation)(基于测试安装的个人电脑的配置)

  • AMD Athlon XP LV 1500+ (or equivalent or higher or better or Intel or PowerPC)AMD Athlon XP LV 1500+ (或相当及更好更高的配置,可以是Intel的或苹果的PowerPC
  • 640 MB (The web page states nothing, but everybody knows the more, the better)640MB内存(网站上未提及,大家都知道越多越好)
  • 1 GB hard drive available, this is a must, uncompressed files takes 750 MB, plus the cases, tutorials, grids, etc有1GB可用硬盘空间,这是必须的,文件解压后占用750MB,另外还要留出实例、教程、网格等的存储空间
  • Broadband conection (the compressed files are from 50 to 100 MB average) of course you can use dial up and wait 48 hours to download it, it's up to you...

  宽带连接(压缩文件平均有约50到100MB),当然也可以用拨号连接下载48小时,这取决于你……

  • Ubuntu LINUX 5.10 Breeze Badger Kernel version 2.6.12-9-386, if you download the AMD64 version then use the 64bit LINUX kernel

  Ubuntu LINUX 5.10 Breeze Badger 核心版本号是2.6.12-9-386,如果你下载的是64位(AMD64)版就用64位内核

  • Not tested on kernel versions above or below (you should try to do this if this is not yor kernel version)

  尚未在更高或更低的内核版本上测试,所以如果你的内核不是该版本,你需要试着测试一下

  • Not sure if this would work on other LINUX distributions

  不能保证它能在其他LINUX发行版上正常运行

Step by step instructions 一步一步教你安装

1 * Check system requirements (listed above) 检查系统要求(上面已列出)

2 * Enter to OpenFOAM web page 进入OpenFOAM网页

or

3 * Click on download 点击下载

4 * Select your version 选择你想要下载的版本

5 * Dowload all the packages to your Desktop (very advance LINUX users can avoid obvious steps) 把程序包下载到你的桌面(LINUX高级用户可跳过这些简单步骤)

~/Desktop

where ~/ is the home folder for example /home/<username> 其中~/就是主文件夹,如 /home/<用户名>

N.B from this point it is necesary to remenber that LINUX is CASE SENSITIVE, a mistake can delay you some hours... 注意,这里需要记住LINUX对大小写敏感,一个小小的错误就能耽搁你好几个小时

second I did install everything in my home folder which is ~/ it is the recommended option from the web site 第二,我都是在我的主文件夹~/下进行所有安装的,这是“官方”网站上建议的选择


6 * create a folder caller OpenFOAM in ~/ using mkdir 在~/下用mkdir命令建立一个叫做OpenFOAM的文件夹

copy 复制

  • OpenFOAM-1.3.General.gtgz
  • OpenFOAM-1.3.linuxGcc4DPOpt.gtgz
  • OpenFOAM-1.3.linuxGcc4SPOpt.gtgz

which are on ~/Desktop to the folder you've just created ~/OpenFOAM 它们都在~/Desktop(桌面)上,将其复制到刚刚建立的 ~/OpenFOAM下

7 * create the following folder using mkdir (remember LINUX is case sensitive) 用mkdir命令建立如下文件夹(注意LINUX对大小写敏感)

~/OpenFOAM/linux

8 * copy 复制

  • gcc-4.1.0.linux.tgz
  • paraview-2.4.2.linux.tgz
  • j2sdk1.4.2_05.linux.tgz
  • which are in ~/Desktop to ~/OpenFOAM/linux 将其从 ~/Desktop 复制到 ~/OpenFOAM/linux

9 * untar avery single file in the following order 按照下面的顺序解压各文件:

  • OpenFOAM-1.3.General.gtgz
  • OpenFOAM-1.3.linuxGcc4DPOpt.gtgz
  • OpenFOAM-1.3.linuxGcc4SPOpt.gtgz
  • gcc-4.1.0.linux.tgz
  • paraview-2.4.2.linux.tgz
  • j2sdk1.4.2_05.linux.tgz

typing 解压命令格式

tar -xzvf <filename>          tar -xzvf <文件名>

This takes a bit of time 这个过程需要一些时间

10 * after finishing you will see new directories created in ~/OpenFOAM 完后你就会在~/OpenFOAM 下看到几个新目录

11 * now look for foamSystemCheck 现在找一下foamSystemCheck which is located at 它位于

~/OpenFOAM/OpenFOAM-1.3/bin

this is a shell script that we have to execute, however we need to change it to an executable format 这是一个我们要运行的shell脚本,但首先我们得将它变成可执行的格式

type 输入

chmod -v 555 foamSystemCheck

press enter, then type 回车,然后输入

[[UbuntuHelp:export PATH=$PATH:~/OpenFOAM/OpenFOAM-1.3/bin/]]

press enter, then type 回车,再输入

foamSystemCheck

press enter 回车

At this time, the shell script will call some functions to check if your system comply with the minimum requirements for the installation, Host, username, Linux version, and Network conectivity, however at the end of the process some error occur, just ignore any warning or fatal error about ssh or rsh, this is not needed for the stand alone installation (It doesn't matter what it tells you, just ignore it!!!) 这时shell脚本将调用一些命令来检查是否满足安装的最低要求,主机、用户名、Linux 版本及网络连接等等,如果在处理的最后会报一些错,就忽略它报告的那些关于ssh或rsh的警告或致命错误,对于仅仅安装来说这没必要(不管它报告给你了什么,尽管忽略!!!)

type 输入

chmod -v 755 foamSystemCheck

press enter 回车

12 * * * * * * Now you have to set the environment variables for a correct file access, the environment variable settings are stored in 现在你须要为文件的正确读写设置环境变量,环境变量的设置存储在

~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3

since I am using the default options in UBUNTU, my shell is BASH and my text editor is gedit, you can use VIM as well 因为我在UBUNTU下用的是默认配置,我的 shell 是 BASH, 文件编辑器是 gedit, 也可以用 VIM

type 输入

echo $SHELL

(if you are not sure which shell you are using and edit the following files according to your shell syntax) (如果你不确定自己用的是哪个 shell 环境,按照你的 shell 的格式要求编辑如下文件)

now type 输入

gedit ~/.bashrc &

once in gedit type 进入 gedit 编辑环境后输入

. ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc

N.B. it is 'dot', space~/....... 注意是‘点’,空格~/....... select file>save 点 文件>保存 and then file>quit 然后点 文件>退出

now update the environment typing 现在更新环境,输入

. ~/.bashrc

N.B. it is 'dot', space ~/....... 注意是'点',空格~/.......

the environment variables are updated, you can see this if you type环境变量更新了,输入以下命令可以确认

echo $PATH

Testing the installation 测试安装是否成功

13 **** look for foamInstallationTest which it is located at    在下面的目录下找到文件foamInstallationTest

~/OpenFOAM/OpenFOAM-1.3/bin

in the same way, this file is a shell script     同样的,该文件也是一个shell脚本

type     输入

chmod -v 555 foamInstallationTest

press enter      回车

now you don't need to export the path, since you have already done it...       现在你不必输出路径了,因为它已经实现了

now type      输入

foamInstallationTest

press enter      回车

here the shell scrip verifies every directory and assigns to each of them an environment variable (PATH), also this takes a bit of time. However you will see an error at the end of the process, something like this:

这里shell脚本确定各路径并指定它们的变量(路径PATH),这个个过程也要用一定的时间。但你将会在最后看到一个错误,像这样:

test_rsh unsuccessful_conection_refused* test_ssh unsuccessful_conection_refused*

FATAL: No remote shell available (etc....)

For the stand alone version, this message is normal and you can safely ignore it, just after this OpenFOAM is ready to run

就此版本而言,这个错误是正常的,你可以安全的忽略,完后OpenFOAM就可以运行了

Getting started with OpenFOAM 开始 OpenFOAM 之旅

Library documentation is included in      库文档位于

~/OpenFOAM/OpenFOAM-1.3/doc/Guides-a4

you will find there some PDFs with tutorials and very useful examples, after a short reading you can start modelling right away.

在这里你会找到若干教程和实例的PDF文件,简单阅读后你就能开始立即建模了

Troubleshooting 常见问题

When installing this on a Dapper 64-bit system, I ran into the problem that the default JAVA_HOME, and therefore JAVA_PATH were directed to the following:

/home/<username>/OpenFOAM/<architecture>/j2sdk1.4.2_05

where there should be an OpenFOAM-1.3 directory after the OpenFOAM directory. To fix this, I opened a terminal and did the following:

gedit ~/OpenFOAM/OpenFOAM-1.3/.bashrc

Then, browse to the Java section, under the # Linux Workstation subsection, edit the export JAVA_HOME line to look like the following:

export JAVA_HOME=$WM_PROJECT_INST_DIR/OpenFOAM-1.3/$WM_ARCH/j2sdk1.4.2_05

Then save and close, and source your bashrc

. ~/.bashrc

N.B. it is . space ~/....

Acknowledgements 致谢

  • Thank you to the OpenFOAM CFD developement team for making it available under the GLP.
  • Thank you to Ubuntu Team for the great effort in this Operating System
  • Thank you for reading this wiki
  • This wiki is based in my previous Ubuntu Forum Thread ScientificUbuntu Installing OpenFOAM CFD Software
  • * * * * derjames * * * * *