OpenFOAM顶盖驱动流详解使用说明材料(中文翻译版)

合集下载

OpenFOAM用户指南-3.0.1

OpenFOAM用户指南-3.0.1

开源CFD工具箱用户指南3.0.1版2016年04月28日版权声明©2011-2015 OpenFOAM Foundation Ltd.作者:Christopher J. Greenshields, CFD Direct Ltd.译者:李东岳、田春来(第5.5.2节)、李建治(第2.3节)、周后村(第一章)本指南遵守:Creative Commons Attribution - NonCommercial NoDerivs 3.0 Unported License.LicenseTHE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.1. Definitionsa. "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement ofmusic or other alterations of a literary or artistic work, or phonogram or performanceand includes cinematographic adaptations or any other form in which the Work maybe recast, transformed, or adapted including in any form recognizably derived fromthe original, except that a work that constitutes a Collection will not be considered anAdaptation for the purpose of this License. For the avoidance of doubt, where theWork is a musical work, performance or phonogram, the synchronization of the Workin timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.b. "Collection" means a collection of literary or artistic works, such as encyclopediasand anthologies, or performances, phonograms or broadcasts, or other works orsubject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves,which together are assembled into a collective whole. A work that constitutes aCollection will not be considered an Adaptation (as defined above) for the purposes of this License.c. "Distribute" means to make available to the public the original and copies of theWork through sale or other transfer of ownership.d. "Licensor" means the individual, individuals, entity or entities that offer(s) the Workunder the terms of this License.e. "Original Author" means, in the case of a literary or artistic work, the individual,individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore;(ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case ofbroadcasts, the organization that transmits the broadcast.f. "Work" means the literary and/or artistic work offered under the terms of this Licenseincluding without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work orentertainment in dumb show; a musical composition with or without words; acinematographic work to which are assimilated works expressed by a processanalogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated worksexpressed by a process analogous to photography; a work of applied art; anillustration, map, plan, sketch or three-dimensional work relative to geography,topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considereda literary or artistic work.g. "You" means an individual or entity exercising rights under this License who has notpreviously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.h. "Publicly Perform" means to perform public recitations of the Work and tocommunicate to the public those public recitations, by any means or process,including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access theseWorks from a place and at a place individually chosen by them; to perform the Workto the public by any means or process and the communication to the public of theperformances of the Work, including by public digital performance; to broadcast andrebroadcast the Work by any means including signs, sounds or images.i. "Reproduce" means to make copies of the Work by any means including withoutlimitation by sound or visual recordings and the right of fixation and reproducingfixations of the Work, including storage of a protected performance or phonogram indigital form or other electronic medium.2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:a. to Reproduce the Work, to incorporate the Work into one or more Collections, and toReproduce the Work as incorporated in the Collections; and,b. to Distribute and Publicly Perform the Work including as incorporated in Collections.The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to 8(f), all rights not expressly granted by Licensor are hereby reserved, including but not limited to the rights set forth in Section 4(d).4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:a. You may Distribute or Publicly Perform the Work only under the terms of this License.You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer orimpose any terms on the Work that restrict the terms of this License or the ability ofthe recipient of the Work to exercise the rights granted to that recipient under theterms of the License. You may not sublicense the Work. You must keep intact allnotices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rightsgranted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested.b. You may not exercise any of the rights granted to You in Section 3 above in anymanner that is primarily intended for or directed toward commercial advantage orprivate monetary compensation. The exchange of the Work for other copyrightedworks by means of digital file-sharing or otherwise shall not be considered to beintended for or directed toward commercial advantage or private monetarycompensation, provided there is no payment of any monetary compensation inconnection with the exchange of copyrighted works.c. If You Distribute, or Publicly Perform the Work or Collections, You must, unless arequest has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonablypracticable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the othercontributing authors. For the avoidance of doubt, You may only use the creditrequired by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the OriginalAuthor, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.d. For the avoidance of doubt:i. Non-waivable Compulsory License Schemes. In those jurisdictions inwhich the right to collect royalties through any statutory or compulsorylicensing scheme cannot be waived, the Licensor reserves the exclusive rightto collect such royalties for any exercise by You of the rights granted underthis License;ii. Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensingscheme can be waived, the Licensor reserves the exclusive right to collectsuch royalties for any exercise by You of the rights granted under thisLicense if Your exercise of such rights is for a purpose or use which isotherwise than noncommercial as permitted under Section 4(b) andotherwise waives the right to collect royalties through any statutory orcompulsory licensing scheme; and,iii. Voluntary License Schemes. The Licensor reserves the right to collect royalties, whether individually or, in the event that the Licensor is a memberof a collecting society that administers voluntary licensing schemes, via thatsociety, from any exercise by You of the rights granted under this Licensethat is for a purpose or use which is otherwise than noncommercial aspermitted under Section 4(b).e. Except as otherwise agreed in writing by the Licensor or as may be otherwisepermitted by applicable law, if You Reproduce, Distribute or Publicly Perform theWork either by itself or as part of any Collections, You must not distort, mutilate,modify or take other derogatory action in relation to the Work which would beprejudicial to the Original Author's honor or reputation.5. Representations, Warranties and DisclaimerUNLESS OTHERWISE MUTUALLY AGREED BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.7. Terminationa. This License and the rights granted hereunder will terminate automatically upon anybreach by You of the terms of this License. Individuals or entities who have receivedCollections from You under this License, however, will not have their licensesterminated provided such individuals or entities remain in full compliance with thoselicenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.b. Subject to the above terms and conditions, the license granted here is perpetual (forthe duration of the applicable copyright in the Work). Notwithstanding the above,Licensor reserves the right to release the Work under different license terms or tostop distributing the Work at any time; provided, however that any such election willnot serve to withdraw this License (or any other license that has been, or is requiredto be, granted under the terms of this License), and this License will continue in fullforce and effect unless terminated as stated above.8. Miscellaneousa. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensoroffers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.b. If any provision of this License is invalid or unenforceable under applicable law, itshall not affect the validity or enforceability of the remainder of the terms of thisLicense, and without further action by the parties to this agreement, such provisionshall be reformed to the minimum extent necessary to make such provision valid and enforceable.c. No term or provision of this License shall be deemed waived and no breachconsented to unless such waiver or consent shall be in writing and signed by theparty to be charged with such waiver or consent.d. This License constitutes the entire agreement between the parties with respect to theWork licensed here. There are no understandings, agreements or representationswith respect to the Work not specified here. Licensor shall not be bound by anyadditional provisions that may appear in any communication from You. This Licensemay not be modified without the mutual written agreement of the Licensor and You.e.The rights granted under, and the subject matter referenced, in this License weredrafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971).These rights and subject matter take effect in the relevant jurisdiction in which theLicense terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If thestandard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.目录版权声明 (2)第一章 (15)第二章 (17)2.1 顶盖驱动流 (17)2.1.1 前处理 (18)2.1.1.1 网格生成 (18)2.1.1.2 边界和初始条件 (20)2.1.1.3 物理特性 (21)2.1.1.4 控制 (22)2.1.1.5 离散方法和矩阵求解器设置 (23)2.1.2 查看网格 (23)2.1.3 运行算例 (24)2.1.4 后处理 (25)2.1.4.1 等值面和云图 (25)2.1.4.2 矢量图 (27)2.1.4.3 绘制流线图 (29)2.1.5 网格细化 (29)2.1.5.1 使用存在的算例创造新算例 (29)2.1.5.2 生成细网格 (29)2.1.5.3 投影算例结果 (31)2.1.5.4 控制参数 (32)2.1.5.5 后台运行 (32)2.1.5.6 在细网格上绘制矢量 (32)2.1.5.7 绘图 (33)2.1.6 网格非均匀分布 (35)2.1.6.1 创建非均匀化网格 (36)2.1.6.2 调整时间步 (37)2.1.6.3 投影场 (38)2.1.7 增加雷诺数 (38)2.1.7.1 前处理 (38)2.1.7.2 运行算例 (39)2.1.8 高雷诺数流动 (40)2.1.8.1 前处理 (40)2.1.8.2 运行 (42)2.1.9 改变算例几何 (42)2.1.10 后处理 (46)2.2 带孔盘体应力分析 (46)2.2.1 网格生成 (47)2.2.1.1 边界和初始条件 (50)2.2.1.2 物理特性 (51)2.2.1.3 热物理特性 (51)2.2.1.4 控制 (51)2.2.1.5 离散格式和求解器控制 (52)2.2.2 运行 (54)2.2.3 后处理 (54)2.2.4 练习 (56)2.2.4.1 增加网格数量 (56)2.2.4.2 引入网格非均匀化 (56)2.2.4.3 改变平板尺寸 (56)2.3 溃坝 (56)2.3.1 生成网格 (57)2.3.2 边界条件 (59)2.3.3 设置初始场 (59)2.3.4 流体特性 (60)2.3.5 湍流模型 (61)2.3.6 时间步长控制 (61)2.3.7 离散格式 (62)2.3.8 矩阵求解器控制 (63)2.3.9 运行程序 (63)2.3.10 后处理 (64)2.3.11 并行运行 (64)2.3.12 算例的并行后处理 (67)第三章 (69)3.1 OpenFOAM编程语言 (69)3.1.1 普适性编程语言 (69)3.1.2 面向对象和C++ (70)3.1.3 方程呈现 (70)3.1.4 求解器代码 (71)3.2 编译程序和库 (71)3.2.1 头文件:.H (71)3.2.2 使用wmake进行编译 (73)3.2.2.1 包含文件头 (73)3.2.2.2 链接库 (74)3.2.2.3 编译源文件 (75)3.2.2.4 运行wmake (75)3.2.2.5 wmake环境变量设置 (76)3.2.3 移除依赖包文件:wclean和rmdepall (76)3.2.4 编译实例:pisoFoam求解器 (77)3.2.5 调试与优化 (79)3.2.6使用自定义库 (80)3.3 运行程序 (81)3.4 并行计算 (81)3.4.1 网格分解与初始场数据 (81)3.4.2 运行分解算例 (84)3.4.3 多硬盘数据阵列分布 (84)3.4.4 并行后处理 (85)3.4.4.2 分解场后处理 (85)3.5 标准求解器 (85)3.6 标准工具 (90)3.7 标准库 (97)第四章 (105)4.1 OpenFOAM文件结构 (105)4.2 基本输入输出格式 (106)4.2.1 通用语法规则 (106)4.2.2 字典 (106)4.2.3头文件 (107)4.2.4 链表 (108)4.2.5 Scalar标量、Vector矢量、Tensor张量 (109)4.2.6 量纲 (109)4.2.7 单位类型 (110)4.2.8 场 (110)4.2.9 指令和宏替换 (111)4.2.10 #include和#inputMode指令 (112)4.2.11 #codeStream指令 (112)4.3 时间和输入输出控制 (113)4.4 离散格式 (116)4.4.1 插值格式(interpolationSchemes) (117)4.4.1.1 严格有界标量格式 (118)4.4.1.2 针对矢量场的格式 (118)4.4.2 面法向梯度格式(snGradSchemes) (119)4.4.3 梯度格式(gradSchemes) (120)4.4.4 拉普拉斯格式(laplacianSchemes) (121)4.4.5 散度格式 (121)4.4.6 时间格式 (122)4.4.7 通量计算 (122)4.5 求解和算法控制 (123)4.5.1 矩阵求解器 (123)4.5.1.1 求解误差 (124)4.5.1.2 预条件双共轭梯度求解器 (125)4.5.1.3 光顺矩阵求解器 (125)4.5.1.4 GAMG (125)4.5.2 低松弛 (126)4.5.3 PISO和SIMPLE算法 (127)4.5.3.1 参考压力 (127)4.5.4 其它参数 (128)第五章 (129)5.1 网格 (129)5.1.1 网格规范以及限制 (129)5.1.1.1 点 (130)5.1.1.3 网格单元 (131)5.1.1.5 边界 (131)5.1.2 polyMesh (131)5.1.3 cellShape (132)5.1.4 一维、二维以及轴对称问题 (133)5.2 边界 (133)5.2.1 在OpenFOAM中指定边界条件 (135)5.2.2 基本类型 (136)5.2.3 主要类型 (138)5.2.4 衍生类型 (138)5.3 blockMesh网格生成程序 (140)5.3.1 编写blockMeshDict文件 (140)5.2.1.1 顶点 (141)5.3.1.2 边 (142)5.3.1.3 块 (142)5.3.1.4 block多重非均匀处理 (143)5.3.1.5 边界 (145)5.3.2 多块网格 (146)5.3.3 少于8个顶点的block (148)5.3.4 运行blockMesh (149)5.4 snappyHexMesh网格生成工具 (149)5.4.1 snappyHexMesh网格生成 (149)5.4.2 创建六面体背景网格 (151)5.4.3 特征边和特征面网格切分 (152)5.4.4 网格移除 (154)5.4.5 指定区域网格细化 (154)5.4.6 表面对齐 (155)5.4.7 网格边界层 (155)5.4.8 网格质量控制 (158)5.5 网格转换 (158)5.5.1 fluentMeshToFoam (159)5.5.2 starToFoam (160)5.5.2.1 转换STAR-CD网格的一般建议 (160)5.5.2.2 消除多余数据 (160)5.5.2.3 去掉默认边界条件 (161)5.5.2.4 模型重新编号 (162)5.5.2.5 写入数据 (163)5.5.2.6 .vrt文件可能的问题 (163)5.5.2.7 转换为OpenFOAM可用格式 (164)5.5.3 gambitToFoam (164)5.5.4 ideasToFoam (164)5.5.5 cfx4ToFoam (165)5.6 不同几何上的投影场 (165)5.6.2 非连续场投影 (165)5.6.3 并行投影 (167)第六章 (169)6.1 paraFoam (169)6.1.1 paraFoam概述 (169)6.1.2 Properties 面板 (170)6.1.3 display面板 (172)6.1.4 工具栏 (173)6.1.5 效果展示 (173)6.1.5.1 View设置 (173)6.1.5.2 常规设定 (174)6.1.6 云图绘制 (174)6.1.6.1 剖面 (174)6.1.7 矢量图绘制 (174)6.1.7.1 在网格中心绘制 (175)6.1.8 流线图 (175)6.1.9 输出图片 (175)6.1.10 动画输出 (175)6.2 附加函数工具 (176)6.2.1 使用函数工具 (178)6.2.2 预定义函数工具包 (179)6.3 使用Fluent来后处理 (181)6.4 使用Fieldview后处理 (182)6.5 使用EnSight进行后处理 (183)6.5.1转换数据为EnSight格式 (183)6.5.2 ensight74FoamExec插件 (183)6.5.2.1 EnSight用户插件 (183)6.5.2.2 使用用户自定义插件 (184)6.6 提取数据 (184)6.7 监控和管理进程 (187)6.7.1 运行进程的foamJob脚本 (188)6.7.2 监控进程的foamLog脚本 (188)第七章 (191)7.1 热物理模型 (191)7.1.1 热物理模型库以及混合模型 (192)7.1.2 传递模型 (193)7.1.3 热动力学模型 (193)7.1.4 组分的量 (194)7.1.5 状态方程 (195)7.1.6能量方程变量选择 (196)7.1.7热物理模型数据属性 (196)7.2 湍流模型 (197)7.2.1 模型系数 (198)7.3 流变模型 (199)7.3.1 牛顿流变模型 (199)7.3.2 Bird-Carreau流变模型 (199)7.3.3 Cross幂率流变模型 (200)7.3.4 幂率模型 (200)7.3.5 Herschel-Bulkley流变模型 (201)第一章导论本手册是OpenFOAM(开源场运算与操作C++类库)使用指南。

OpenFOAM使用手册(中文翻译版)

OpenFOAM使用手册(中文翻译版)

引言这是开源场运算和操作C++库类(ope nfoam)的使用指南。

他详细描述了Ope nF OAM的基本操作。

首先通过第二章一系列教程练习。

然后通过对更多的独立组件的更详细的描述学习ope nfoam。

Of首先主要是一个C++库类,主要用于创建可执行文件,比如应用程序(application)。

应用程序分成两类:求解器,都是为了解决特定的连续介质力学问题而设计的;公用工程,这些是为了执行包括数据操作等任务而设计的。

Of包括了数量众多的solver和utilities,牵涉的问题也比较广泛。

将在第三章进行详尽的描述。

Of的一个强项是用户可以通过必要的预备知识(包括数学,物理和编程技术)创建新的solvers和utilities。

Of需要前处理和后处理环境。

前处理、后处理接口就是of本身的实用程序(utilities),以此确保协调的数据传输环境。

图1.1是of总体的结构。

第4章和第五章描述了前处理和运行of 的案例。

既包括用of提供的meshgen erato划分网格也包括第三方软件生成的网格数据转换。

第六章介绍后处理。

Chapter 2指导手册在这一章中我们详细描述了安装过程,模拟和后进程处理一些Ope nF OAM测试案例,以引导用户运行OpenFOAM的基本程序。

$FOAM_TUTORIALS目录包含许多案件演示of提供的所有求解器以及许多共用程序的使用,在试图运行教程之前,用户必须首先确保他们已经正确地安装了Ope nF OAM。

该教程案件描述blockMesh预处理工具的使用,paraFoam案例设置和运行Ope nF OAM求解器及使用paraFoam进行后处理。

使用OpenFOAM支持的第三方后处理软件的用户可以选择:他们要么可以按照教程使用paraFoam,或当需要后处理时参阅第六章的第三方软件使用说明。

OpenFOAM安装目录下的tutorials目录中所有的指导手册都是可复制的。

openfoam使用步骤.doc

openfoam使用步骤.doc

[转载]使用openfoam的基本流前处理主要包括:网格的生成,物理参数的设定,初始边界条件的设定,求解控制设定,方程求解方法的选择,离散格式的选择。

网格生成:OpenFOAM带有自己的网格生成功能blockMesh,他可以生成块结构化网格,使用比较简单,但对于复杂几何,该功能实施比较复杂。

可以采用其网格软件如:gridgen,pointwi s e,gambit,icemcfd,tetgen,gmesh,ansys等生成网格,通过网格转换功能将其转换为openfoam可识别的网格。

我本人通常采用gridgen生成fluent网格,再采用fluentMeshToFaom功能转换为openfoam可识别网格。

物理参数的设置:OpenFOAM中的物理参数文件都在当前case文件夹里面的constant文件夹中,里面常用的文件通常常有environmentalP roperties:设定环境参数,重力加速度transportP roperties:传输相关参数,比如黏性,密度,对于非牛顿流体的黏性模型及其参数等LE SP roperties:大涡模型及其相关的模型参数RASP roperties: 雷诺时均模型及其相关模型参数thermodynamicP roperties:热物理相关参数这些文件的名字由solver里面定义,可以任意更改,上面书写是openfoam中的一个惯例,至于如何更改,请参看sol ver说明。

初始边界条件的设定:初始条件和边界条件设定都在case文件夹中的0文件夹中,在Openfoam中,每个求解变量都有自己的单独的求解文件,下面以/OpenFOAM/OpenFOAM-1.5/tutorials/icoFoam/cavity/0/p压力文件为例进行说明FoamFile //文件头{version 2.0; //版本号format ascii; //存储形式二进制或者asciiclass volScalarField;//场的类型,体心标量场object p; //场的名字}// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ////场的单位,应当注意这里的压强单位并非实际压强,而是压强除去密度(p/rho)的单位//因为openfoam对动量方程直接求解的速度dimensions [0 2 -2 0 0 0 0];//初始条件:内部场为均匀场,所有全为0,如果不均匀场则采用setField或者funkySetField对初始场进行//设置,如何使用这些功能,以后再说明。

openfoam简介作业

openfoam简介作业

OpenfoamOpenfoam的简介及使用方法:openFOAM是一个具有开源代码的CFD模拟软件,运行于LINUX操作系统中(运行于WINDOWS下的LINUX虚拟环境同样可以),目前最新版本为1.3。

受GNU Free Documentation License 保护,不过既然是开源软件,自然可以随便传播了,但是对源代码和说明文档的随意篡改是不负责任的,所以没有十足的把握,还是要尊重原始版权吧。

openFOAM,open Field Operation and Manipulation,字面意思就是“开放的域操作和处理”,貌似和CFD没有什么关系,但是它却可以处理很多CFD问题抑或偏微分方程数值解问题。

openFOAM是采用面向对象方法(Object-Orientation Method),采用C++语言编写的一个“库”(Library)。

个人感觉很像Delphi,软件本身提供了大量的类,用户可以根据自己的需求和喜好进行组织、程序设计。

与Delphi不同的是,openFOAM本身并不是一个编译环境,用户需要自己选用第三方软件来进行编译,这样一来,实际上openFOAM只提供了“料”,而与之对比的,Delphi则既提供了“料”,又提供了“锅”。

个人感觉,openFOAM 可以像Delphi那样,形成自己的编译环境,这样应该更有利于应用和推广,不过希望不要商业化才好,毕竟大家都喜欢用免费的东西:)openFOAM是个软件,但是其本身又不会运行,这就是为什么我们仅仅称之为库的原因。

但我们使用它,自然希望得到可以用的软件(application)。

利用openFOAM可以得到两种类型的application:求解器solver和工具utility,前者用来解决数值计算上的问题,而后者用来进行前处理和后处理。

至于怎么得到这些application,显然,需要我们用C++编程实现了。

我们编程,自然不应该从零开始,因为我们有openFOAM,这是我们进行CFD模拟工作的基石。

OpenFOAM从入门到精通

OpenFOAM从入门到精通

“除了基本的CFD模拟功能外,OpenFOAM还提供了许多高级功能,如多物理 场耦合、动网格和非牛顿流体的模拟等。这些功能可以帮助用户解决更复杂的流 动问题。”
“OpenFOAM是一个非常强大、灵活和易用的CFD工具箱。它提供了丰富的功 能和工具,可以帮助用户更好地理解和解决各种复杂的流动问题。”
作者简介
作者简介
这是《OpenFOAM从入门到精通》的读书笔记,暂无该书作者的介绍。
感谢观看
“在OpenFOAM中,用户可以使用各种不同的求解器来解决不同的流动问题。 这些求解器包括压力基求解器、速度基求解器、分离式求解器和耦合求解器等。 用户还可以使用各种不同的湍流模型、壁面处理技术和其他物理模型来模拟复杂 的流动现象。”
“OpenFOAM的后处理功能非常强大,可以帮助用户更好地理解模拟结果。用 户可以使用各种可视化工具来查看流场、压力场、速度场和其他物理量,还可以 使用各种统计分析工具来提取有用的信息。”
对于初学者来说,这本书是一个非常好的起点。它从OpenFOAM的基本概念开 始,解释了什么是OpenFOAM,以及它如何用于解决流体动力学问题。然后,它逐 步引导读者进入更深入的主题,如网格生成、求解设置、后处理等。每一个步骤 都配有清晰的插图和实例,使得读者可以轻松地跟随并理解每一部分的内容。
而对于那些已经有一定OpenFOAM使用经验的读者来说,这本书仍然是一本值 得拥有的参考书。它深入探讨了许多高级主题,如并行计算、复杂流动模型的设 置、非稳态问题的求解等。这些主题往往在其他地方很难找到详细的解释,但在 实际项目中却是非常重要的。
内容摘要
通过本书的学习,读者可以从零开始掌握OpenFOAM的使用方法和核心概念,深入了解其内在机 制和应用范围,提高解决实际问题的能力。无论是对初学者还是对有一定经验的用户,本书都是 一本非常有价值的参考书籍。

OpenFOAM使用手册(中文翻译版)

OpenFOAM使用手册(中文翻译版)

引言这是开源场运算和操作c++库类(openfoam)的使用指南。

他详细描述了OpenFOAM的基本操作。

首先通过第二章一系列教程练习。

然后通过对更多的独立组件的更详细的描述学习openfoam。

Of首先主要是一个c++库类,主要用于创建可执行文件,比如应用程序(application)。

应用程序分成两类:求解器,都是为了解决特定的连续介质力学问题而设计的;公用工程,这些是为了执行包括数据操作等任务而设计的。

Of包括了数量众多的solver和utilities,牵涉的问题也比较广泛。

将在第三章进行详尽的描述。

Of 的一个强项是用户可以通过必要的预备知识(包括数学,物理和编程技术)创建新的solvers 和utilities。

Of需要前处理和后处理环境。

前处理、后处理接口就是of本身的实用程序(utilities),以此确保协调的数据传输环境。

图1.1是of总体的结构。

第4章和第五章描述了前处理和运行of 的案例。

既包括用of提供的meshgenerator划分网格也包括第三方软件生成的网格数据转换。

第六章介绍后处理。

Chapter 2指导手册在这一章中我们详细描述了安装过程,模拟和后进程处理一些OpenFOAM测试案例,以引导用户运行OpenFOAM的基本程序。

$FOAM_TUTORIALS 目录包含许多案件演示of提供的所有求解器以及许多共用程序的使用,在试图运行教程之前,用户必须首先确保他们已经正确地安装了OpenFOAM。

该教程案件描述 blockMesh预处理工具的使用,paraFoam案例设置和运行OpenFOAM求解器及使用paraFoam进行后处理。

使用OpenFOAM支持的第三方后处理软件的用户可以选择:他们要么可以按照教程使用paraFoam,或当需要后处理时参阅第六章的第三方软件使用说明。

OpenFOAM安装目录下的tutorials目录中所有的指导手册都是可复制的。

教程根据流动类型分列在不同的目录下,对应子目录根据求解器slover分类。

openfoam mesh 解读

openfoam mesh 解读

openfoam mesh 解读【原创版】目录1.OpenFOAM 介绍2.OpenFOAM 中的网格(mesh)概念3.OpenFOAM 网格文件的格式与结构4.OpenFOAM 网格的创建与编辑5.OpenFOAM 网格的应用案例正文【1.OpenFOAM 介绍】OpenFOAM 是一个开源的计算流体力学(CFD)软件,广泛应用于工程和科学领域。

OpenFOAM 基于 C++编写,提供了一个完整的 CFD 求解器体系结构,包括湍流模型、边界层、多相流、化学反应等。

用户可以利用OpenFOAM 进行网格划分、求解和后处理等操作,满足各种流体动力学问题的求解需求。

【2.OpenFOAM 中的网格(mesh)概念】在 OpenFOAM 中,网格(mesh)是求解流体动力学问题的基础。

网格是将求解域离散化的结果,通过将求解域划分为多个小区域(单元),并在每个小区域内指定适当的数学模型和物理参数,从而实现对流体动力学问题的数值求解。

【3.OpenFOAM 网格文件的格式与结构】OpenFOAM 中的网格文件采用.msh 格式。

一个典型的.msh 文件包含以下几部分:1.文件头:包含文件的类型、版本和时间等信息;2.网格类型定义:定义网格的单元类型(如四面体、六面体等);3.网格单元信息:存储每个单元的节点坐标和单元类型;4.节点属性:定义节点的物理属性,如速度、压力等;5.区域和边界信息:定义求解域的区域和边界;6.其他信息:如求解器设置、初始条件等。

【4.OpenFOAM 网格的创建与编辑】OpenFOAM 提供了网格创建和编辑的工具,用户可以根据需求创建或编辑网格文件。

常用的网格创建和编辑工具包括:1.foamMesh:用于创建和编辑.msh 格式的网格文件;2.polyMesh:用于将.msh 文件转换为.pmx 格式的网格文件;3.pmxMesh:用于编辑.pmx 格式的网格文件;4.fvMesh:用于将.pmx 文件转换为.fv 格式的文件,以进行求解。

openfoam十周培训讲义 30次授课内容

openfoam十周培训讲义 30次授课内容

openfoam十周培训讲义 30次授课内容OpenFOAM是一个自由开源的计算流体力学(CFD)软件包,被广泛应用于工程领域。

为了帮助初学者快速掌握OpenFOAM的使用,一共进行了30次培训授课。

以下是这30次授课内容的总结。

第一次授课:介绍OpenFOAM的背景和基本理论知识。

介绍CFD的基本概念和方程式(Navier-Stokes、连续性方程等),并解释如何在OpenFOAM中实现这些方程。

第二次授课:介绍OpenFOAM的安装和配置。

讲解如何下载、安装和配置OpenFOAM,并演示如何设置环境变量、建立工作目录等基本操作。

第三次授课:开展第一个OpenFOAM案例。

介绍如何使用OpenFOAM 进行基本的流体模拟,包括如何准备网格、设置边界条件、运行求解器等。

第四次授课:介绍网格生成工具。

讲解如何使用snappyHexMesh 进行网格生成,以及常见的参数设置和技巧。

第五次授课:使用其他网格生成工具。

介绍使用其他网格生成工具(如blockMesh、cfMesh)的方法和注意事项。

第六次授课:介绍OpenFOAM的网格后处理工具。

演示如何使用paraFoam、Post-processing等工具进行结果的可视化和分析。

第七次授课:介绍OpenFOAM的物理模型。

讲解如何在OpenFOAM中设置不同的物理模型(湍流模型、辐射模型等),并解释每种模型的应用范围和限制。

第八次授课:讲解多相流模拟。

介绍如何使用OpenFOAM进行多相流模拟,包括欧拉-拉格朗日法、欧拉-欧拉法等。

第九次授课:介绍OpenFOAM的边界条件。

讲解不同类型的边界条件的设置方法和使用技巧。

第十次授课:介绍OpenFOAM的求解器。

讲解OpenFOAM中常用的求解器(如icoFoam、simpleFoam、pisoFoam等)的原理和使用方法。

第十一次授课:介绍OpenFOAM的并行计算方法。

讲解如何使用OpenFOAM进行并行计算,提高计算效率。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

引言这是开源场运算和操作c++库类(openfoam)的使用指南。

他详细描述了OpenFOAM 的基本操作。

首先通过第二章一系列教程练习。

然后通过对更多的独立组件的更详细的描述学习openfoam。

Of 首先主要是一个c++库类,主要用于创建可执行文件,比如应用程(application)。

应用程序分成两类:求解器,都是为了解决特定的连续介质力学问题而设计的;公用工程,这些是为了执行包括数据操作等任务而设计的。

Of 包括了数量众多的solver和utilities,牵涉的问题也比较广泛。

将在第三章进行详尽的描述。

Of 的一个强项是用户可以通过必要的预备知识(包括数学,物理和编程技术)创建新的solvers 和utilities。

Of 需要前处理和后处理环境。

前处理、后处理接口就是of本身的实用程序(utilities),以此确保协调的数据传输环境。

图1.1是of总体的结构。

第4章和第五章描述了前处理和运行of 的案例。

既包括用of提供的mesh generator划分网格也包括第三方软件生成的网格数据转换。

第六章介绍后处理。

Chapter 2指导手册在这一章中我们详细描述了安装过程,模拟和后进程处理一些OpenFOAM测试案例,以引导用户运行OpenFOAM的基本程序。

$FOAM_TUTORIALS 目录包含许多案件演示of提供的所有求解器以及许多共用程序的使用,在试图运行教程之前,用户必须首先确保他们已经正确地安装了OpenFOAM。

该教程案件描述blockMesh预处理工具的使用,paraFoam案例设置和运行OpenFOAM 求解器及使用paraFoam进行后处理。

使用OpenFOAM支持的第三方后处理软件的用户可以选择:他们要么可以按照教程使用paraFoam,或当需要后处理时参阅第六章的第三方软件使用说明。

OpenFOAM安装目录下的tutorials目录中所有的指导手册都是可复制的。

教程根据流动类型分列在不同的目录下,对应子目录根据求解器slover分类。

例如,所有icoFoam的案件存储在一个子目录“incompressible / icoFoam”,incompressible表示流动类型为不可压。

如果用户希望运行一套例子,建议该用户复制tutorials目录到本地运行目录。

他们可以轻松的通过输入下边的命令来复制:mkdir -p $FOAM RUNcp -r $FOAM TUTORIALS $FOAM RUN2.1盖驱动腔流Lid-driven cavity flow本节将介绍如何进行预处理,运行和后处理一个例子,涉及二维正方形区域内的等温,不可压缩流动。

图2.1中几何体的所有边界都是由壁面。

在x方向顶层墙体以1米/秒的速度移动,而其他3个墙壁是静止的。

最初,流动会假设为层流,将在均匀网格上使用icoFoam求解器来求解层流等温不可压流动。

在本教程中,将研究加强网格的划分的效果和网格朝向壁面分级的效果。

最终,流动雷诺数增加,必须使用用于恒温不可压缩紊流的pisoFoam求解器.2.1.1前处理通过编辑实例文件在OpenFOAM中设置实例,用户应选择一个xeditor进行前处理,如emacs,vi,gedit,kate,nedit等。

编辑文件可能在OpenFOAM中,因为I / O的目录格式的关键字意思很明确,很容易使没有经验的用户理解。

模拟实例涉及网格,流场,属性,控制参数等数据。

如4.1节所述,在OpenFOAM,这些数据是存储在实例目录下的一组文件中,而不是单个实例文件,如许多其他流体力学软件包。

实例目录给予适当的描述性名称,例如:该教程中的第一个例子就叫cavity。

在编辑实例文件和运行cavity实例前的准备工作中,用户应打开该案例的目录:cd /home/turtlebot/OpenFOAM/OpenFOAM-2.3.0/tutorials/incompressible/icoFoam/cavity2.1.1.1生成网格OpenFOAM经常运行在三维直角坐标系统中,生成的都是三维几何结构。

OpenFOAM默认求解三维问题,可以通过在某些边界上指定一个'special' empty边界条件,这些边界垂直于不要求解的第三维,从而来求解二维问题。

(三维如何求解二维的问题)cavity腔域是一个在xy平面上边长d= 0.1m的正方形。

起初用20*20的均匀网格。

块结构见图2.2。

网格生成器是OpenFOAM的blockMesh,根据一个输入文档blockMeshDict(在给定实例的constant/polyMesh目录下)中的指定描述生成网格。

对该实例输入的blockMeshDict如下所示:11 format ascii;12 class dictionary;13 object blockMeshDict;14 }15 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //1617 convertToMeters 0.1;1819 vertices20 (21 (0 0 0)22 (1 0 0)23 (1 1 0)24 (0 1 0)25 (0 0 0.1)26 (1 0 0.1)27 (1 1 0.1)28 (0 1 0.1)29 );3031 blocks32 (33 hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1)34 );3536 edges37 (38 );3940 patches41 (42 wall movingWall43 (44 (3 7 6 2)45 )46 wall fixedWalls47 (48 (0 4 7 3)49 (2 6 5 1)50 (1 5 4 0)51 )52 empty frontAndBack53 (54 (0 3 2 1)55 (4 5 6 7)56 )57 );5859 mergePatchPairs60 (61 );6263 // ************************************************************************* //头7行是文件头信息,用寬显线表示。

接下来是FoamFile子目录中的文件信息,用{...}大括号界定。

注释(来自苏军伟博客):FoamFile //文件头{version 2.0; //版本号format ascii; //存储形式二进制或者asciiclass volScalarField;//场的类型,体心标量场object p; //场的名字}在手册其他部分:为清楚起见并节省空间,文件头,包括寬显线及FoamFile子目录,将会在引用实例文件时全部省去。

文件首先指定块顶点坐标,然后通过顶点标号和单元个数定义块(此处仅有一个),最后,它定义边界块。

建议用户查阅5.3节了解blockMeshDict文件中输入项的含义。

在blockMeshDict文件上运行blockMesh生成网格。

在这个实例目录中,做到这一点,只需在终端输入:blockMesh终端窗口产生blockMesh运行状态报告。

任何blockMeshDict文件的错误都会被blockMesh挑出来,所产生的错误信息直接引导用户到文件中产生问题的所在行。

在该阶段不应该有错误。

2.1.2 边界和初始条件完成网格生成,用户可以看看为这个案例设置的初始场文件。

案例设置开始时间t = 0 s,所以初始流场数据被设置在cavity目录下面的名字为0的子文件夹里。

文件夹0里包括两个文件,p和U。

每个压力(p)和速度(U)的初始值和边界条件都必须设置。

让我们来检验下文件p:17 dimensions [0 2 -2 0 0 0 0];1819 internalField uniform 0;2021 boundaryField22 {23 movingWall24 {25 type zeroGradient;26 }2728 fixedWalls29 {30 type zeroGradient;31 }3233 frontAndBack34 {35 type empty;//空边界条件,说明求解是二维流动,这个在openFOAM是独有的,如果遇到该类边界,该边界不参与方程//离散,也就是什么都不做。

36 }37 }3839// ************************************************************************* //流场数据文件有3个主要的输入:dimensions:指定流场尺度(单位的指数),这里的运动学压力,即m2s-2(0 2 -2 0 0 0 0 )(见第4.2.6节获取更多信息);internalField:其内部文件数据可以是统一的,由单一值确定;不均匀时,流场所有值必须指定(详细信息见4.2.8节);boundaryField:边界的流场数据,包括边界条件和及所有边界块的数据(详细信息见4.2.8节)。

对于这个腔体例子,边界仅由壁面组成,分为两种边界:(1)fixedWall:固定墙包括侧墙和低墙(2)movingWall :移动墙的顶盖。

作为壁面,两者的P文件都是zeroGradient边界条件,即“压力垂直梯度为零”。

frontAndBack代表二维情况下的前后两个块,因此必须设置为empty。

该实例中,正如大多数我们遇到的情况一样,初始场被设置为是均匀的。

在这里,压力是运动学上的压力,作为一种不可压缩的情况,其绝对值是不相关,因此为方便起见设置为uniform 0。

(为什么跟绝对值不相关?)用户可用同样的方式检测0 / U文件中的速度场。

dimensions为对速度所期望的因次,内部流场初始化为uniform zero ,在这个例子里速度场必须由由3个矢量表示,即均匀的(0 0 0)见第4.2.5节获取更多信息)。

对frontAndBack块,速度边界流场要求相同的边界条件。

其他方向都是墙:固定墙需要假定无滑移条件,因此fixedValue 条件其值为统一(0 0 0)。

顶面以1米每秒的速度沿x方向移动,因此也需要fixedValue条件,但为统一(1 0 0)值。

2.1.1.3物理特性实例的物理属性存储在后缀为.....Properties的文件里,放在Dictionaries目录树。

对于这个icoFoam例子,唯一必须指定的运动粘度是存储在transportProperties目录中。

相关文档
最新文档