ala |
January 12, 2014 11:27 |
regionCoupled BC, problems with reading from a dictionary
Dear all,
first of all, I wish you a happy new year 2014!
I tried to extend the boundary condition "regionCoupled" by the radiation term.
I added two new entries to the field file "T", boundary field part, namely "Qr" and "QrNbr". Furthermore, I extended the constructors of the class "energyRegionCoupledFvPatchScalarField" to read the two terms "Qr" and "QrNbr":
- regionRadCoupled.H
Code:
// Constructors
//- Construct from patch and internal field
energyRegionRadCoupledFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
energyRegionRadCoupledFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
- regionRadCoupled.C
Code:
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// default constructor
Foam::energyRegionRadCoupledFvPatchScalarField::
energyRegionRadCoupledFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
coupledFvPatchField<scalar>(p, iF),
regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
method_(UNDEFINED),
nbrThermoPtr_(NULL),
thermoPtr_(NULL),
QrNbrName_("undefined-QrNbr"),
QrName_("undefined-Qr")
{}
// dict constructor
Foam::energyRegionRadCoupledFvPatchScalarField::
energyRegionRadCoupledFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
coupledFvPatchField<scalar>(p, iF, dict),
regionCoupledPatch_(refCast<const regionCoupledBaseFvPatch>(p)),
method_(UNDEFINED),
nbrThermoPtr_(NULL),
thermoPtr_(NULL),
QrNbrName_(dict.lookup("QrNbr")),
QrName_(dict.lookup("Qr"))
{
if (!isA<regionCoupledBase>(this->patch().patch()))
{
FatalErrorIn
(
"energyRegionRadCoupledFvPatchScalarField::"
"energyRegionRadCoupledFvPatchScalarField\n"
"(\n"
" const fvPatch& p,\n"
" const DimensionedField<scalar, volMesh>& iF,\n"
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << regionCoupledBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
<< exit(FatalError);
}
}
Unfortunately, during the execution I got the following error:
Code:
--> FOAM FATAL ERROR:
request for volScalarField undefined-Qr from objectRegistry liquid failed
available objects of type volScalarField are
14
(
thermo:mu
thermo:psi
K
h
rho
p_rgh
dpdt
gh
rhoPrevIter
p
T
thermo:rho
p_rghPrevIter
thermo:alpha
)
From function objectRegistry::lookupObject<Type>(const word&) const
in file /home/alkers/OpenFOAM/OpenFOAM-2.2.x/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 164.
FOAM aborting
Thus, I debugged it and saw that two instances of the class "energyRegionCoupledFvPatchScalarField" are created. The first gets created using the dict-constructor of the class and the second instance gets constructed by using the default constructor. Thus, the first instance has read the two terms from the field file, whereas the second instance initialized these two terms with "undefined-...". Furthermore, I found out, that the first instance does not get used during the execution of OpenFOAM (gdb awatch).
Does anybody know the reason why two instances of the class "energyRegionCoupledFvPatchScalarField" are created?
Does anybody have an idea how I can get the two terms "Qr" and "QrNbr" from the field file?
Any hints, ideas, ... are appreciate!
Thanks!
Best regards,
Ala
|