CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   defining a protected variable blows the solution (https://www.cfd-online.com/Forums/openfoam-programming-development/173785-defining-protected-variable-blows-solution.html)

anishtain4 June 27, 2016 15:09

defining a protected variable blows the solution
 
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.

hk318i June 28, 2016 14:39

Have you updated .C file?


All times are GMT -4. The time now is 18:47.