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

defining a protected variable blows the solution

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2016, 16:09
Default defining a protected variable blows the solution
  #1
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
Hi,

I'm trying to develop a boundary condition based on the mappedField boundary condition that already exists.
At the very first steps something happens that I can't comprehend it, if anyone can give me any clue I would appreciate it.

After copying and renaming, I added a variable to the file mappedPatchFieldBase.H as:

Code:
template<class Type>
class mappedPatchFieldBase
{

protected:

    // Protected data

        //- Mapping engine
        const mappedPatchBase& mapper_;

        //- Underlying patch field
        const fvPatchField<Type>& patchField_;

        //- Name of field to sample
        word fieldName_;

        word fieldMeanName_;  //this is cause of error!!!!

        //- If true adjust the mapped field to maintain average value average_
        const bool setAverage_;

        //- Average value the mapped field is adjusted to maintain if
        //  setAverage_ is set true
        const Type average_;

        //- Interpolation scheme to use for nearestcell mode
        word interpolationScheme_;
the marked line is what I add, to my surprise this simple line without any further modification was the reason of the following error:

Code:
#0  Foam::error::printStack(Foam::Ostream&) in "/usr/local/openfoam-3.0/OpenFOAM-v3.0+/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so"
#1  Foam::sigSegv::sigHandler(int) in "/usr/local/openfoam-3.0/OpenFOAM-v3.0+/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so"
#2  ? in "/lib64/libc.so.6"
#3  std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) in "/usr/local/gcc-4.6.4/lib64/libstdc++.so.6"
#4  Foam::mappedTurbFvPatchField<Foam::Vector<double> >::mappedTurbFvPatchField(Foam::mappedTurbFvPatchField<Foam::Vector<double> > const&, Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&) in "/home/mahdih/OpenFOAM/mahdih-v3.0+/platforms/linux64GccDPInt32Opt/lib/libMyBCs.so"
#5  Foam::mappedTurbFvPatchField<Foam::Vector<double> >::clone(Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&) const in "/home/mahdih/OpenFOAM/mahdih-v3.0+/platforms/linux64GccDPInt32Opt/lib/libMyBCs.so"
#6  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricBoundaryField(Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField const&) in "/usr/local/openfoam-3.0/OpenFOAM-v3.0+/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
#7  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/usr/local/openfoam-3.0/OpenFOAM-v3.0+/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
#8  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::oldTime() const in "/usr/local/openfoam-3.0/OpenFOAM-v3.0+/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
#9  Foam::fv::backwardDdtScheme<Foam::Vector<double> >::fvmDdt(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&) in "/usr/local/openfoam-3.0/OpenFOAM-v3.0+/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so"
#10  ? at pisoFoam.C:0
#11  ? in "/usr/local/openfoam-3.0/OpenFOAM-v3.0+/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
#12  __libc_start_main in "/lib64/libc.so.6"
#13  __gxx_personality_v0 in "/usr/local/openfoam-3.0/OpenFOAM-v3.0+/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
Segmentation fault (core dumped)
and even more surprisingly after playing around I figured out that just moving it at the end of the protected list does not lead to any error!!!!
Though this is not causing any error now but I'm just baffled by what's happening and would appreciate any input.
anishtain4 is offline   Reply With Quote

Old   June 28, 2016, 15:39
Default
  #2
Senior Member
 
Hassan Kassem
Join Date: May 2010
Location: Germany
Posts: 242
Rep Power: 18
hk318i is on a distinguished road
Have you updated .C file?
__________________
@HIKassem | HassanKassem.me
hk318i is offline   Reply With Quote

Reply


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
CFL Condition Matt Umbel Main CFD Forum 19 June 30, 2020 09:20
Filtering DNS solutions Vs projecting filtered DNS solution juliom Main CFD Forum 5 May 19, 2016 17:06
[OpenFOAM] error in 0 folder by defining a variable in another place immortality ParaView 0 August 13, 2013 02:51
help, solution blows up! noName Main CFD Forum 3 May 10, 2005 02:26
Wall functions Abhijit Tilak Main CFD Forum 6 February 5, 1999 02:16


All times are GMT -4. The time now is 21:14.