Commit fbaea3c9 authored by mattijs's avatar mattijs
Browse files

ENH: findRefCell : allow findRefCell based on different field (think p and p_rgh)

parent a7dd6752
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,13 +30,14 @@ License
void Foam::setRefCell
(
const volScalarField& field,
const volScalarField& fieldRef,
const dictionary& dict,
label& refCelli,
scalar& refValue,
const bool forceReference
)
{
if (field.needReference() || forceReference)
if (fieldRef.needReference() || forceReference)
{
word refCellName = field.name() + "RefCell";
word refPointName = field.name() + "RefPoint";
......@@ -56,6 +57,7 @@ void Foam::setRefCell
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
......@@ -76,7 +78,7 @@ void Foam::setRefCell
point refPointi(dict.lookup(refPointName));
refCelli = field.mesh().findCell(refPointi);
label hasRef = (refCelli >= 0 ? 1 : 0);
label sumHasRef = returnReduce(hasRef, sumOp<label>());
label sumHasRef = returnReduce<label>(hasRef, sumOp<label>());
if (sumHasRef != 1)
{
FatalIOErrorIn
......@@ -84,6 +86,7 @@ void Foam::setRefCell
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
......@@ -103,6 +106,7 @@ void Foam::setRefCell
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
......@@ -119,6 +123,19 @@ void Foam::setRefCell
}
void Foam::setRefCell
(
const volScalarField& field,
const dictionary& dict,
label& refCelli,
scalar& refValue,
const bool forceReference
)
{
setRefCell(field, field, dict, refCelli, refValue, forceReference);
}
Foam::scalar Foam::getRefCellValue
(
const volScalarField& field,
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -44,8 +44,22 @@ SourceFiles
namespace Foam
{
//- Find the reference cell nearest (in index) to the given cell,
// but which is not on a cyclic, symmetry or processor patch.
//- If the field fieldRef needs referencing find the reference cell nearest
// (in index) to the given cell looked-up for field, but which is not on a
// cyclic, symmetry or processor patch.
void setRefCell
(
const volScalarField& field,
const volScalarField& fieldRef,
const dictionary& dict,
label& refCelli,
scalar& refValue,
const bool forceReference = false
);
//- If the field needs referencing find the reference cell nearest
// (in index) to the given cell looked-up for field, but which is not on a
// cyclic, symmetry or processor patch.
void setRefCell
(
const volScalarField& field,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment