CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

regionCoupled BC, problems with reading from a dictionary

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 12, 2014, 12:27
Default regionCoupled BC, problems with reading from a dictionary
  #1
ala
New Member
 
Alicja M
Join Date: Mar 2009
Location: Erlangen, DE
Posts: 26
Rep Power: 8
ala is on a distinguished road
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
ala is offline   Reply With Quote

Old   June 20, 2014, 13:20
Default
  #2
Senior Member
 
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 149
Rep Power: 6
mm.abdollahzadeh is on a distinguished road
Quote:
Originally Posted by ala View Post
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
Hi Ala

Did u checked the new release of foam extended 3.1?
the boundary condition that u want is already implemented.
http://sourceforge.net/p/openfoam-ex...fvPatchFields/

best
mahdi
mm.abdollahzadeh is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cht tutorial in 15 braennstroem OpenFOAM Running, Solving & CFD 197 June 10, 2015 03:02
Defining "cyclic" B.C. problem maysmech OpenFOAM 20 March 14, 2011 11:28
Cyclic B.C -interDyMFOAM-Gambit Mesh-Parallel farhagim OpenFOAM 3 March 13, 2011 00:29
Problems with OpenFoaminterFoam and ACE dingo1234 OpenFOAM Running, Solving & CFD 0 January 6, 2009 10:08
FoamX error aachenBomb case Ervin Adorean (Adorean) OpenFOAM Pre-Processing 13 March 7, 2005 04:50


All times are GMT -4. The time now is 09:11.