Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. change the k at first grid?

change the k at first grid?

已定时 已固定 已锁定 已移动 OpenFOAM
11 帖子 2 发布者 6.6k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • 李东岳李 在线
    李东岳李 在线
    李东岳 管理员
    写于 最后由 编辑
    #2

    https://dyfluid.coding.net/p/OpenFOAM_dyfluid/d/OpenFOAM_dyfluid/git/tree/master/solver/dyfluidFoam.C 67-73

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    K 2 条回复 最后回复
  • K 离线
    K 离线
    kimy
    在 中回复了 李东岳 最后由 编辑
    #3

    @东岳 Hi, dongyue. Thanks a lot. I understood this method but can I use it in a kwallfunction? After I tried the code you suggested, the compiling error is mesh not decalred in this scope. If I would like to update the first grid value in the kwallfunction like epsilonwallfunction did, is it possible?

    1 条回复 最后回复
  • 李东岳李 在线
    李东岳李 在线
    李东岳 管理员
    写于 最后由 编辑
    #4

    the compiling error is mesh not decalred in this scope

    Looks you used that in a Class. Try to include the following code snippet before you use it:

    const fvMesh& mesh = k.mesh();
    

    If I would like to update the first grid value in the kwallfunction like epsilonwallfunction did, is it possible?

    Everything is possible as long as it is physical.

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    K 1 条回复 最后回复
  • K 离线
    K 离线
    kimy
    在 中回复了 李东岳 最后由 李东岳 编辑
    #5

    @东岳

    derivedFvPatchFields/wallFunctions/kqRWallFunctions/kOngWallFunction/kOngWallFunctionFvPatchScalarField.C: In member function 'virtual void Foam::kOngWallFunctionFvPatchScalarField::updateCoeffs()':
    derivedFvPatchFields/wallFunctions/kqRWallFunctions/kOngWallFunction/kOngWallFunctionFvPatchScalarField.C:190:40: error: 'class Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >' has no member named 'mesh'
         const fvMesh& mesh = turbModel.k().mesh();
    
    1 条回复 最后回复
  • 李东岳李 在线
    李东岳李 在线
    李东岳 管理员
    写于 最后由 编辑
    #6

    @kimy 在 change the k at first grid? 中说:

    kqRWallFunctions

    If p is a fvPatch

    const fvMesh& mesh = p.boundaryMesh().mesh();
    

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    K 1 条回复 最后回复
  • K 离线
    K 离线
    kimy
    在 中回复了 李东岳 最后由 李东岳 编辑
    #7

    @东岳

    derivedFvPatchFields/wallFunctions/kqRWallFunctions/kOngWallFunction/kOngWallFunctionFvPatchScalarField.C: In member function 'virtual void Foam::kOngWallFunctionFvPatchScalarField::updateCoeffs()':
    derivedFvPatchFields/wallFunctions/kqRWallFunctions/kOngWallFunction/kOngWallFunctionFvPatchScalarField.C:204:22: error: 'p' was not declared in this scope
     const fvMesh& mesh = p.boundaryMesh().mesh();
                          ^
    derivedFvPatchFields/wallFunctions/kqRWallFunctions/kOngWallFunction/kOngWallFunctionFvPatchScalarField.C:209:28: error: passing 'const volScalarField {aka const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}' as 'this' argument discards qualifiers [-fpermissive]
             k.boundaryFieldRef()[patchID] = 0;
    
    1 条回复 最后回复
  • 李东岳李 在线
    李东岳李 在线
    李东岳 管理员
    写于 最后由 编辑
    #8

    You should highlight you code yourself. Otherwise I need modify it everytime.

    The above code runs well if your put it inside the following

    template<class Type>
    Foam::kqRWallFunctionFvPatchField<Type>::kqRWallFunctionFvPatchField
    (
        const kqRWallFunctionFvPatchField& ptf,
        const fvPatch& p,
        const DimensionedField<Type, volMesh>& iF,
        const fvPatchFieldMapper& mapper
    )
    :
        zeroGradientFvPatchField<Type>(ptf, p, iF, mapper)
    {
        const fvMesh& mesh = p.boundaryMesh().mesh();
    }
    

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    1 条回复 最后回复
  • K 离线
    K 离线
    kimy
    写于 最后由 李东岳 编辑
    #9

    Hi Dongyue, I changed the codes as following, but the result dosn't change, k in the first grid is still not calculated by my formulation. I cannot understand.

     tmp<volScalarField> tk = turbModel.k();
         volScalarField k = tk;
    
        const tmp<scalarField> tnuw = turbModel.nu(patchi);
        const scalarField& nuw = tnuw();
        const tmp<scalarField> tnutw = turbModel.nut(patchi);
        const scalarField& nutw = tnutw();
    
        const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
    
        const scalarField magGradUw(mag(Uw.snGrad()));
    
        const scalar Cmu25 = pow025(Cmu_);
    
        scalarField& kw = *this;
    forAll(nutw,facei)
        {
             label celli = patch().faceCells()[facei];
    
                
                k[celli] =
                    
                   ((nutw[facei] + nuw[facei])*magGradUw[facei])*((nutw[facei] + nuw[facei])*magGradUw[facei])/(Cmu25*Cmu25);
          }
    1 条回复 最后回复
  • K 离线
    K 离线
    kimy
    在 中回复了 李东岳 最后由 李东岳 编辑
    #10

    @东岳 I tried to write these codes in simpleFoam.C,

    label patchID = mesh.boundaryMesh().findPatchID("wall");
    turbulence->k().boundaryFieldRef()[patchID] = 0;
    
    And I got the error:
    
    newsimpleFoam.C: In function 'int main(int, char**)':
    newsimpleFoam.C:77:25: error: 'class Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >' has no member named 'boundaryFieldRef' turbulence->k().boundaryFieldRef()[patchID] = 0;
    1 条回复 最后回复
  • 李东岳李 在线
    李东岳李 在线
    李东岳 管理员
    写于 最后由 编辑
    #11

    Thats a tmp, not a regular volScalarField, try turbulence->k().ref().boundaryFieldRef()[patchID] = 0;

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]