设为首页 加入收藏

TOP

OpenFoam——溃坝【算例】(一)
2023-07-23 13:33:48 】 浏览:82
Tags:OpenFoam 溃坝 算例

7.1 溃坝

官网
目录:$FOAM_TUTORIALS/multiphase/interFoam/laminar/damBreak

7.1.1 介绍

本案例使用interFoam两相算法,基于流体体积分数(VOF)法,每个网格中的相体积分数(alpha)通过求解一个组分运输方程确定。物理属性基于这个相分数通过加权平均计算。
image.png

7.1.2 网格生成

blockMesh

7.1.3 边界条件

最顶端atmosphere边界设置为patch

// 0/U
boundaryField
{
	...
    atmosphere
    {
        type            pressureInletOutletVelocity; // 对所有分量应用zeroGradient条件,当流动为入流时,对边界切向的分量应用fixedValue;
        value           uniform (0 0 0);
    }
    defaultFaces
    {
        type            empty;
    }
}

// 0/p_rgh
boundaryField
{
	...
    atmosphere
    {
        type            totalPressure; // 一种fixedValue条件,利用指定的总压p0和当地速度U计算获得;
        p0              uniform 0;
    }

    defaultFaces
    {
        type            empty;
    }
}

// 0/alpha.water.orig
boundaryField
{
	...
    atmosphere
    {
        type            inletOutlet; // 出流时为zeroGradient,入流时则为fixedValue条件;
        inletValue      uniform 0;
        value           uniform 0;
    }

    defaultFaces
    {
        type            empty;
    }
}
// ************************************************************************* //

所有壁面边界处,压力场采用fixedFluxPressure边界条件,它自动调整压力梯度使边界通量符合速度边界条件

boundaryField
{
    leftWall
    {
        type            fixedFluxPressure; // 
        value           uniform 0;
    }

    rightWall
    {
        type            fixedFluxPressure;
        value           uniform 0;
    }

    lowerWall
    {
        type            fixedFluxPressure;
        value           uniform 0;
    }
}

defaultFaces代表此2维问题的前后面,像往常一样,是empty类型

    defaultFaces
    {
        type            empty;
    }

7.1.4 设置初场

相当于fluent中的patch,patch出一个水域。
boxToCell通过定义一个最小和最大的向量来创建一个盒子区域,在此区域内为水相,water被设置为1.
在执行setFields之前,先备份0目录下的alpha.water.org(备份文件)为alpha.water。因为setFields工具从文件读取场并重新定义这些场,然后把它们重新写入文件,原始文件会被覆盖,所以需要备份。

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
    volScalarFieldValue alpha.water 0 // 场内默认为空气
);

regions
(
    boxToCell
    {
        box (0 0 -1) (0.1461 0.292 1); // 对应坐标如下
        fieldValues
        (
            volScalarFieldValue alpha.water 1
        );
    }
);
// ************************************************************************* //

image.png
image.png

使用paraFoam -builtin后处理查看

7.1.5 流体特性

constant/transportProperties

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

phases (water air); // 两相

water
{
    transportModel  Newtonian; // 牛顿流体
    nu              1e-06; // 运动粘度
    rho             1000; // 密度
}

air
{
    transportModel  Newtonian;
    nu              1.48e-05;
    rho             1;
}

sigma            0.07; // 表面张力

// ************************************************************************* //

Newtonian为牛顿流体,CrossPowerLawCoeffs为非牛顿流体。

重力场

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*----------------------
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇LeetCode 力扣 205. 同构字符串 下一篇驱动开发:内核使用IO/DPC定时器

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目