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

Error: no match for operator/

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2020, 07:51
Default Error: no match for operator/
  #1
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
Hello everyone,


I am trying to modify the totalTemperature BC to make it time varying. I am trying to construct the new BC uniformTotalTemperature for that reason.
I am getting this error message and I cannot find the reason why it appears:


Code:
fields/fvPatchFields/derived/uniformTotalTemperature/uniformTotalTemperatureFvPatchScalarField.C: In member function ‘virtual void Foam::uniformTotalTemperatureFvPatchScalarField::updateCoeffs()’:
fields/fvPatchFields/derived/uniformTotalTemperature/uniformTotalTemperatureFvPatchScalarField.C:158:19: error: no match for ‘operator/’ (operand types are ‘Foam::autoPtr<Foam::Function1<double> >’ and ‘Foam::tmp<Foam::Field<double> >’)
     operator==(T0_/(1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up)));
The corresponding lines are:


Code:
void Foam::uniformTotalTemperatureFvPatchScalarField::updateCoeffs()
{
    if (updated())
    {
        return;
    }

    scalar T0 = T0_->value(this->db().time().timeOutputValue());

    const fvPatchVectorField& Up =
        patch().lookupPatchField<volVectorField, vector>(UName_);

    const fvsPatchField<scalar>& phip =
        patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);

    const fvPatchField<scalar>& psip =
        patch().lookupPatchField<volScalarField, scalar>(psiName_);

    scalar gM1ByG = (gamma_ - 1.0)/gamma_;

    operator==(T0_/(1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up)));

    fixedValueFvPatchScalarField::updateCoeffs();
 }
In the header file I have previously changed


scalarField T0_; to autoPtr<Function1<scalar>> T0_;


like its done in uniformTotalPressure or uniformFixedValue. The error appeared right after that.


Does anyone know what I did wrong?




Kind regards,
shock77
shock77 is offline   Reply With Quote

Old   May 19, 2020, 10:28
Default
  #2
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7
raumpolizei is on a distinguished road
Hey,
the problem is that you are using T0_ in your equation, which is an autoPtr to a Function1<scalar> object. Clearly, dividing a scalarField with another field is something that I can imagine would work. Without looking at code, I doubt that the other type (Function1<scalar>) is something that can be used in any mathematical operation. I guess it is just a typo and you would like to have T0 instead of T0_ in your equation.
Best regards
RP
raumpolizei is offline   Reply With Quote

Old   May 19, 2020, 13:07
Default
  #3
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
Hi raumpolizei,


thank you very much, that was the issue! I have copied it from totalTemperaturefVPatchField.C and didnt change it.

After that it compiled without any troubles. Unfortunately I couldnt run a case after that, because I got the error of an "undefined symbol". I have found the symbol, but I dont know how to fix that.

Thats why I have deletet my BC and hit wclean and wmake. That didnt solve the error.

After that I thought I should recompile the solver, went to opt/openfoam4 and hit ./Allwmake.


Unfortunately nothing is workingnow. Not a single solver is recognized anymore.


Is there any better way to recompile openfoam, besides deleting the folder and install everything from scratch?




Kind regards,
shock77
shock77 is offline   Reply With Quote

Old   May 19, 2020, 14:15
Default
  #4
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7
raumpolizei is on a distinguished road
Feeling with you, most of the people here went through this . Generally, it is a good idea to have a user folder where all your own libraries, applications and utilities are placed so that the original OpenFOAM installation is left unchanged. You can then link your OpenFOAM installation to your own libraries and use them in your own applications. If you search you should be able to findfind a lot of tutorials on that. Good luck!

RP
raumpolizei is offline   Reply With Quote

Old   May 19, 2020, 17:56
Default
  #5
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
Hi RP,


thanks for your kind help and advice!


I did like you suggested and actually succeeded. First I have managed to make openfoam run again. After that I have created a folder (myCode) for my modifications in opt/openfoam4/applications/myCode. Here I have created my new boundary condition and compiled it without any errors. If I run wmake libso again, I get that everything is up to date. So far so good.


After that I wanted to try to use my BC. Unfortunately it is not recognized:


Code:
--> FOAM FATAL IO ERROR: 
Unknown patchField type uniformTotalTemperature for patch type patch

Valid patchField types are :

111
(
advective
alphatJayatillekeWallFunction
atmBoundaryLayerInletEpsilon
atmBoundaryLayerInletK
calculated
codedFixedValue
codedMixed
compressible::alphatJayatillekeWallFunction
compressible::alphatWallFunction
compressible::thermalBaffle1D<hConstSolidThermoPhysics>
compressible::thermalBaffle1D<hPowerSolidThermoPhysics>
compressible::turbulentHeatFluxTemperature
compressible::turbulentTemperatureCoupledBaffleMixed
compressible::turbulentTemperatureRadCoupledMixed
convectiveHeatTransfer
cyclic
cyclicACMI
cyclicAMI
cyclicSlip
directionMixed
empty
energyJump
energyJumpAMI
epsilonLowReWallFunction
epsilonWallFunction
externalCoupled
externalCoupledTemperature
externalWallHeatFluxTemperature
extrapolatedCalculated
fWallFunction
fan
fanPressure
fixedEnergy
fixedFluxExtrapolatedPressure
fixedFluxPressure
fixedGradient
fixedInternalValue
fixedJump
fixedJumpAMI
fixedMean
fixedPressureCompressibleDensity
fixedProfile
fixedRho
fixedUnburntEnthalpy
fixedValue
freestream
freestreamPressure
gradientEnergy
gradientUnburntEnthalpy
inletOutlet
inletOutletTotalTemperature
kLowReWallFunction
kqRWallFunction
mapped
mappedField
mappedFixedInternalValue
mappedFixedPushedInternalValue
mixed
mixedEnergy
mixedFixedValueSlip
mixedUnburntEnthalpy
nonuniformTransformCyclic
nutLowReWallFunction
nutTabulatedWallFunction
nutURoughWallFunction
nutUSpaldingWallFunction
nutUWallFunction
nutkAtmRoughWallFunction
nutkRoughWallFunction
nutkWallFunction
omegaWallFunction
outletInlet
outletMappedUniformInlet
partialSlip
phaseHydrostaticPressure
plenumPressure
porousBafflePressure
prghPressure
prghTotalHydrostaticPressure
prghTotalPressure
processor
processorCyclic
rotatingTotalPressure
sliced
slip
smoluchowskiJumpT
symmetry
symmetryPlane
syringePressure
timeVaryingMappedFixedValue
totalFlowRateAdvectiveDiffusive
totalPressure
totalTemperature
turbulentInlet
turbulentIntensityKineticEnergyInlet
turbulentMixingLengthDissipationRateInlet
turbulentMixingLengthFrequencyInlet
uniformDensityHydrostaticPressure
uniformFixedGradient
uniformFixedValue
uniformInletOutlet
uniformJump
uniformJumpAMI
uniformTotalPressure
v2WallFunction
variableHeightFlowRate
wallHeatTransfer
waveSurfacePressure
waveTransmissive
wedge
zeroGradient
)


file: /home/test2/0/T.boundaryField.inlet from line 26 to line 32.

    From function static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]
    in file /opt/openfoam4/src/finiteVolume/lnInclude/fvPatchFieldNew.C at line 134.
FOAM exiting
I have checked, that my library appears in $FOAM_USER_LIBBIN and it does. I have also edited my controldict:


libs (
"libmyBoundaryConditions.so"
"libfieldFunctionObjects.so"
);


The first one is my new created BC lib.


I have a make folder with edited files und options:


files:


Code:
uniformTotalTemperature/uniformTotalTemperatureFvPatchScalarField.C

LIB = $(FOAM_USER_LIBBIN)/libmyBoundaryConditions
options:


Code:
EXE_INC = \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude 

LIB_LIBS = \
    -lmeshTools \
    -lfiniteVolume
I think I have done everything what was suggested in tutorials or forum threads.


Do you have any idea what might be the problem?




Kind regards,
shock77
shock77 is offline   Reply With Quote

Old   May 20, 2020, 08:52
Default
  #6
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
Hello everyone,


so I have noticed, that the library, which I have added in the controlDict, is not found:


Code:
--> FOAM Warning : 
    From function void* Foam::dlOpen(const Foam::fileName&, bool)
    in file POSIX.C at line 1037
    dlopen error : libmyBoundaryConditions.so: cannot open shared object file: No such file or directory
--> FOAM Warning : 
    From function bool Foam::dlLibraryTable::open(const Foam::fileName&, bool)
    in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 97
    could not load "libmyBoundaryConditions.so"
Create mesh for time = 0
Thats why I have added into /opt/openfoam4/applications/solvers/compressible/rhoCentralFoam/Make/options the line



Code:
    -I$(FOAM_USER_LIBBIN) \
When I hit echo $FOAM_USER_LIBBIN I get:


Code:
echo $FOAM_USER_LIBBIN 
/root/OpenFOAM/root-4.1/platforms/linux64GccDPInt32Opt/lib
When I hit echo $LD_LIBRARY_PATH I get:


Code:
echo $LD_LIBRARY_PATH 
/opt/ThirdParty-4.1/platforms/linux64Gcc/gperftools-svn/lib:/opt/paraviewopenfoam50/lib/paraview-5.0:/opt/openfoam4/platforms/linux64GccDPInt32Opt/lib/openmpi-system:/opt/ThirdParty-4.1/platforms/linux64GccDPInt32/lib/openmpi-system:/usr/lib/openmpi/lib:/root/OpenFOAM/root-4.1/platforms/linux64GccDPInt32Opt/lib:/opt/site/4.1/platforms/linux64GccDPInt32Opt/lib:/opt/openfoam4/platforms/linux64GccDPInt32Opt/lib:/opt/ThirdParty-4.1/platforms/linux64GccDPInt32/lib:/opt/openfoam4/platforms/linux64GccDPInt32Opt/lib/dummy
So as far as I understand dlopen should be able to find my library. But the error remains the same.


Does anyone had the same problem or/and know how to solve this?






Kind regards,
shock77
shock77 is offline   Reply With Quote

Old   May 20, 2020, 16:27
Default
  #7
Senior Member
 
Join Date: Dec 2019
Posts: 215
Rep Power: 7
shock77 is on a distinguished road
I have found the mistake.


Interestingly I did the mistake in the sourcefile of my new boundary condition uniformTotalTemperature.
After resolving it, the library has been found.

It was somehow misleading, but in the end it runs.

Thanks again for the help.


Kind regards,
shock77
shock77 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
Errno = 1 in OpenFOAM rfiore1 OpenFOAM Bugs 2 November 1, 2022 17:35
[ANSYS Meshing] Match Control, is this weird or am I stupid? Moufle ANSYS Meshing & Geometry 2 November 18, 2015 16:00
createPatch Segmentation Fault (CORE DUMPED) sam.ho OpenFOAM Pre-Processing 2 April 21, 2014 02:01
Match Control and Symmetry Boundary Condtions in a quasi 2D calculation peterputer ANSYS Meshing & Geometry 0 May 15, 2012 08:53
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 22:50


All times are GMT -4. The time now is 02:56.