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简介作业

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入口流速加入正弦函数

openfoam入口流速加入正弦函数【最新版】目录1.OpenFOAM 简介2.入口流速加入正弦函数的背景和目的3.正弦函数的特性和选取4.实施步骤和结果分析5.总结与展望正文1.OpenFOAM 简介OpenFOAM 是一个开源的计算流体力学(CFD)软件,广泛应用于工程领域,如流体力学、热传导、传质等。

OpenFOAM 基于有限体积法(Finite Volume Method, FVM)进行求解,可以模拟各种复杂的流场和物理现象。

2.入口流速加入正弦函数的背景和目的在实际工程中,流体系统的入口速度往往是非均匀的,这会导致流场分布不均,进而影响到系统的性能。

为了改善这种情况,可以在 OpenFOAM 中将入口流速加入正弦函数,使得流速在时间上有规律的波动,从而模拟实际流体系统中的非均匀入口速度。

3.正弦函数的特性和选取正弦函数是一种周期性的波形,具有很好的规律性和对称性。

在OpenFOAM 中,可以通过指定正弦函数的振幅、频率、相位等参数来调节流速的波动特性。

为了更好地模拟实际情况,需要对正弦函数的参数进行合理的选取。

4.实施步骤和结果分析在 OpenFOAM 中,可以通过以下步骤实现入口流速加入正弦函数:(1)编写 OpenFOAM 的 C++代码,实现正弦函数的计算。

(2)在 OpenFOAM 的 input 文件中,加入正弦函数的定义和计算,并将其与入口流速相加。

(3)运行 OpenFOAM 求解器,得到流场分布。

(4)对结果进行分析,比较加入正弦函数前后的流场分布、压力损失等性能指标。

5.总结与展望通过在 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使用步骤

openfoam使用步骤

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

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

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

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

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

初始边界条件的设定:初始条件和边界条件设定都在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 reactingfoam解析

openfoam reactingfoam解析

openfoam reactingfoam解析摘要:一、OpenFOAM 简介1.OpenFOAM 的背景与历史2.OpenFOAM 的特点与优势二、ReactingFOAM 解析1.ReactingFOAM 的定义与作用2.ReactingFOAM 的基本原理3.ReactingFOAM 的应用领域三、OpenFOAM 与ReactingFOAM 的关系1.OpenFOAM 与ReactingFOAM 的关联性2.OpenFOAM 与ReactingFOAM 的结合应用四、OpenFOAM 在反应流体动力学中的应用1.反应流体动力学的基本概念2.OpenFOAM 在反应流体动力学中的实际应用3.OpenFOAM 在反应流体动力学中的优势与局限性五、展望OpenFOAM 与ReactingFOAM 的未来发展1.OpenFOAM 的未来发展趋势2.ReactingFOAM 的未来发展趋势3.OpenFOAM 与ReactingFOAM 共同发展的前景正文:一、OpenFOAM 简介OpenFOAM 是一款开源的计算流体动力学(CFD)软件,广泛应用于流体动力学、传热和化学反应等领域的数值模拟。

OpenFOAM 起源于英国曼彻斯特大学,经过多年的发展,已经成为国际上备受瞩目的CFD 软件之一。

它具有丰富的物理模型、高效的可扩展性和灵活的编程接口等特点,用户可以根据需求进行定制化开发,满足各种复杂问题的高效求解。

二、ReactingFOAM 解析1.ReactingFOAM 的定义与作用ReactingFOAM 是OpenFOAM 的一个扩展模块,专门用于处理流体中的化学反应问题。

它基于反应动力学理论,可以模拟流体中多种化学反应过程,包括气相和液相反应、气相和液相催化反应等。

通过ReactingFOAM 模块,用户可以在OpenFOAM 中方便地实现化学反应的数值模拟,进一步拓展了OpenFOAM 的应用领域。

openfoam入口流速加入正弦函数

openfoam入口流速加入正弦函数

openfoam入口流速加入正弦函数(最新版)目录1.OpenFOAM 简介2.入口流速加入正弦函数的背景和意义3.正弦函数的选取和参数设置4.实施步骤和结果分析5.总结与展望正文1.OpenFOAM 简介OpenFOAM 是一个开源的计算流体力学(CFD)软件,广泛应用于工程领域的流体动力学问题的求解。

它提供了一个强大的计算平台,可以处理各种复杂的流体流动问题,如湍流、多相流、热传导等。

OpenFOAM 采用 C++编写,拥有灵活的编程接口和丰富的功能,可以方便地与其他软件进行集成和协同工作。

2.入口流速加入正弦函数的背景和意义在实际工程中,流体系统的入口流速往往会受到各种因素的影响而产生波动。

为了更真实地模拟这种情况,可以在 OpenFOAM 中将入口流速加入正弦函数,使其在时间上呈现周期性变化。

这样做不仅可以提高计算结果的可靠性,还可以为后续的流场分析提供更加准确的数据支持。

3.正弦函数的选取和参数设置在 OpenFOAM 中,可以通过定义一个时间函数来实现入口流速的正弦波动。

通常情况下,正弦函数可以表示为:f(t) = A * sin(2 * pi * t / T)其中,A 表示振幅,决定了流速波动的最大值;T 表示周期,决定了流速波动一次所需的时间;t 表示时间。

在设置正弦函数时,需要根据实际情况合理选取 A 和 T 的值,以保证计算结果的准确性。

4.实施步骤和结果分析在 OpenFOAM 中实现入口流速加入正弦函数的具体步骤如下:(1)创建一个新的计算模型,包括几何模型、物理模型和边界条件等。

(2)在物理模型中,选择适当的湍流模型和边界层模型,以模拟流体系统的湍流特性和边界层效应。

(3)在边界条件中,设置入口流速为正弦函数,即:u_inlet(t) = A * sin(2 * pi * t / T)v_inlet(t) = 0w_inlet(t) = 0(4)设置其他边界条件,如壁面处的速度为零等。

openfoam 数学运算

openfoam 数学运算

OpenFOAM是一个开源的计算流体力学(CFD)软件包。

它的数学运算主要基于有限元方法和谱方法,用于求解偏微分方程。

在OpenFOAM中,数学运算主要包括以下几个部分:
1. 偏微分方程的求解:OpenFOAM使用有限元方法和谱方法求解偏微分方程,包括对流方程、扩散方程、热传导方程等。

2. 网格生成和网格质量控制:OpenFOAM使用网格生成技术,如mesh generator,生成模拟区域的网格模型,并使用网格质量控制技术,如mesh quality metrics,评估网格的质量。

3. 边界条件和初始条件设置:OpenFOAM支持多种边界条件和初始条件设置,如固定边界、可微调边界、固定初始条件、可微调初始条件等。

4. 求解器设置:OpenFOAM提供了多种求解器,如GMRES、LU、SOR等,可以根据具体问题选择合适的求解器。

总之,OpenFOAM的数学运算涉及偏微分方程的求解、网格生成和质量控制、边界条件和初始条件设置、以及求解器设置等多个方面。

需要具备一定的数学和计算基础,才能熟练掌握和应用OpenFOAM。

OpenFOAM C++ Style Guide中文版

OpenFOAM C++ Style Guide中文版
代码; }
1.6 for 和 while 循环语句
for (i = 0; i < maxI; i++) //-for 和(之间有空格。译者注 {
代码; } 或者 for (
i = 0;
5
/openfoamresearch
i < maxI; i++ ) { 代码; }
Class exampleClass Declaration \*---------------------------------------------------------------------------*/ 而不应该是 /*---------------------------------------------------------------------------*\ Class exampleClass Declaration \*---------------------------------------------------------------------------*/
//对于比较长的输出,另外起一行。译者注
WarningIn("className::functionName()") << "Warning message" //这里<<之前和 WarningIn 开头没哟空 4 个字符。译者注
• 如果该区没有内容,就将文件头名字去掉,就算将来要在该部分添加新的内容,也不例 外。因此需要将下面的删除(因为里面文件头下面没有内容,译者注)
//* * * * * * * * * * * * * Private Member Functions* * * * * * * * * * * //

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 绝热边界条件

openfoam 绝热边界条件

openfoam 绝热边界条件
OpenFOAM是一种流体动力学软件,它提供了各种边界条件,包括绝热边界条件。

绝热边界条件是指在边界处不允许有热量传递,即热通量为零。

在OpenFOAM中,可以使用以下命令来设置绝热边界条件:
1. 在0目录下的boundary文件中,找到需要设置绝热边界条件的边界面,例如wall。

2. 在wall的边界面下添加以下代码:
wall
{
type fixedValue;
value uniform 0;
heatFlux 0;
}
3. 解释代码:
a. type:指定边界条件的类型,这里使用的是fixedValue,表示边
界上的值是固定的。

b. value:指定边界上的值,这里设置为0。

c. heatFlux:指定热通量,这里设置为0,表示绝热边界条件。

4. 保存文件并重新编译模拟程序。

以上是在OpenFOAM中设置绝热边界条件的基本步骤。

需要注意的是,在实际应用中,需要根据具体情况进行调整,例如考虑边界面的
形状、材料等因素。

此外,还需要注意模拟结果的精度和稳定性,以
确保模拟结果的可靠性。

总之,OpenFOAM提供了丰富的边界条件选项,包括绝热边界条件。

通过合理设置边界条件,可以更准确地模拟流体动力学问题,为工程
实践提供有力支持。

openfoam调用sutherland公式

openfoam调用sutherland公式

OpenFOAM调用Sutherland公式1.简介本文档介绍了如何使用O pe nF OA M软件调用S ut he rl an d公式进行气体动力学模拟。

O pen F OA M是一款开源的计算流体力学软件,适用于各种复杂流体流动和传热问题的数值模拟。

2. Su therlan d公式S u th er la nd公式是用来描述气体粘性系数与温度之间关系的经验公式。

它通常用于计算非常高温的气体粘性系数,即在超过气体临界温度时,普通公式无法适用。

S u th er la nd公式的表达式如下:$$\m u=\m u_0\le ft(\f r ac{T}{T_0}\r igh t)^{\fr ac{3}{2}}\le ft(\f ra c{T_0+C}{T+C}\ri gh t)$$其中,$T$是气体温度,$\mu$是气体粘性系数,$T_0$是参考温度,$\mu_0$是参考粘性系数,$C$是常数。

3.在OpenFO AM中调用Suth erland公式在O pe nF OA M中,可以通过修改相关的配置文件和设置参数来调用S u th er la nd公式进行气体动力学模拟。

下面是一些具体的操作步骤:3.1修改t r a n s p o r t P r o p e r t i e s文件打开Op en FO AM中的t ra ns po rt Pr op er t ie s文件,该文件位于系统文件夹中,路径为:`/路径/至/O pe nF OA M/系统文件夹/c on st an t/tr an spo r tP ro pe rt ie s`在该文件中,找到涉及气体粘性系数的相关参数,并将其修改为使用S u th er la nd公式计算的方式。

具体步骤如下:1.找到`t ra ns po rtM o de l`参数,将其修改为`t ra ns po rt Mo de lNe w to ni an`,表示使用牛顿粘性模型。

openfoam初始条件

openfoam初始条件

openfoam初始条件
OpenFOAM是一款流体动力学模拟软件,它在数值计算领域有着广泛的应用。

在进行流场模拟前,需要设定模拟的初始条件。

本文将介绍如何设置OpenFOAM的初始条件。

1. 网格文件
在进行流场模拟前,需要先生成网格文件。

网格文件除了包含几何形状的信息,还包含流体运动的初始条件。

在使用OpenFOAM进行流场模拟时,需要将网格文件转化为OpenFOAM的格式。

可以使用一些常见的网格生成软件,如ANSYS、GAMBIT等。

2. 边界条件
在进行流场模拟时,需要设定边界条件。

边界条件是指在流体运动过程中,与其他物体或空气接触的边界处的初始条件。

常见的边界条件有速度边界条件、压力边界条件、壁面边界条件等。

3. 求解器的选择
OpenFOAM提供了多种求解器,可以根据模拟的实际情况选择合适的求解器。

例如,对于不可压流动,可以选择PISO求解器;对于可压流动,可以选择rhoSimpleFoam求解器等。

4. 迭代次数
在进行流场模拟时,需要设定迭代次数。

通常情况下,需要进行多次迭代才能达到收敛的状态。

为了提高模拟的准确性,需要根据实际情况进行调整。

5. 粘性系数的设定
粘性系数是影响流场模拟准确性的关键因素之一。

在进行模拟前,需要设定粘性系数的大小。

通常情况下,需要进行多次试验来确定最佳的粘性系数大小。

以上是OpenFOAM设置初始条件的一些基本方法和建议,希望能
对相关人员有所帮助。

openfoam alpha

openfoam alpha

openfoam alpha.water边界条件
在OpenFOAM中,用于处理alpha.water(水相的体积分数)
的边界条件有以下几种选项:
1. fixedValue:固定体积分数值,即将alpha.water设置为固定
的数值。

使用fixedValue边界条件需要指定alpha.water的数值。

2. zeroGradient:零梯度边界条件。

对于alpha.water,这意味
着水相的体积分数在边界上的梯度为零,即alpha.water的梯
度与边界垂直。

3. calculated:计算边界条件。

通过根据已知的物理量(如压力、速度等)来计算alpha.water的值。

这种边界条件需要使
用自定义的公式来计算alpha.water的值。

4. mixed:多相混合边界条件。

可以根据特定的模型,如VOF (Volume of Fluid)模型,将alpha.water设置为两相(如气体
和液体)之间的界面位置。

5. empty:空边界条件。

对于alpha.water来说,这意味着没有
水相存在,即alpha.water等于零。

这些边界条件可以在boundary文件中的相应patches部分指定。

例如,要将边界条件设置为固定体积分数值为0.5,可以在boundary文件中添加以下行:
```
alpha.water
{
type fixedValue;
value uniform 0.5;
}
```
更多关于OpenFOAM边界条件的信息可以在OpenFOAM的官方文档中找到。

openfoam 张量场运算

openfoam 张量场运算

openfoam 张量场运算
OpenFOAM是一个开源的计算流体动力学(CFD)软件,广泛应用于流体动力学、热力学、电磁学等领域。

在OpenFOAM中,可以使用张量场运算来描述和解决复杂的物理问题。

张量场运算在OpenFOAM中主要涉及以下几个方面:
1. **标量场运算**:标量场是只有大小而没有方向的物理量,如温度、压力等。

在OpenFOAM中,可以通过简单的算术运算(如加、减、乘、除)来对标量场进行操作。

2. **矢量场运算**:矢量场是有大小和方向的物理量,如速度、力等。

在OpenFOAM中,可以对矢量场进行各种运算,如矢量加减、点乘、叉乘等。

3. **张量场运算**:张量场是更高阶的物理量,可以描述更复杂的物理现象。

在OpenFOAM中,可以通过对张量进行分解、转置、求迹等运算来处理张量场。

4. **微分和积分运算**:在OpenFOAM中,可以使用微分和积分运算来描述物理量的变化规律。

这些运算可以帮助我们更好地理解流体的运动规律和求解一些复杂的物理问题。

需要注意的是,OpenFOAM中的张量场运算需要一定的数学基础和物理知识,需要谨慎使用并理解其含义。

同时,在进行张量场运算时,还需要注意精度和稳定性等方面的问题。

(OpenFOAM入门资料)solver, utility and library

(OpenFOAM入门资料)solver, utility and library

More solver,utility and library tutorials–how to learn yourself•We will start by searching the source code for information on how to use solvers, utilities and libraries.•Then we will learn how to use a small number of useful utilities and libraries. Some of them are described in the UserGuide and ProgrammersGuide,some are described in the OpenFOAM Wiki(e.g.Turbomachinery Working Group)and some of them have been discussed in the Forum.•In your home assignment you will be asked to go through some of the written tutorials in the UserGuide and ProgrammersGuide,where you willfind some written tutorials.It is HIGHLY recommended that you dig through ALL of the UserGuide and ProgrammersGuide(before complaining that there is not enough OpenFOAM documentation).•If youfind a utility,solver or library that is not described anywhere(or insuffi-ciently described),you can include a description of it in your project tutorial.I would prefer if you then use my L A T E X slide template,so that I can easily use it in coming courses(then please proved the raw tex-file and accompanying graphical files).How to search for solver tutorials in the source code •Type tut to go to the$FOAM_TUTORIALS directory.Here youfind many case-setups for the solvers in OpenFOAM.Unfortunately,they are not well-described.Describing these tutorials in words andfigures may be part of your project.•Type:tree-d-L2$FOAM_TUTORIALSto get a list of which solvers there are tutorial cases available.•Type:tree-d-L1$FOAM_TUTORIALS/incompressible/icoFoamto get a list of which tutorial cases are available for the icoFoam solver.•All the solver tutorials have Allrun scripts that describe the use of those tutorials.We will now have a look at the Allrun script of the$FOAM_TUTORIALS/incompressible/icoFoam tutorials.This is actu-ally what you will do manually when you do the cavity tutorials in the UserGuide.In other words,you can use the Allrun script as a short summary of the description in the UserGuide.Run the icoFoam cavity tutorials using the Allrun script(1/7) (Note that the following description shows the principle.There might be small differences in exactly what is done by the Allrun script between versions.)In the icoFoam tutorial directory there is an Allrun script.When running this script it is preferred to copy the entire directory to your run directory.Type: cp-r$FOAM_TUTORIALS/incompressible/icoFoam$FOAM_RUNcd$FOAM_RUN/icoFoam./Allrun>&log_Allrun&Looking in the Allrun script,you can see a list of cases that will be executed:cavityCases="cavity cavityFine cavityGrade cavityHighRe cavityClipped" Some of those cases are actually created by the script.At the end of the script it also runs the elbow case.The script contains Linux commands and calls for OpenFOAM applications in order to set up and run the simulations.Run the icoFoam cavity tutorials using the Allrun script(2/7) The Allrun script for the icoFoam cavity tutorials actuallyfirst runs the cavity case#Running blockMesh on cavity:blockMesh#Running icoFoam on cavity:icoFoamRun the icoFoam cavity tutorials using the Allrun script(3/7) The Allrun script for the icoFoam cavity tutorials actuallythen runs the cavityFine case:#Cloning cavityFine case from cavity:mkdir cavityFinecp-r cavity/{0,system,constant}cavityFine[change"20201"in blockMeshDict to"41411"][set startTime in controlDict to0.5][set endTime in controlDict to0.7][set deltaT in controlDict to0.0025][set writeControl in controlDict to runTime][set writeInterval in controlDict to0.1]#Running blockMesh on cavityFineblockMesh#Running mapFields from cavity to cavityFinemapFields-case cavity-sourceTime latestTime-consistent#Running icoFoam on cavityFineicoFoamRun the icoFoam cavity tutorials using the Allrun script(4/7) The Allrun script for the icoFoam cavity tutorials actuallythen runs the cavityGrade case:#Running blockMesh on cavityGradeblockMesh#Running mapFields from cavityFine to cavityGrademapFields-case cavityFine-sourceTime latestTime-consistent#Running icoFoam on cavityGradeicoFoamRun the icoFoam cavity tutorials using the Allrun script(5/7) The Allrun script for the icoFoam cavity tutorials actuallythen runs the cavityHighRe case:#Cloning cavityHighRe case from cavitymkdir cavityHighRecp-r cavity/{0,system,constant}cavityHighRe#Setting cavityHighRe to generate a secondary vortex[set startFrom in controlDict to latestTime;][set endTime in controlDict to 2.0;][change0.01in transportProperties to0.001]#Copying cavity/0*directory to cavityHighRecp-r cavity/0*cavityHighRe#Running blockMesh on cavityHighReblockMesh#Running icoFoam on cavityHighReicoFoamRun the icoFoam cavity tutorials using the Allrun script(6/7) The Allrun script for the icoFoam cavity tutorials actuallythen runs the cavityClipped case:#Running blockMesh on cavityClippedblockMesh#Running mapFields from cavity to cavityClippedcp-r cavityClipped/0cavityClipped/0.5mapFields-case cavity-sourceTime latestTime[Reset the boundary condition for fixedWalls to:][type fixedValue;][value uniform(000);][We do this since the fixedWalls got][interpolated values by cutting the domain]#Running icoFoam on cavityClippedicoFoamRun the icoFoam cavity tutorials using the Allrun script(7/7) The Allrun script for the icoFoam cavity tutorials actuallyfinally runs the elbow caseNow,open each case with paraFoam and have a look.Run ALL the tutorials using the Allrun scriptsWe will not do this now!•You can also run another Allrun script,located in the$FOAM_TUTORIALS direc-tory.This script will run through ALL the tutorials(calls Allrun in each solver directory).•You can use this script as a tutorial of how to generate the meshes,how to run the solvers,how to clone cases,how to map the results between different cases etc.Finding tutorials for the utilities in OpenFOAM •There are no’case’tutorials for the utilities,but we can search for examples:find$WM_PROJECT_DIR-name\*Dict|grep-v blockMeshDict|grep-v controlDict You will get a list of example dictionaries for the utilities that use a dictionary.Some of those examples can be found next to the source code of each particular utility,and some are also used in the solver tutorials.The ones that don’t use a dictionary are usually easier to learn how to use,in particular when using the-helpflag.Now you should be ready to go on exploring the applications by yourself.More tutorials can be found in•The UserGuide•The Programmer’s guide,chapter3•The OpenFOAM Wiki(in particular the Turbomachinery Working Group)•The OpenFOAM ForumWe will now have a look at some utilities and libraries.Please feel free to improve/expand these descriptions as part of your assignment(e.g.2.0.x,figures etc.)!Use previously mentioned dictionary hints tofind alternatives for entries.The mapFields utility•The mapFields utility maps the results of one case to another case.You will use this utility when you do the cavityClipped tutorial in the UserGuide(Allrun:mapFields$1-case$2-sourceTime latestTime>$2/log.mapFields2>&1) Try:mapFields cavity-case cavityClipped-sourceTime latestTime •Usage(type mapFields-help,version dependent):mapFields<source dir>[-parallelTarget][-consistent][-sourceTime scalar][-parallelSource][-case dir][-help][-doc][-srcDoc]•The time used for the mapping is specified by startFrom/startTime in the target case. Theflag-sourceTime can specify another time directory in the source case.•Theflag-consistent is used if the geometry and boundary conditions are identical in both cases.This is useful when modifying the mesh density of a case.For non-consistent cases a mapFieldsDict dictionary must be edited,see the icoFoam/cavityClipped tutorial.•Theflags-parallelSource and-parallelTarget are used if any,or both,of the cases are decomposed for parallel simulations.The sample utility•The sample utility is used to produce graphs for publication or to extract surfaces.You will use this utility when you do the tutorials of the UserGuide,and when you do the ercoftacConicalDiffuser case-study.•Usage(sample-help,version dependent):sample[-latestTime][-time ranges][-parallel][-constant] [-noZero][-case dir][-region name][-help][-doc][-srcDoc]•Copy and modify sampleDict from the plateHole tutorial:cd$FOAM_RUN/icoFoamcp$FOAM_TUTORIALS/stressAnalysis/solidDisplacementFoam/plateHole/system/sampleDict cavity/systemsed-i s/"leftPatch"/"horizontalLine"/g cavity/system/sampleDictsed-i s/"00.50.25"/"0.0010.050.005"/g cavity/system/sampleDictsed-i s/"020.25"/"0.0990.050.005"/g cavity/system/sampleDictsed-i s/"axis y"/"axis distance"/g cavity/system/sampleDictsed-i s/"sigmaxx"/"p"/g cavity/system/sampleDictRunning sample-case cavity,the pressure,p,is extracted along a horizontal line at100points,and the results are written in cavity/sets.•Plot in gnuplot:plot"cavity/sets/0.5/horizontalLine_p.xy"•sample can also sample surfaces...The sample utility-surfaces•Additions for extracting surface cuts(an additional example is commented): surfaceFormat vtk;surfaces(outputName{//type patch;//patchName movingWall;//triangulate false;type plane;basePoint(0.050.050.005);normalVector(001);});•Run with sample-case cavity•The result is written in cavity/surfaces•Visualize the surfaces in paraview(File/Open andfind a vtkfile in the surfaces directory).The sample utility-interpolationScheme •Use dummy entries to see the alternatives for interpolationScheme (interpolationScheme dummy;):cellcellPointcellPointFacecellPointWallModified(version dependent)•See the source code for exact definitions(and help me expand this information): $FOAM_UTILITIES/postProcessing/sampling/sample/sample.CThe sample utility-formats•Use dummy entries to see the alternatives for formats(version dependent):•setFormat:xmgrjplotgnuplotraw•surfaceFormat:foamFilenullrawvtk•See the source code for exact definitions(and help me expand this information): $FOAM_UTILITIES/postProcessing/sampling/sample/sample.CThe sample utility-types•Use dummy entries to see the alternatives for types(version dependent):•Sets:uniformmidPointAndFacefacemidPointcloudcurve•Surfaces:thresholdCellFacescuttingPlaneisoSurfaceCellpatchisoSurfacedistanceSurfaceplane•See the source code for exact definitions(and help me expand this information): $FOAM_UTILITIES/postProcessing/sampling/sample/sample.CThe foamCalc utility•This utility calculates newfields from existing ones.This replaces someof the utilities in previous versions of OpenFOAM,such as magU and Ucomponents.•Usage(NOTE that foamCalc doesn’t accept usualflags,and must be runfrom within the case directory):foamCalc<calcType><fieldName1...fieldNameN>•To get a list of available<calcType>s,write:foamCalc xxx and get the following list(version dependent):randomise,magSqr,magGrad,addSubtract,div,mag,interpolate,components•Examples:foamCalc div U#(needs:div(U)Gauss linear;in:system/fvSchemes) foamCalc components U•The newfields are written in the time directories.•An advanced user could try tofind out how to add a<calcType>The setFields utility•The setFields utility is used to set values to thefields in specific regions.You will use this when you do the interFoam/damBreak tutorial in the UserGuide.•Usage(setFields-help,version dependent):setFields[-latestTime][-time ranges][-parallel][-constant][-noZero][-case dir][-help][-doc][-srcDoc]•A setFieldsDict dictionary is used.Find an example in the damBreak tutorial: cd$FOAM_RUN/cavitycp$FOAM_TUTORIALS/multiphase/interFoam/ras/damBreak/system/setFieldsDict cavity/system/sed-i s/"alpha1"/"p"/g cavity/system/setFieldsDictsed-i s/"box(00-1)(0.14610.2921)"/"box(00-1)(0.050.051)"/g cavity/system/setFieldsDict setFields-case cavity-The defaultFieldValues sets the default values of thefields.-A boxToCell bounding box is used to define a set of cells where the fieldValues should be different than the defaultFieldValues.-Use a dummy instead of boxToCell to see the topoSetSource alternatives.-An advanced user could describe different topoSetSource’sThe funkySetFields,groovyBC and swak4Foam utilitiesThis are really useful community contributions!•funkySetFields is a development of the setFields utility,and it includes the option of specifying mathematical expressions etc.:/index.php/Contrib_funkySetFields•The groovyBC utility is similar,but for boundaries:/index.php/Contrib_groovyBCIt should be noted that in2.0.x,there is a new way of setting boundary conditions similar to groovyBC,but with C++syntax.•The above have now been merged into swak4Foam:/index.php/Contrib/swak4Foam/6th_OpenFOAM_Workshop_2011/Program/Training/gschaider_slides.pdf/6th_OpenFOAM_Workshop_2011/Program/Training/gschaider_material.tgzThe foamToVTK,checkMesh,andflattenMesh utilities•The foamToVTK utility can be used in many different ways.Example:•The two empty sides of a2D mesh must have the same mesh distribution.Add0.0001 to the z-position of one of the constant/polyMesh/points of the cavity case.•The checkMesh utility can be used to verify this.If not,it will complain:***Number of edges not aligned with or perpendicular to non-empty directions:???? Writing????points on non-aligned edges to set nonAlignedEdges•The point labels are written to constant/polyMesh/sets/nonAlignedEdges •Take the opportunity to visualize the point set in paraFoam:First open the cavity case in paraFoam,then use File/Open<case>.OpenFOAM to read in the same case again. This time mark Include Sets,mark only Mesh Parts/NonAlignedEdges,and visualize using box glyphs.•Another way to view the problematic points in paraview(not paraFoam):foamToVTK-case cavity-pointSet nonAlignedEdgesThe result appears in the VTK directory.•The flattenMesh utility can sometimesfix the problem,like in this case.The transformPoints utility•Moves,rotates and scales the mesh.•Usage(transformPoints-help,version dependent):transformPoints[-translate vector][-yawPitchRoll(yaw pitch roll)] [-rotateFields][-parallel][-rotate(vector vector)][-rollPitchYaw(roll pitch yaw)][-scale vector][-case dir][-help][-doc][-srcDoc]•Example:runcp-r cavity cavityMovedtransformPoints-case cavityMoved-translate"(0.100)"•Have a look in paraFoam:runtouch cavityMoved/cavityMoved.OpenFOAMparaFoam-case cavityClick Accept and then use File/Open to open the cavityMoved.OpenFOAMfile at the same time.The mergeMeshes utility•Takes the meshes from two different cases and merges them into the master case.•mergeMeshes reads the system/controlDict of both cases and uses the startTime, so be careful if you have a moving mesh for example.Thefirst case that you specify will be the master,and a new time(startTime+deltaT)will be written in which a new polymesh is located.Move it to the correct position(constant/polyMesh),and you have a case with the merged mesh.•Example(start from clean cases):runcp-r$FOAM_TUTORIALS/incompressible/icoFoam/cavity cavityMergedcp-r$FOAM_TUTORIALS/incompressible/icoFoam/cavity cavityTransformed blockMesh-case cavityMergedblockMesh-case cavityTransformedtransformPoints-case cavityTransformed-translate"(0.100)" mergeMeshes.cavityMerged.cavityTransformed#No dots in 2.0.x!mv cavityMerged/0.005/polyMesh/*cavityMerged/constant/polyMesh•Note that the two meshes will keep all their original boundary conditions,so they are not automatically coupled.Try icoFoam!To couple the meshes,use stitchMesh...The stitchMesh utility•Couples two uncoupled parts of the mesh that belong to the same case.•You should have a patch in one part of the mesh(masterPatch)thatfits with a corre-sponding patch on the other part of the mesh(slavePatch).If you have that,then the command is:stitchMesh masterPatch slavePatch•masterPatch and slavePatch are important,as the face and cell numbers will be renamed after the masterPatch.•After stitchMesh,masterPatch and slavePatch are still present in the newpolymesh/boundary,but they are empty so just delete them.The same thing can be done as well for the boundary conditions in the0folder.•We have to re-organize the patches for this to work with our cavityMerged case.•See for more details:/index.php/Sig_Turbomachinery_/_ERCOFTAC_centrifugal_pump_with_a_vaned_diffuser#stitchMeshThe decomposePar utility•decomposePar makes a domain decomposition for parallel computations.This is de-scribed in the UserGuide.•Usage:decomposePar[-fields][-force][-copyUniform][-cellDist] [-filterPatches][-ifRequired][-case dir][-region name][-help][-doc][-srcDoc]•A decomposeParDict specifies how the grid should be decomposed.An example can be found in the interFoam/damBreak tutorial:system/decomposeParDict.•There are some different alternatives for which method to use for the decomposition. See the UserGuide.numberOfSubdomains specifies the number of subdomains the grid should be decomposed into.Make sure that you specify the same number of subdomains in the specific decomposition method you will use,otherwise your simulation might not run optimal.•We will discuss parallel processing later on.The reconstructPar utility•reconstructPar is the reverse of decomposePar,reassembling the grid and the re-sults.•Usage:reconstructPar[-zeroTime][-fields"(list of fields)"][-latestTime][-time ranges][-constant][-noZero][-noLagrangian][-case dir][-region name][-help][-doc][-srcDoc]•This is usually done for post-processing,although it is also possible to post-process each domain separately by treating an individual processor directory as a separate case when starting paraFoam.•We will discuss parallel processing later on.functionObjects•functionObjects are general libraries that can be attached run-time to any solver,without having to re-compile the solver.•An example can be found in the incompressible/pisoFoam/les/pitzDaily tutorial.•A functionObject is added to a solver by adding a functions entry in system/controlDict•You canfind functionObjects in the source code,in the OpenFOAMWiki(),and in the OpenFOAM-extend project ().•Search the tutorials for examples using:grep-r functionObjectLibs$FOAM_TUTORIALS•The implementations can be found in:$FOAM_SRC/postProcessing/functionObjects•I need your help documenting this.The probes andfieldAverage functionObjects •The probes functionObject probes the development of the results during a simulation,writing to afile in the directory probes.•ThefieldAverage functionObject calculates the time-average of specified fields and writes the results in the time directories.•Copy and modify the functions part at the end of the controlDict of the incompressible/pisoFoam/les/pitzDaily tutorial to your case and run it.•Visualize the outputfile of sample in Gnuplot:plot"probes/0/p"using1:2,"probes/0/p"using1:3•Visualize the output fromfieldAverage in paraFoam.The surfaces functionObjectsThe surfaces functionObject writes out surface interpolated results to disk. If the surfaceFormat is VTK,those can be viewed in paraview.Two examples(see the commented lines for the second one):functions(pressure{type surfaces;functionObjectLibs("libsampling.so");outputControl timeStep;outputInterval1;surfaceFormat vtk;fields(p);surfaces(walls{//type patch;//patchName movingWall;//triangulate false;type plane;normalVector(001);basePoint(000.005);});});The forceCoeffs functionObject•The forceCoeffs functionObject prints out the lift and drag coefficients.•See the sonicFoam/ras tutorial:system/controlDict•Note that you must specify realistic reference values!•See the source code for the details!More functionObjects•/index.php/Contrib_simpleFunctionObjects •/index.php/Sig_Turbomachienry_/_ERCOFTAC_centrifugal_pump_with_a_vaned_diffuser#Optional_tools。

openfoam量纲

openfoam量纲

OpenFOAM量纲1. 引言OpenFOAM是一个开源的计算流体力学(CFD)软件套件,用于模拟和求解流体力学问题。

在使用OpenFOAM进行模拟之前,我们需要了解和理解量纲的概念。

量纲是物理量的度量属性,描述了物理量的基本性质和单位。

在OpenFOAM中,正确的量纲设置对于模拟结果的准确性至关重要。

本文将介绍OpenFOAM中的量纲概念以及如何正确设置量纲。

2. 量纲的基本概念2.1 量纲的定义量纲是物理量的度量属性,通常由基本物理量(如质量、长度、时间等)的幂指数表示。

例如,速度的量纲可以表示为[L1T{-1}],其中[L]表示长度,[T]表示时间。

2.2 量纲的基本原理量纲的基本原理是物理量的加法和乘法原理。

加法原理指出,只有具有相同量纲的物理量才能相加或相减。

乘法原理指出,两个物理量相乘或相除的结果的量纲是两个物理量的量纲的乘积或商。

2.3 量纲的转换在OpenFOAM中,我们可以使用dimensionSet和dimensionedScalar等类来进行量纲的转换。

dimensionSet类用于定义物理量的量纲,dimensionedScalar类用于表示带有量纲的标量。

3. OpenFOAM中的量纲设置3.1 基本物理量的设置在OpenFOAM中,我们可以使用SIunits类来设置基本物理量的量纲。

SIunits类提供了一组静态成员函数,用于设置质量、长度、时间等基本物理量的量纲。

3.2 用户自定义物理量的设置除了基本物理量,OpenFOAM还允许用户定义自己的物理量。

用户可以使用dimensionedScalar类来定义带有量纲的标量。

dimensionedScalar类包含一个标量值和一个dimensionSet对象,用于表示标量的量纲。

3.3 量纲转换和一致性检查OpenFOAM提供了一些函数来进行量纲转换和一致性检查。

用户可以使用dimensionedScalar类的convertTo函数来进行量纲的转换。

openfoam量纲

openfoam量纲

openfoam量纲
摘要:
1.OpenFOAM 简介
2.OpenFOAM 的量纲设置
3.OpenFOAM 中常用的量纲单位
4.OpenFOAM 的量纲转换
正文:
1.OpenFOAM 简介
OpenFOAM 是一个开源的计算流体力学(CFD)软件,广泛应用于工程领域,如流体动力学、热传导、传质过程等。

OpenFOAM 基于有限体积法(Finite Volume Method, FVM)进行求解,能够模拟复杂的三维流场,并提供高效的并行计算支持。

2.OpenFOAM 的量纲设置
在OpenFOAM 中,量纲是模拟过程中一个重要的设置。

合理的量纲设置能够确保模拟结果的准确性和可靠性。

OpenFOAM 中的量纲主要包括长度、时间、质量、能量和角度等。

3.OpenFOAM 中常用的量纲单位
在OpenFOAM 中,常用的量纲单位如下:
- 长度:米(m)
- 时间:秒(s)
- 质量:千克(kg)
- 能量:焦耳(J)
- 温度:开尔文(K)
- 压力:帕斯卡(Pa)
4.OpenFOAM 的量纲转换
在OpenFOAM 中,如果需要对模拟过程中的量纲进行转换,可以使用以下方法:
- 利用OpenFOAM 的转换函数,如` convertUtility()`函数进行单位转换。

- 在OpenFOAM 的输入文件中,使用`$convert`指令进行量纲转换。

总之,OpenFOAM 中的量纲设置对于模拟结果的准确性至关重要。

用户需要根据实际问题选择合适的量纲单位,并在模拟过程中进行合理的量纲转换。

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

引言
这是开源场运算和操作
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提供的mesh
gen erato划分网格也包括第三方软件生成的网格数据转换。

第六章介绍后处理。

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

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

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

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

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

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

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

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

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

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

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

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

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

最终,流动雷诺数增加,必须使用用于恒温不可压缩紊流的pisoFoam求解器.。

相关文档
最新文档