|
[Sponsors] |
Ambiguity error while compiling modified solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 8, 2021, 17:16 |
Ambiguity error while compiling modified solver
|
#1 |
New Member
Deshik
Join Date: Jun 2021
Location: India
Posts: 5
Rep Power: 5 |
Hi all!!
I have followed a tutorial by Martin Anderson (Chalmers). (http://www.tfd.chalmers.se/~hani/kur...ChangeFoam.pdf) I have modified everything according to his report and I was getting good results till the last step which is replacing the static saturation pressure to saturation pressure that varies with temperature. Till now I am able to add temperature field to the solver but when I have replaced Psat with Psat (variable with temperature), I am getting a compilation error. (I just entered 'wmake' command) Here is the output I am getting while compilation of code.., I have also attached the screenshot. Code:
Making dependency list for source file myInterPhaseChangeFoam.C g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3 -DNoRepository -ftemplate-depth-100 -I. -I/opt/openfoam8/src/transportModels/lnInclude -I/opt/openfoam8/src/twoPhaseModels/twoPhaseMixture/lnInclude -I/opt/openfoam8/src/twoPhaseModels/interfaceProperties/lnInclude -I/opt/openfoam8/src/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude -I/opt/openfoam8/src/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -IphaseChangeTwoPhaseMixtures/lnInclude -I/opt/openfoam8/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/opt/openfoam8/src/MomentumTransportModels/incompressible/lnInclude -I/opt/openfoam8/src/finiteVolume/lnInclude -I/opt/openfoam8/src/dynamicFvMesh/lnInclude -I/opt/openfoam8/src/meshTools/lnInclude -I/opt/openfoam8/src/OpenFOAM/lnInclude -IlnInclude -I. -I/opt/openfoam8/src/OpenFOAM/lnInclude -I/opt/openfoam8/src/OSspecific/POSIX/lnInclude -fPIC -c myInterPhaseChangeFoam.C -o Make/linux64GccDPInt32Opt/myInterPhaseChangeFoam.o In file included from myInterPhaseChangeFoam.C:50: phaseChangeTwoPhaseMixtures/lnInclude/phaseChangeTwoPhaseMixture.H: In member function ‘const volScalarField& Foam::phaseChangeTwoPhaseMixture::pSat() const’: phaseChangeTwoPhaseMixtures/lnInclude/phaseChangeTwoPhaseMixture.H:129:42: error: reference to ‘alpha1_’ is ambiguous 129 | const volScalarField& pSat = alpha1_.db().lookupObject<volScalarField>("pSat"); | ^~~~~~~ In file included from /opt/openfoam8/src/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude/immiscibleIncompressibleTwoPhaseMixture.H:39, from phaseChangeTwoPhaseMixtures/lnInclude/phaseChangeTwoPhaseMixture.H:38, from myInterPhaseChangeFoam.C:50: /opt/openfoam8/src/twoPhaseModels/interfaceProperties/lnInclude/interfaceProperties.H:69:31: note: candidates are: ‘const volScalarField& Foam::interfaceProperties::alpha1 ’ 69 | const volScalarField& alpha1_; | ^~~~~~~ In file included from /opt/openfoam8/src/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude/incompressibleTwoPhaseMixture.H:40, from /opt/openfoam8/src/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude/immiscibleIncompressibleTwoPhaseMixture.H:38, from phaseChangeTwoPhaseMixtures/lnInclude/phaseChangeTwoPhaseMixture.H:38, from myInterPhaseChangeFoam.C:50: /opt/openfoam8/src/twoPhaseModels/twoPhaseMixture/lnInclude/twoPhaseMixture.H:58:24: note: ‘Foam::volScalarField Foam::twoPhaseMixture::alpha1_’ 58 | volScalarField alpha1_; | ^~~~~~~ In file included from myInterPhaseChangeFoam.C:50: phaseChangeTwoPhaseMixtures/lnInclude/phaseChangeTwoPhaseMixture.H:129:82: error: expected primary-expression before ‘>’ token 129 | const volScalarField& pSat = alpha1_.db().lookupObject<volScalarField>("pSat"); | ^ make: *** [/opt/openfoam8/wmake/rules/General/transform:26: Make/linux64GccDPInt32Opt/myInterPhaseChangeFoam.o] Error 1 I am a beginner in programming. Please help me...... Thanks Last edited by sherlock45; June 10, 2021 at 09:40. |
|
April 6, 2022, 03:41 |
|
#2 |
New Member
Prithvi
Join Date: Mar 2022
Location: Darmstadt
Posts: 6
Rep Power: 4 |
Hi sherlock45,
Were you able to resolve this? |
|
May 4, 2022, 04:20 |
|
#3 |
Member
Join Date: Jan 2022
Location: Germany
Posts: 72
Rep Power: 4 |
I was facing the same problem like OP and I wasnt able to explain this for myself, because in the more derivative class "immiscibleIncompressibleTwoPhaseMixture.H" was done basicly the same, just by having your class in between.
Long story short: Since the compiler is complaining about ambigiouity Iwas wondering why it worked for immiscibleIncompressibleTwoPhaseMixture.H I tried to put another class afterwards and THEN inherit from interfaceProperties and it worked. My presumption in this case is, because both classes have defined alpha1_ and alpha2_ (one as variable (protected) the other as a const reference variable but as private member), normally I wouldnt expect any errors here but since there is an error.. yeah.. I believe there are two options to solve this problem: either by specifing which alpha is meant with twoPhaseMixture::alpha1_ or twoPhaseMixture::alpha1() or by putting a class before inheriting from interfaceProperties, where no member function is defined that wants access to a alpha value! Last edited by überschwupper; May 10, 2022 at 02:22. |
|
Tags |
alpha1_, ambiguity, custom solver, error, interphasechangefoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Divergence detected in AMG solver. VOF. | Mr.Mister | Fluent Multiphase | 5 | November 22, 2024 07:32 |
Fail to converge when solving with a fabricated solution | zizhou | FLUENT | 0 | March 22, 2021 07:33 |
OF 2.1.1 error in compiling modified solver | anuragm | OpenFOAM Programming & Development | 2 | November 28, 2014 10:37 |
thobois class engineTopoChangerMesh error | Peter_600 | OpenFOAM | 4 | August 2, 2014 10:52 |
Compiling Solver: Clang error linker commander failed | schwam | OpenFOAM Programming & Development | 11 | May 25, 2014 05:31 |