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

Heat transfer coefficient as a function of T in externalWallHeatFluxTemperature

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 2, 2024, 07:27
Default Heat transfer coefficient as a function of T in externalWallHeatFluxTemperature
  #1
Member
 
Nikos
Join Date: Aug 2012
Location: Greece
Posts: 30
Rep Power: 14
nikoscham is on a distinguished road
Hi all. I am trying to calculate h (heat transfer coefficient) as a function of temperature in the externalWallHeatFluxTemperature boundary condition. I am trying the following expression (as proposed by the GPT), however, it does not work (as expected :-) ):

Code:
    wall_hangoff
    {
        type            externalWallHeatFluxTemperature;
        mode            coefficient;
        Ta              constant 298.15;
        h               coded;
        code
        #{
            const volScalarField& T = this->db().lookupObject<volScalarField>("T");
            scalarField& h = this->refValue();
            forAll(h, i)
            {
                scalar Ti = T[i];
                // Example: h as a linear function of T
                h[i] = 1.0 + 0.01 * (Ti - 298.15); // Customize this function as needed
            }
        #};
        emissivity      0.7;
        kappaMethod     fluidThermo;
        value           $internalField;
    }
the error log contains the following that may be (or may be not) useful:

ln: ./lnInclude
dep: codedPatchFunction1Template.C
Ctoo: codedPatchFunction1Template.C
T.boundaryField.wall_hangoff: In member function ‘virtual Foam::tmp<Foam::Field<double> > Foam::PatchFunction1Types::hPatchFunction1ScalarFi eld::value(Foam::scalar) const’:
T.boundaryField.wall_hangoff:36:33: error: ‘const class Foam::PatchFunction1Types::hPatchFunction1ScalarFi eld’ has no member named ‘db’
T.boundaryField.wall_hangoff:36:65: error: expected primary-expression before ‘>’ token
T.boundaryField.wall_hangoff:37:36: error: ‘const class Foam::PatchFunction1Types::hPatchFunction1ScalarFi eld’ has no member named ‘refValue’; did you mean ‘value’?
T.boundaryField.wall_hangoff:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
make: *** [/opt/OpenFOAM/OpenFOAM-v2012/wmake/rules/General/transform:35: Make/linux64Gcc63DPInt32Opt/codedPatchFunction1Template.o] Error 1
[0]
[0]
[0] --> FOAM FATAL IO ERROR: (openfoam-2012)
[0] Failed wmake "dynamicCode/h/platforms/linux64Gcc63DPInt32Opt/lib/libh_2489b12f7e3e1a05b832a09186ffb5a47d33b78f.so"
[0]
[0]
[0] T.boundaryField.wall_hangoff at line 31 to 47.
[0]
[0] From void Foam::codedBase::createLibrary(Foam::dynamicCode&, const Foam::dynamicCodeContext&) const
[0] in file db/dynamicLibrary/codedBase/codedBase.C at line 201.
[0]
FOAM parallel run exiting
[0]

Do you have any clue of how can I do it?
My OpenFOAM version is v2012. I am using the chtMultiRegionSimpleFoam solver.
Thanks in advance
Nikos
nikoscham is offline   Reply With Quote

Old   July 3, 2024, 10:04
Default
  #2
New Member
 
Yueyun Xi
Join Date: Nov 2022
Posts: 14
Rep Power: 4
yueyun is on a distinguished road
Hi Nikos,

From your error message, the problem is you cannot access T field in this way.
Code:
const volScalarField& T = this->db().lookupObject<volScalarField>("T");
Would you please try
Code:
wall_hangoff
    {
        type            externalWallHeatFluxTemperature;
        mode            coefficient;
        Ta              constant 298.15;
        h               #codeStream
        {
            codeInclude
            #{
                #include "fvCFD.H"
            #};
            
            codeOptions
            #{
                -I$(LIB_SRC)/finiteVolume/lnInclude \
                -I$(LIB_SRC)/meshTools/lnInclude
            #};
            
            codeLibs
            #{
                -lmeshTools \
                -lfiniteVolume
            #};

            code
            #{
                const IOdictionary& d = static_cast<const IOdictionary&>
                (
                    dict.parent().parent()
                );
                const fvMesh& mesh = refCast<const fvMesh>(d.db());
                const volScalarField& T = mesh.lookupObject<volScalarField>("T");
                scalarField& h = this->refValue();
                 forAll(h, i)
                {
                    scalar Ti = T[i];
                    // Example: h as a linear function of T
                    h[i] = 1.0 + 0.01 * (Ti - 298.15); // Customize this function as needed
                }

            #};
        }
        emissivity      0.7;
        kappaMethod     fluidThermo;
        value           $internalField;
    }
Best wishes,
Yueyun
yueyun is offline   Reply With Quote

Old   July 4, 2024, 11:50
Default
  #3
Member
 
Nikos
Join Date: Aug 2012
Location: Greece
Posts: 30
Rep Power: 14
nikoscham is on a distinguished road
Thanks a lot for your reply Yueyun!
Unfortunately it doesn't work.. The error now appears during 'DecomposePar':

Using #codeStream at line 34 in file "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_air/T.boundaryField.wall_hangoff"
Using #codeStream with "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_2eec51d933a52843410f549576af5ae20fb3 639f.so"
Could not load "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_2eec51d933a52843410f549576af5ae20fb3 639f.so"
/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_2eec51d933a52843410f549576af5ae20fb3 639f.so: cannot open shared object file: No such file or directory
Creating new library in "dynamicCode/_2eec51d933a52843410f549576af5ae20fb3639f/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_2eec51d933a52843410f549576af5ae20fb3 639f.so"
Invoking wmake libso /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/_2eec51d933a52843410f549576af5ae20fb3639f
wmake libso /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/_2eec51d933a52843410f549576af5ae20fb3639f
ln: ./lnInclude
dep: codeStreamTemplate.C
Ctoo: codeStreamTemplate.C
/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_air/T.boundaryField.wall_hangoff.#codeStream: In function ‘void Foam::codeStream_2eec51d933a52843410f549576af5ae20 fb3639f(Foam::Ostream&, const Foam::dictionary&)’:
/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_air/T.boundaryField.wall_hangoff.#codeStream:61:34: error: invalid use of ‘this’ in non-member function
make: *** [/opt/OpenFOAM/OpenFOAM-v2012/wmake/rules/General/transform:35: Make/linux64Gcc63DPInt32Opt/codeStreamTemplate.o] Error 1


--> FOAM FATAL IO ERROR: (openfoam-2012)
Failed wmake "dynamicCode/_2eec51d933a52843410f549576af5ae20fb3639f/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_2eec51d933a52843410f549576af5ae20fb3 639f.so"


file: /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_air/T.boundaryField.wall_hangoff at line 31 to 33.

From static void (* Foam::functionEntries::codeStream::getFunction(con st Foam::dictionary&, const Foam::dictionary&))(Foam::Ostream&, const Foam::dictionary&)
in file db/dictionary/functionEntries/codeStream/codeStream.C at line 197.

FOAM exiting
nikoscham is offline   Reply With Quote

Old   July 7, 2024, 12:29
Default Error in using decomposepar
  #4
New Member
 
Arunkl
Join Date: Jun 2024
Posts: 7
Rep Power: 2
arunkl is on a distinguished road
HI i am trying to use a custom drag model for multiphase flow i can compile it using single core and it runs well but in multi core i have came with a warning

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"


Decomposing mesh region0

Reading "decomposeParDict"

Create mesh

Calculating distribution of cells
Selecting decompositionMethod simple

Finished decomposition in 0.06 s

Calculating original mesh data

Distributing cells to processors

Distributing faces to processors

Distributing points to processors

Constructing processor meshes
--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"

Processor 0
    Number of cells = 54000
    Number of faces shared with processor 1 = 720
    Number of processor patches = 1
    Number of processor faces = 720
    Number of boundary faces = 4320
--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"

Processor 1
    Number of cells = 54000
    Number of faces shared with processor 0 = 720
    Number of processor patches = 1
    Number of processor faces = 720
    Number of boundary faces = 4320

Number of processor faces = 720
Max number of cells = 54000 (0% above average 54000)
Max number of processor patches = 1 (0% above average 1)
Max number of faces between processors = 720 (0% above average 720)

Time = 0

Processor 0: field transfer
--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"
Processor 1: field transfer
--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"

End

can anyone help me in this my openfoam version is 9 thanks in advance
arunkl is offline   Reply With Quote

Old   July 8, 2024, 11:42
Default
  #5
Member
 
Nikos
Join Date: Aug 2012
Location: Greece
Posts: 30
Rep Power: 14
nikoscham is on a distinguished road
Quote:
Originally Posted by arunkl View Post
HI i am trying to use a custom drag model for multiphase flow i can compile it using single core and it runs well but in multi core i have came with a warning

Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"


Decomposing mesh region0

Reading "decomposeParDict"

Create mesh

Calculating distribution of cells
Selecting decompositionMethod simple

Finished decomposition in 0.06 s

Calculating original mesh data

Distributing cells to processors

Distributing faces to processors

Distributing points to processors

Constructing processor meshes
--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"

Processor 0
    Number of cells = 54000
    Number of faces shared with processor 1 = 720
    Number of processor patches = 1
    Number of processor faces = 720
    Number of boundary faces = 4320
--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"

Processor 1
    Number of cells = 54000
    Number of faces shared with processor 0 = 720
    Number of processor patches = 1
    Number of processor faces = 720
    Number of boundary faces = 4320

Number of processor faces = 720
Max number of cells = 54000 (0% above average 54000)
Max number of processor patches = 1 (0% above average 1)
Max number of faces between processors = 720 (0% above average 720)

Time = 0

Processor 0: field transfer
--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"
Processor 1: field transfer
--> FOAM Warning :
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1247
    dlopen error : /opt/openfoam9/platforms/linux64GccDPInt32Opt/lib/libphaseSystem.so: undefined symbol: _ZN4Foam15saturationModel8typeNameE
--> FOAM Warning :
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 106
    could not load "libIshiiZuberModModel.so"

End
can anyone help me in this my openfoam version is 9 thanks in advance

Hi arunkl! I suppose you replied in a wrong thread..
nikoscham is offline   Reply With Quote

Old   July 8, 2024, 11:48
Default
  #6
Member
 
Nikos
Join Date: Aug 2012
Location: Greece
Posts: 30
Rep Power: 14
nikoscham is on a distinguished road
I think I have made some progress. I am using the following code for creating a custom function of h within externalWallHeatFluxTemperature boundary condition. Unfortunately, I cannot access the temperature at the boundary faces:

Code:
wall_hangoff
    {
        type            externalWallHeatFluxTemperature;
        mode            coefficient;
        Ta              constant 298.15;
        h               #codeStream
        {

            codeInclude
            #{
                #include "fvCFD.H"
           #};

            codeOptions
            #{
                -I$(LIB_SRC)/finiteVolume/lnInclude \
                -I$(LIB_SRC)/meshTools/lnInclude
            #};

            codeLibs
            #{
                -lmeshTools \
                -lfiniteVolume
            #};

            code
            #{
                const IOdictionary& d = static_cast<const IOdictionary&>
                (
                    dict.parent().parent()
                ); // access current directory

                const fvMesh& mesh = refCast<const fvMesh>(d.db()); // access mesh database

                const label id = mesh.boundary().findPatchID("wall_hangoff"); // label id of patch

                const fvPatch& boundaryPatch = mesh.boundary()[id]; // access boundary mesh information using label id

                const vectorField& Cf = boundaryPatch.Cf(); // access coordinates of cells [Used for test purposes]

                const volScalarField& T = mesh.lookupObject<volScalarField>("T"); // access temperature field

                //const scalarField& Tb = T.boundaryField()[id]; // temperature at boundary faces [NOT WORKING]

                scalarField h(boundaryPatch.size(), 0); // initialise h field

                forAll(h, i)

                {

                    //scalar Ti = Tb[i]; // temperature at face i
                    scalar x = Cf[i].x(); // x coordinate of the faces i [Used for test purposes]
                    scalar y = Cf[i].y(); // y coordinate of the faces i [Used for test purposes]
                    //h[i] = 1.0 + 0.01 * (Ti - 298.15);
                    h[i] = scalar (0.5 + x + y); // Used for test purposes

                }

                os << " nonuniform List<scalar> " << h;
            #};

        }

        emissivity      0.7;
        thicknessLayers (0.0001);
        kappaLayers     (45);
        kappaMethod     solidThermo;
        value           $internalField;

    }
The above code works without problems. However, when I try to access the temperature at the boundary faces by uncommenting the line “//const scalarField& Tb = T.boundaryField()[id];” , I get the following error during “pecomposePar” phase:

Using #codeStream at line 34 in file "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_mp/T.boundaryField.wall_hangoff"

Using #codeStream with "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so"

Could not load "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so"

/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so: cannot open shared object file: No such file or directory

Creating new library in "dynamicCode/_62d25ae084a4cdeeccf3c013078048a256da11ce/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so"

Invoking wmake libso /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/_62d25ae084a4cdeeccf3c013078048a256da11ce

wmake libso /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/_62d25ae084a4cdeeccf3c013078048a256da11ce

ln: ./lnInclude

dep: codeStreamTemplate.C

Ctoo: codeStreamTemplate.C

/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_mp/T.boundaryField.wall_hangoff.#codeStream: In function ‘void Foam::codeStream_62d25ae084a4cdeeccf3c013078048a25 6da11ce(Foam::Ostream&, const Foam::dictionary&)’:

/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_mp/T.boundaryField.wall_hangoff.#codeStream:64:36: warning: unused variable ‘Tb’ [-Wunused-variable]

ld: /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/_62d25ae084a4cdeeccf3c013078048a256da11ce/../platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so





--> FOAM FATAL ERROR: (openfoam-2012)

Cannot dereference nullptr at index 1 in range [0,7)





From const T& Foam::UPtrList<T>:perator[](Foam::label) const [with T = Foam::fvPatchField<double>; Foam::label = int]

in file /opt/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/UPtrListI.H at line 218.



FOAM aborting



#0 Foam::error:rintStack(Foam::Ostream&) at ??:?

#1 Foam::error::exitOrAbort(int, bool) at ??:?

#2 codeStream_62d25ae084a4cdeeccf3c013078048a256da11c e at /opt/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/errorManip.H:92

#3 Foam::functionEntries::codeStream::evaluate(Foam:: dictionary const&, Foam::Istream&) at ??:?

#4 Foam::functionEntries::codeStream::execute(Foam::d ictionary const&, Foam:rimitiveEntry&, Foam::Istream&) at ??:?

#5 Foam::functionEntry::execute(Foam::word const&, Foam::dictionary const&, Foam:rimitiveEntry&, Foam::Istream&) at ??:?

#6 Foam:rimitiveEntry::acceptToken(Foam::token const&, Foam::dictionary const&, Foam::Istream&) at ??:?

#7 Foam:rimitiveEntry::read(Foam::dictionary const&, Foam::Istream&) at ??:?

#8 Foam:rimitiveEntry::readEntry(Foam::dictionary const&, Foam::Istream&) at ??:?

#9 Foam:rimitiveEntry:rimitiveEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?

#10 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?

#11 Foam::dictionary::read(Foam::Istream&, bool) at ??:?

#12 Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&, bool) at ??:?

#13 Foam::dictionaryEntry::dictionaryEntry(Foam::keyTy pe const&, Foam::dictionary const&, Foam::Istream&) at ??:?

#14 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?

#15 Foam::dictionary::read(Foam::Istream&, bool) at ??:?

#16 Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&, bool) at ??:?

#17 Foam::dictionaryEntry::dictionaryEntry(Foam::keyTy pe const&, Foam::dictionary const&, Foam::Istream&) at ??:?

#18 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?

#19 Foam::dictionary::read(Foam::Istream&, bool) at ??:?

#20 Foam:perator>>(Foam::Istream&, Foam::dictionary&) at ??:?

#21 Foam::baseIOdictionary::readData(Foam::Istream&) at ??:?

#22 Foam::fileOperations::uncollatedFileOperation::rea d(Foam::regIOobject&, bool, Foam::IOstreamOption::streamFormat, Foam::word const&) const at ??:?

#23 Foam::regIOobject::readHeaderOk(Foam::IOstreamOpti on::streamFormat, Foam::word const&) at ??:?

#24 Foam::localIOdictionary::localIOdictionary(Foam::I Oobject const&, Foam::word const&) at ??:?

#25 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::readFields() at ??:?

#26 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&, bool) at ??:?

#27 ? at ??:?

#28 ? at ??:?

#29 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6

#30 ? at ??:?

Aborted (core dumped)


Do you think that I am on the right path? I would appreciate any advices. Is the boundary temperature expression wrong?

Thanks a lot!
nikoscham is offline   Reply With Quote

Old   December 2, 2024, 09:11
Default
  #7
New Member
 
Join Date: Jul 2009
Posts: 6
Rep Power: 17
nando83 is on a distinguished road
Hi nikosham,
I am trying to implement the same logic with no success.
Have you solved?
Please let me know.
Thank you,
Nando


Quote:
Originally Posted by nikoscham View Post
I think I have made some progress. I am using the following code for creating a custom function of h within externalWallHeatFluxTemperature boundary condition. Unfortunately, I cannot access the temperature at the boundary faces:

Code:
wall_hangoff
    {
        type            externalWallHeatFluxTemperature;
        mode            coefficient;
        Ta              constant 298.15;
        h               #codeStream
        {

            codeInclude
            #{
                #include "fvCFD.H"
           #};

            codeOptions
            #{
                -I$(LIB_SRC)/finiteVolume/lnInclude \
                -I$(LIB_SRC)/meshTools/lnInclude
            #};

            codeLibs
            #{
                -lmeshTools \
                -lfiniteVolume
            #};

            code
            #{
                const IOdictionary& d = static_cast<const IOdictionary&>
                (
                    dict.parent().parent()
                ); // access current directory

                const fvMesh& mesh = refCast<const fvMesh>(d.db()); // access mesh database

                const label id = mesh.boundary().findPatchID("wall_hangoff"); // label id of patch

                const fvPatch& boundaryPatch = mesh.boundary()[id]; // access boundary mesh information using label id

                const vectorField& Cf = boundaryPatch.Cf(); // access coordinates of cells [Used for test purposes]

                const volScalarField& T = mesh.lookupObject<volScalarField>("T"); // access temperature field

                //const scalarField& Tb = T.boundaryField()[id]; // temperature at boundary faces [NOT WORKING]

                scalarField h(boundaryPatch.size(), 0); // initialise h field

                forAll(h, i)

                {

                    //scalar Ti = Tb[i]; // temperature at face i
                    scalar x = Cf[i].x(); // x coordinate of the faces i [Used for test purposes]
                    scalar y = Cf[i].y(); // y coordinate of the faces i [Used for test purposes]
                    //h[i] = 1.0 + 0.01 * (Ti - 298.15);
                    h[i] = scalar (0.5 + x + y); // Used for test purposes

                }

                os << " nonuniform List<scalar> " << h;
            #};

        }

        emissivity      0.7;
        thicknessLayers (0.0001);
        kappaLayers     (45);
        kappaMethod     solidThermo;
        value           $internalField;

    }
The above code works without problems. However, when I try to access the temperature at the boundary faces by uncommenting the line “//const scalarField& Tb = T.boundaryField()[id];” , I get the following error during “pecomposePar” phase:

Using #codeStream at line 34 in file "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_mp/T.boundaryField.wall_hangoff"

Using #codeStream with "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so"

Could not load "/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so"

/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so: cannot open shared object file: No such file or directory

Creating new library in "dynamicCode/_62d25ae084a4cdeeccf3c013078048a256da11ce/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so"

Invoking wmake libso /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/_62d25ae084a4cdeeccf3c013078048a256da11ce

wmake libso /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/_62d25ae084a4cdeeccf3c013078048a256da11ce

ln: ./lnInclude

dep: codeStreamTemplate.C

Ctoo: codeStreamTemplate.C

/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_mp/T.boundaryField.wall_hangoff.#codeStream: In function ‘void Foam::codeStream_62d25ae084a4cdeeccf3c013078048a25 6da11ce(Foam::Ostream&, const Foam::dictionary&)’:

/mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/0/domain_mp/T.boundaryField.wall_hangoff.#codeStream:64:36: warning: unused variable ‘Tb’ [-Wunused-variable]

ld: /mnt/d/openFOAM_chtMultiRegionSimpleFoam_mesh_convert/dynamicCode/_62d25ae084a4cdeeccf3c013078048a256da11ce/../platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_62d25ae084a4cdeeccf3c013078048a256da 11ce.so





--> FOAM FATAL ERROR: (openfoam-2012)

Cannot dereference nullptr at index 1 in range [0,7)





From const T& Foam::UPtrList<T>:perator[](Foam::label) const [with T = Foam::fvPatchField<double>; Foam::label = int]

in file /opt/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/UPtrListI.H at line 218.



FOAM aborting



#0 Foam::error:rintStack(Foam::Ostream&) at ??:?

#1 Foam::error::exitOrAbort(int, bool) at ??:?

#2 codeStream_62d25ae084a4cdeeccf3c013078048a256da11c e at /opt/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/errorManip.H:92

#3 Foam::functionEntries::codeStream::evaluate(Foam:: dictionary const&, Foam::Istream&) at ??:?

#4 Foam::functionEntries::codeStream::execute(Foam::d ictionary const&, Foam:rimitiveEntry&, Foam::Istream&) at ??:?

#5 Foam::functionEntry::execute(Foam::word const&, Foam::dictionary const&, Foam:rimitiveEntry&, Foam::Istream&) at ??:?

#6 Foam:rimitiveEntry::acceptToken(Foam::token const&, Foam::dictionary const&, Foam::Istream&) at ??:?

#7 Foam:rimitiveEntry::read(Foam::dictionary const&, Foam::Istream&) at ??:?

#8 Foam:rimitiveEntry::readEntry(Foam::dictionary const&, Foam::Istream&) at ??:?

#9 Foam:rimitiveEntry:rimitiveEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?

#10 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?

#11 Foam::dictionary::read(Foam::Istream&, bool) at ??:?

#12 Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&, bool) at ??:?

#13 Foam::dictionaryEntry::dictionaryEntry(Foam::keyTy pe const&, Foam::dictionary const&, Foam::Istream&) at ??:?

#14 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?

#15 Foam::dictionary::read(Foam::Istream&, bool) at ??:?

#16 Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&, bool) at ??:?

#17 Foam::dictionaryEntry::dictionaryEntry(Foam::keyTy pe const&, Foam::dictionary const&, Foam::Istream&) at ??:?

#18 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?

#19 Foam::dictionary::read(Foam::Istream&, bool) at ??:?

#20 Foam:perator>>(Foam::Istream&, Foam::dictionary&) at ??:?

#21 Foam::baseIOdictionary::readData(Foam::Istream&) at ??:?

#22 Foam::fileOperations::uncollatedFileOperation::rea d(Foam::regIOobject&, bool, Foam::IOstreamOption::streamFormat, Foam::word const&) const at ??:?

#23 Foam::regIOobject::readHeaderOk(Foam::IOstreamOpti on::streamFormat, Foam::word const&) at ??:?

#24 Foam::localIOdictionary::localIOdictionary(Foam::I Oobject const&, Foam::word const&) at ??:?

#25 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::readFields() at ??:?

#26 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&, bool) at ??:?

#27 ? at ??:?

#28 ? at ??:?

#29 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6

#30 ? at ??:?

Aborted (core dumped)


Do you think that I am on the right path? I would appreciate any advices. Is the boundary temperature expression wrong?

Thanks a lot!
nando83 is offline   Reply With Quote

Old   December 2, 2024, 13:59
Default
  #8
Member
 
Nikos
Join Date: Aug 2012
Location: Greece
Posts: 30
Rep Power: 14
nikoscham is on a distinguished road
Quote:
Originally Posted by nando83 View Post
Hi nikosham,
I am trying to implement the same logic with no success.
Have you solved?
Please let me know.
Thank you,
Nando

Dear Nando,

I have made some progress on this issue. I am now using codedMixed condition based on the following thread: Temperature dependent heat flux condition

I hope it helps
Best regards,
Nikos
nikoscham is offline   Reply With Quote

Reply

Tags
custom function, heat flux, heat transfer coefficient, openfoam


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difficulty In Setting Boundary Conditions Moinul Haque CFX 4 November 25, 2014 18:30
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 10:31
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 01:35
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


All times are GMT -4. The time now is 07:17.