ENH: Refactored porosity models to allow construction from known cellZone

This commit is contained in:
andy
2012-12-05 12:51:32 +00:00
parent 7b7d82bf81
commit 43910b56b2
9 changed files with 56 additions and 21 deletions

View File

@ -47,10 +47,11 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
porosityModel(name, modelType, mesh, dict),
porosityModel(name, modelType, mesh, dict, cellZoneName),
coordSys_(coeffs_, mesh),
D_("D", dimless/sqr(dimLength), tensor::zero),
F_("F", dimless/dimLength, tensor::zero),

View File

@ -136,7 +136,8 @@ public:
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
);
//- Destructor

View File

@ -102,10 +102,11 @@ Foam::porosityModels::fixedCoeff::fixedCoeff
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
porosityModel(name, modelType, mesh, dict),
porosityModel(name, modelType, mesh, dict, cellZoneName),
coordSys_(coeffs_, mesh),
alpha_("alpha", dimless/dimTime, tensor::zero),
beta_("beta", dimless/dimLength, tensor::zero)

View File

@ -113,7 +113,8 @@ public:
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
);
//- Destructor

View File

@ -73,17 +73,30 @@ Foam::porosityModel::porosityModel
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
name_(name),
mesh_(mesh),
dict_(dict),
coeffs_(dict.subDict(modelType + "Coeffs")),
active_(readBool(dict_.lookup("active"))),
zoneName_(dict_.lookup("cellZone")),
cellZoneIds_(mesh_.cellZones().findIndices(zoneName_))
active_(true),
zoneName_(),
cellZoneIds_()
{
if (cellZoneName == "unknown")
{
dict.lookup("actuve") >> active_;
dict_.lookup("cellZone") >> zoneName_;
}
else
{
zoneName_ = cellZoneName;
}
cellZoneIds_ = mesh_.cellZones().findIndices(zoneName_);
Info<< " creating porous zone: " << zoneName_ << endl;
bool foundZone = !cellZoneIds_.empty();
@ -99,6 +112,7 @@ Foam::porosityModel::porosityModel
"const word&, "
"const fvMesh&, "
"const dictionary&"
"const word&, "
")"
) << "cannot find porous cellZone " << zoneName_
<< exit(FatalError);

View File

@ -127,9 +127,10 @@ public:
const word& modelName,
const word& name,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
),
(modelName, name, mesh, dict)
(modelName, name, mesh, dict, cellZoneName)
);
//- Constructor
@ -138,7 +139,8 @@ public:
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
);
//- Return pointer to new porosityModel object created on the freestore
@ -182,7 +184,8 @@ public:
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName = "unknown"
);
//- Destructor

View File

@ -31,7 +31,8 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
{
const word modelType(dict.lookup("type"));
@ -48,9 +49,10 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
(
"porosityModel::New"
"("
"const word& name,"
"const word&, "
"const fvMesh&, "
"const dictionary&"
"const dictionary&, "
"const word&"
")"
)
<< "Unknown " << typeName << " type " << modelType << nl << nl
@ -59,7 +61,17 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New
<< exit(FatalError);
}
return autoPtr<porosityModel>(cstrIter()(name, modelType, mesh, dict));
return autoPtr<porosityModel>
(
cstrIter()
(
name,
modelType,
mesh,
dict,
cellZoneName
)
);
}

View File

@ -47,10 +47,11 @@ Foam::porosityModels::powerLaw::powerLaw
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
)
:
porosityModel(name, modelType, mesh, dict),
porosityModel(name, modelType, mesh, dict, cellZoneName),
C0_(readScalar(coeffs_.lookup("C0"))),
C1_(readScalar(coeffs_.lookup("C1"))),
rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho"))

View File

@ -117,7 +117,8 @@ public:
const word& name,
const word& modelType,
const fvMesh& mesh,
const dictionary& dict
const dictionary& dict,
const word& cellZoneName
);
//- Destructor