在不同的block中设置不同的物性参数
-
我最终的目的是希望在不同的区域设置不同的扩散系数. 为了实现这个, 我觉得首先要识别区域, 因此想要参考已有的求解器中如何识别区域的. 在porousSimpleFoam的算例中有几个angledDuct的例子, 这几个例子里面在blockMeshDict 里面设置了三个区域: 分别命名为“inlet”, “porosity”, “outlet”. 我猜测porousSimpleFoam是通过名称来识别区域, 并确定是否添加多孔介质源项的. 因此, 我又查看了porousSimpleFoam求解器源代码里面: createPorousZones.H, 这里面有一句
IOporosityModelList pZones(mesh);
我又查看了IOporosityModelList的构造函数
Foam::porosityModelList::porosityModelList ( const fvMesh& mesh, const dictionary& dict ) : PtrList<porosityModel>(), mesh_(mesh) { reset(dict); active(true); } 里面用到了 reset()和active()两个函数来构造
这两个函数的代码如下bool Foam::porosityModelList::active(const bool warn) const { bool anyOk = false; forAll(*this, i) { anyOk = anyOk || this->operator[](i).active(); } if (warn && this->size() && !anyOk) { Info<< "No porosity models active" << endl; } return anyOk; } void Foam::porosityModelList::reset(const dictionary& dict) { label count = 0; for (const entry& dEntry : dict) { if (dEntry.isDict()) { ++count; } } this->resize(count); count = 0; for (const entry& dEntry : dict) { if (dEntry.isDict()) { const word& name = dEntry.keyword(); const dictionary& modelDict = dEntry.dict(); this->set ( count++, porosityModel::New(name, mesh_, modelDict) ); } } } 但是我还是没有看出来是如何识别多孔区域的. 求大神给解释一下
-
自问自答一波:
我现在感觉好像是检查constant/porosityProperties 文件里面的字典. 只要里面存在字典 cellZone(键) 对应的 name_(值)的block就被当作是多孔介质, 然后通过cellZoneID = mesh.cellZone().indices(name_)
这个函数来确认该区域的ID
上述内容是在
porosityModel.H porosityModel.C中感觉到的.但是没有找到实质的证据.
2019年7月23日 15:22
2/2
2019年7月24日 04:02