openfoam linux教程,ubuntu安装OpenFOAM官网教程

本人对ubuntu操作不熟悉,也是刚接触,但是按照官网上的安装,没问题的!分享给大家!!!希望有帮助!

Ubuntu Versions

OpenFOAM and Paraview are currently available for the following

versions of Ubuntu:

12.04 LTS, codename precise

12.10, codename quantal

13.04, codename raring

13.10, codename saucy

Installation

OpenFOAM and Paraview can be simply installed using

the aptpackage

management tool. The user will need to provide superuser password

authentication when executing the following commands

with sudo

In a terminal window, add OpenFOAM to the list of repository

locations for aptto

search, by copying and

pastingthe following in

a terminal

prompt(Applications

-> Accessories ->

Terminal). VERS=$(lsb_release-cs) sudosh-c"echodebhttp://www.openfoam.org/download/ubuntu$VERSmain>/etc/apt/sources.list.d/openfoam.list"

Note

1:Line 1 stores the version name of your

Ubuntu distribution (e.g. raring)

under $VERS,

which is used in line 2

Note 2: This only

needs to be done once for a given system

Update the aptpackage

list to account for the new download repository location

sudoapt-getupdate

Install OpenFOAM (222in

the name refers to version 2.2.2): sudoapt-getinstallopenfoam222

Install Paraview (3120in

the name refers to version 3.12.0):

sudoapt-getinstallparaviewopenfoam3120

OpenFOAM-2.2.2 is now installed in

the /optdirectory

(along with and Paraview-3.12.0)

Installation Problems

Networking must be enabled in order to be able to install software

packages in Ubuntu. Installation failure due to networking problems

usually results in an error message that reports failures in

fetching archives and ends with a line like the following:

E:Unabletofetchsomearchives...

A few users have encountered an error message similar to the

following during installation (step 3)

Somepackagescouldnotbeinstalled.Thismaymeanthatyou haverequestedanimpossiblesituation... ... Thefollowinginformationmayhelptoresolvethesituation: Thefollowingpackageshaveunmetdependencies:openfoam222: Depends:cshbutitisnotinstallable Depends:libopenmpi1.3butitisnotinstallable...

The most likely cause of this error message is that

the universerepositories

are not enabled. To enable them, type the following in a terminal

window:

sudoapt-add-repositoryuniverse sudoapt-getupdate

If MPICH is installed on the system, then during user configuration

(below), the following error message might occur when sourcing

the etc/bashrcfile

in the OpenFOAM installation:

gcc:error:unrecognizedcommandlineoption'--showme:link'

The user can check whether MPICH is installed by typing the

following:

sudoupdate-alternatives--listmpi

which returns /usr/mpich/includeif

MPICH is installed. This error is caused when the

default mpiccis

MPICH, rather than OpenMPI. The simplest way to fix the problem is

to set mpiccto

OpenMPI is by running the following command in a terminal prompt:

sudoupdate-alternatives--setmpi/usr/lib/openmpi/include

The .debfiles

for different versions of Ubuntu supplied can be downloaded

directly from the following locations:

http://www.openfoam.org/download/ubuntu/dists/precise/main/binary-amd64/openfoam222_0-1_amd64.deb http://www.openfoam.org/download/ubuntu/dists/precise/main/binary-amd64/paraviewopenfoam3120_0-1_amd64.deb http://www.openfoam.org/download/ubuntu/dists/precise/main/binary-i386/openfoam222_0-1_i386.deb http://www.openfoam.org/download/ubuntu/dists/precise/main/binary-i386/paraviewopenfoam3120_0-1_i386.deb http://www.openfoam.org/download/ubuntu/dists/quantal/main/binary-amd64/openfoam222_0-1_amd64.deb http://www.openfoam.org/download/ubuntu/dists/quantal/main/binary-amd64/paraviewopenfoam3120_0-1_amd64.deb http://www.openfoam.org/download/ubuntu/dists/quantal/main/binary-i386/openfoam222_0-1_i386.deb http://www.openfoam.org/download/ubuntu/dists/quantal/main/binary-i386/paraviewopenfoam3120_0-1_i386.deb http://www.openfoam.org/download/ubuntu/dists/raring/main/binary-amd64/openfoam222_0-1_amd64.deb http://www.openfoam.org/download/ubuntu/dists/raring/main/binary-amd64/paraviewopenfoam3120_0-1_amd64.deb http://www.openfoam.org/download/ubuntu/dists/raring/main/binary-i386/openfoam222_0-1_i386.deb http://www.openfoam.org/download/ubuntu/dists/raring/main/binary-i386/paraviewopenfoam3120_0-1_i386.deb http://www.openfoam.org/download/ubuntu/dists/saucy/main/binary-amd64/openfoam222_0-1_amd64.deb http://www.openfoam.org/download/ubuntu/dists/saucy/main/binary-amd64/paraviewopenfoam3120_0-1_amd64.deb http://www.openfoam.org/download/ubuntu/dists/saucy/main/binary-i386/openfoam222_0-1_i386.deb http://www.openfoam.org/download/ubuntu/dists/saucy/main/binary-i386/paraviewopenfoam3120_0-1_i386.deb

User Configuration

In order to use the installed OpenFOAM package, complete the

following

Open the .bashrcfile

in the user’s home directory in an editor, e.g. by typing in a

terminal window (note the dot)

gedit~/.bashrc

At the bottom of that file, add the following line

(see Note1)

and save the file

source/opt/openfoam222/etc/bashrc

Open a newterminal

window (see Note 2) and

test that the icoFoam application,

from the OpenFOAM package, is working by typing

icoFoam-help

A “Usage” message should appear. Your installation and user

configuration is complete.

Note

1:If a similar line has already been added

to the user’s .bashrcfile,

e.g. for a previous version of OpenFOAM, then the line should be

deleted or, alternatively, commented out by inserting

a #at

the beginning of the line.

Note

2:If a user wishes to

execute icoFoamin

the sameterminal

window, they must first register the change to

the .bashrcfile

by typing at the terminal prompt (note the dots):

source

$HOME/.bashrc

Getting Started

Create a project directory within the $HOME/OpenFOAMdirectory

named -2.2.2(e.g. chris-2.2.2for

user chris and OpenFOAM version 2.2.2) and create a directory

named runwithin

it, e.g. by typing:

mkdir-p$FOAM_RUN

Copy

thetutorialexamples

directory in the OpenFOAM distribution to

therundirectory.

If the OpenFOAM environment variables are set correctly, then the

following command will be correct:

cp-r$FOAM_TUTORIALS$FOAM_RUN

Run

the first example case of incompressible laminar flow in a

cavity:

cd$FOAM_RUN/tutorials/incompressible/icoFoam/cavity blockMesh icoFoam paraFoam

Refer

to theOpenFOAM

User Guideto

get started.

你可能感兴趣的:(openfoam,linux教程)