CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Custom BC compile warnings & Runtime Errors (http://www.cfd-online.com/Forums/openfoam-programming-development/92904-custom-bc-compile-warnings-runtime-errors.html)

Hisham September 28, 2011 15:05

Custom BC compile warnings & Runtime Errors
 
1 Attachment(s)
Dear Foamers,

I have modified some existing BCs (the timwVaryingMappedFixedValue and the tractionDisplacement). My goal is to make a timeVaryingMappedTractionDisplacement. I made what I believe to be the necessary modifications. I debugged apparent errors and it builds with warnings and an error :(. To me now, it is clear they are not just warnings they are errors because a sample problem crashes at initializing the variable for the BC, although it works fine for a displacement timwVaryingMappedFixedValue BC.

The warnings for the wmake:
Code:

hisham@numubuntu-System-Product-Name:~/OpenFOAM/numubuntu-2.0.0/trySolidDisplacementFoam$ wmake
Making dependency list for source file timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C
SOURCE=timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/finiteVolume/lnInclude -ItractionDisplacement/lnInclude -ItimeVaryingMappedTractionDisplacement/lnInclude -I/opt/openfoam200/src/triSurface/lnInclude -I/opt/openfoam200/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/timeVaryingMappedTractionDisplacementFvPatchVectorField.o
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H: In constructor ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::timeVaryingMappedTractionDisplacementFvPatchVectorField(const Foam::fvPatch&, const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&)’:
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:110:21: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::pressure_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:65:14: warning:  ‘Foam::word Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::fieldTableName_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:45:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:95:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:92:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:45:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:105:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:103:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:45:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H: In constructor ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::timeVaryingMappedTractionDisplacementFvPatchVectorField(const Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField&, const Foam::fvPatch&, const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&, const Foam::fvPatchFieldMapper&)’:
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:110:21: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::pressure_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:65:14: warning:  ‘Foam::word Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::fieldTableName_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:85:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:95:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:92:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:85:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:105:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:103:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:85:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H: In constructor ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::timeVaryingMappedTractionDisplacementFvPatchVectorField(const Foam::fvPatch&, const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&, const Foam::dictionary&)’:
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:95:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:92:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:123:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:105:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:103:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:123:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H: In copy constructor ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::timeVaryingMappedTractionDisplacementFvPatchVectorField(const Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField&)’:
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:110:21: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::pressure_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:65:14: warning:  ‘Foam::word Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::fieldTableName_’


Hisham September 28, 2011 15:06

Continue:

Code:

timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:171:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:95:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:92:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:171:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:105:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:103:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:171:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H: In constructor ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::timeVaryingMappedTractionDisplacementFvPatchVectorField(const Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField&, const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&)’:
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:110:21: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::pressure_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:65:14: warning:  ‘Foam::word Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::fieldTableName_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:206:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:95:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:92:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::startPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:206:1: warning:  when initialized here
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:105:16: warning: ‘Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endTractionAverage_’ will be initialized after
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.H:103:21: warning:  ‘Foam::scalarField Foam::timeVaryingMappedTractionDisplacementFvPatchVectorField::endPressureSampledValues_’
timeVaryingMappedTractionDisplacement/timeVaryingMappedTractionDisplacementFvPatchVectorField.C:206:1: warning:  when initialized here
g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam200/src/finiteVolume/lnInclude -ItractionDisplacement/lnInclude -ItimeVaryingMappedTractionDisplacement/lnInclude -I/opt/openfoam200/src/triSurface/lnInclude -I/opt/openfoam200/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam200/src/OpenFOAM/lnInclude -I/opt/openfoam200/src/OSspecific/POSIX/lnInclude  -fPIC -Xlinker --add-needed Make/linux64GccDPOpt/tractionDisplacementFvPatchVectorField.o Make/linux64GccDPOpt/timeVaryingMappedTractionDisplacementFvPatchVectorField.o Make/linux64GccDPOpt/trySolidDisplacementFoam.o -L/opt/openfoam200/platforms/linux64GccDPOpt/lib \
            -lfiniteVolume -lOpenFOAM -ldl  -lm -o /home/hisham/OpenFOAM/hisham-2.0.0/platforms/linux64GccDPOpt/bin/trySolidDisplacementFoam


The new BC is linked directly (statically) to the solver, just as the case with the solidDisplacementFoam solver and the tractionDisplacement BC. I, therefore, introduced a new solver called trySolidDisplacementFoam (no need to mess the original now, is there?)

I enclose the solver files and a tryPlateHole example. I hope that my error is easy to spot for someone (I am sure it is)!

Best regards,
Hisham

Hisham September 29, 2011 06:51

Dear Foamers,

I have modified it a bit. It compiles with warnings still. However, a run was successful. As I open paraFoam and choose to view the displacement "D", it crashes giving the following error:

Code:

hisham@numubuntu-System-Product-Name:~/solidDispFoamRun$ trySolidDisplacementFoam > log
hisham@numubuntu-System-Product-Name:~/solidDispFoamRun$ paraFoam &
[1] 3154
hisham@numubuntu-System-Product-Name:~/solidDispFoamRun$

--> FOAM FATAL IO ERROR:

    Cannot find 'value' entry on patch CaissonLeft of field D in file "/home/hisham/solidDispFoamRun/0/D"
    which is required to set the values of the generic patch field.
    (Actual type timeVaryingMappedTractionDisplacement)

    Please add the 'value' entry to the write function of the user-defined boundary-condition


file: /home/hisham/solidDispFoamRun/0/D::boundaryField::CaissonLeft from line 47 to line 48.

    From function genericFvPatchField<Type>::genericFvPatchField(const fvPatch&, const Field<Type>&, const dictionary&)
    in file genericFvPatchField/genericFvPatchField.C at line 71.

FOAM exiting

I have tried the following line in the write function of the BC:
Code:

writeEntry("value", os);
I also tried:
Code:

this->writeEntry("value", os);
Both give the same error! Please help me find out the problem. I can upload the current version of code upon request.

Best regards,
Hisham

Hisham September 29, 2011 08:23

I managed to solve the problems. It seems to work alright. Still needs more testing though. Anyone interested, please email me.

Thanks,
Hisham

ic3wall November 1, 2011 22:10

I had the same problem, when it says:

"... will be initialized after "

Make sure you declare your variables in the same order in both the .C and .H files

Hisham November 2, 2011 03:48

I guess this is a C++ issue ...

Maybe a link like this will help:
http://objectmix.com/c/343613-warnin...zed-after.html

Regards,
Hisham


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