New scalar in phaseModel.c
-
After I compiled it successfully, it crashed with the following error:
Any suggestion?Backtrace: ZN10StackTraceC1Ev [0x705c1465+0x25] module: J:\blueCFD-Core-2017\ThirdParty-5.x\platforms\mingw_w64GccDPInt32\lib\libstack_trace.dll ZN4Foam5error10printStackERNS_7OstreamE [0x1201d88+0x218] module: J:\blueCFD-Core-2017\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll ZN4Foam7sigSegv14sigSegvHandlerEi [0x1203983+0x33] module: J:\blueCFD-Core-2017\OpenFOAM-5.x\platforms\mingw_w64GccDPInt32Opt\lib\libOpenFOAM.dll (No symbol) [0x404967] module: J:\blueCFD-Core-2017\ofuser-of5\platforms\mingw_w64GccDPInt32Opt\bin\slurryplateoldPDtest.exe _C_specific_handler [0x7ff921376506+0x96] module: C:\Windows\SYSTEM32\ntdll.dll 0_chkstk [0x7ff92138a49d+0x11d] module: C:\Windows\SYSTEM32\ntdll.dll RtlImageNtHeaderEx [0x7ff92131fd43+0x483] module: C:\Windows\SYSTEM32\ntdll.dll KiUserExceptionDispatcher [0x7ff92138960a+0x3a] module: C:\Windows\SYSTEM32\ntdll.dll (No symbol) [0x47e6ac] module: J:\blueCFD-Core-2017\ofuser-of5\platforms\mingw_w64GccDPInt32Opt\bin\slurryplateoldPDtest.exe (No symbol) [0x4013f7] module: J:\blueCFD-Core-2017\ofuser-of5\platforms\mingw_w64GccDPInt32Opt\bin\slurryplateoldPDtest.exe (No symbol) [0x40152b] module: J:\blueCFD-Core-2017\ofuser-of5\platforms\mingw_w64GccDPInt32Opt\bin\slurryplateoldPDtest.exe BaseThreadInitThunk [0x7ff9211584d4+0x14] module: C:\Windows\System32\KERNEL32.DLL RtlUserThreadStart [0x7ff92134e871+0x21] module: C:\Windows\SYSTEM32\ntdll.dll
-
Sorry for that. I copied the linux error message!
Calculating face flux field phi.water Selecting diameterModel for phase water: constant Selecting turbulence model type RAS Selecting RAS turbulence model diffusionkEpsilon RAS { RASModel diffusionkEpsilon; turbulence on; printCoeffs on; Cmu 0.09; C1 1.44; C2 1.92; C3 0; sigmak 1; sigmaEps 1.3; mysigmake 1; } [3] #0 [4] #0 Foam::error::printStack(Foam::Ostream&)[12] #0 Foam::error::printStack(Foam::Ostream&)[16] #0 Foam::error::printStack(Foam::Ostream&)[19] #0 Foam::error::printStack(Foam::Ostream&)[22] #0 Foam::error::printStack(Foam::Ostream&)[26] #0 Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[10] #0 [13] #0 Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[25] #0 Foam::error::printStack(Foam::Ostream&)[27] #0 Foam::error::printStack(Foam::Ostream&)[21] #0 Foam::error::printStack(Foam::Ostream&)[29] #0 [14] #0 Foam::error::printStack(Foam::Ostream&)[11] #0 Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[1] #0 Foam::error::printStack(Foam::Ostream&)Selecting default blending method: none Selecting dragModel for (solids in water): SchillerNaumann Selecting swarmCorrection for (solids in water): none [28] #0 [15] #0 [18] #0 [20] #0 Foam::error::printStack(Foam::Ostream&)[9] #0 Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[24] #0 Foam::error::printStack(Foam::Ostream&)[17] #0 Foam::error::printStack(Foam::Ostream&)[0] #0 Foam::error::printStack(Foam::Ostream&)[5] #0 Foam::error::printStack(Foam::Ostream&)[23] #0 Foam::error::printStack(Foam::Ostream&)[2] #0 Foam::error::printStack(Foam::Ostream&)[6] #0 [7] #0 Foam::error::printStack(Foam::Ostream&)Foam::error::printStack(Foam::Ostream&)[8] #0 Foam::error::printStack(Foam::Ostream&) at ??:? [0] #1 Foam::sigSegv::sigHandler(int) at ??:? at [3] #1 Foam::sigSegv::sigHandler(int)??:? at ??:? at at ??:? ??:? at ??:? [4] #1 Foam::sigSegv::sigHandler(int) at ??:? at [10] #1 Foam::sigSegv::sigHandler(int) at ??:? [13] #1 Foam::sigSegv::sigHandler(int) at ??:? at ??:? [2] #1 Foam::sigSegv::sigHandler(int)??:? at at [11] #1 Foam::sigSegv::sigHandler(int)??:? ??:? [14] #1 Foam::sigSegv::sigHandler(int) at ??:? at ??:? [28] #1 Foam::sigSegv::sigHandler(int)[24] #1 Foam::sigSegv::sigHandler(int)[26] #1 Foam::sigSegv::sigHandler(int)[16] #1 Foam::sigSegv::sigHandler(int)[18] #1 Foam::sigSegv::sigHandler(int)[27] #1 Foam::sigSegv::sigHandler(int)[22] #1 Foam::sigSegv::sigHandler(int)[25] #1 Foam::sigSegv::sigHandler(int) at ??:? [12] #1 Foam::sigSegv::sigHandler(int) at ??:? [29] #1 Foam::sigSegv::sigHandler(int) at ??:? [21] #1 Foam::sigSegv::sigHandler(int) at ??:? at [23] #1 Foam::sigSegv::sigHandler(int)??:? [6] #1 Foam::sigSegv::sigHandler(int) at ??:? [5] #1 Foam::sigSegv::sigHandler(int) at ??:? at ??:? at ??:? at ??:? at ??:? [7] #1 Foam::sigSegv::sigHandler(int)[9] #1 Foam::sigSegv::sigHandler(int)[15] #1 Foam::sigSegv::sigHandler(int)[20] #1 Foam::sigSegv::sigHandler(int)[1] #1 Foam::sigSegv::sigHandler(int) at ??:? at ??:? at [17] #1 Foam::sigSegv::sigHandler(int)??:? [8] #1 Foam::sigSegv::sigHandler(int)[19] #1 Foam::sigSegv::sigHandler(int) at ??:? [0] #2 ? at ??:? [11] #2 ? at ??:? [3] #2 ? at ??:? [4] #2 ? at ??:? [6] #2 ? at ??:? [18] #2 ? at ??:? [13] #2 ? at ??:? [21] #2 ? at ??:? [28] #2 ? at ??:? [2] #2 ? at ??:? [29] #2 ? at ??:? [8] #2 ? at ??:? [25] #2 ? at ??:? [24] #2 ? at ??:? [7] #2 ? at ??:? [12] #2 ? at ??:? [5] #2 ? at ??:? [20] #2 ? at ??:? at ??:? [26] #2 ?[27] #2 ? at ??:? at [22] #2 ???:? [14] #2 ? at ??:? [1] #2 ? at ??:? [19] #2 ? at ??:? [10] #2 ? at ??:? [23] #2 ? at ??:? [15] #2 ? at ??:? [17] #2 ? at ??:? [16] #2 ? at ??:? [9] #2 ? in /lib64/libc.so.6 [0] #3 in /lib64/libc.so.6 [3] #3 in /lib64/libc.so.6 [21] #3 in /lib64/libc.so.6 [28] #3 in /lib64/libc.so.6 [18] #3 in /lib64/libc.so.6 [11] #3 in /lib64/libc.so.6 [6] #3 in /lib64/libc.so.6 [4] #3 in /lib64/libc.so.6 [13] #3 in /lib64/libc.so.6 [25] #3 in /lib64/libc.so.6 [29] #3 in /lib64/libc.so.6 [2] #3 in /lib64/libc.so.6 [7] #3 in /lib64/libc.so.6 [9] #3 in /lib64/libc.so.6 [12] #3 in /lib64/libc.so.6 [8] #3 in /lib64/libc.so.6 [24] #3 in /lib64/libc.so.6 [20] #3 in /lib64/libc.so.6 [27] #3 in /lib64/libc.so.6 [10] #3 in /lib64/libc.so.6 [22] #3 in /lib64/libc.so.6 [1] #3 in /lib64/libc.so.6 [26] #3 in /lib64/libc.so.6 [23] #3 in /lib64/libc.so.6 [19] #3 in /lib64/libc.so.6 [14] #3 in /lib64/libc.so.6 [17] #3 in /lib64/libc.so.6 [16] #3 in /lib64/libc.so.6 [5] #3 in /lib64/libc.so.6 [15] #3 ?????????????????????????????? at ??:? [21] #4 __libc_start_main at ??:? [3] #4 __libc_start_main at ??:? [4] #4 __libc_start_main at ??:? [6] #4 __libc_start_main at ??:? [11] #4 __libc_start_main at ??:? [0] #4 __libc_start_main at ??:? [18] #4 __libc_start_main at ??:? [29] #4 __libc_start_main at ??:? [2] #4 __libc_start_main at ??:? [13] #4 __libc_start_main at ??:? [28] #4 __libc_start_main at ??:? [22] #4 __libc_start_main at ??:? [27] #4 __libc_start_main at ??:? [12] #4 __libc_start_main at ??:? [7] #4 __libc_start_main at ??:? [24] #4 __libc_start_main at ??:? [20] #4 __libc_start_main at ??:? [8] #4 __libc_start_main at ??:? [25] #4 __libc_start_main at ??:? [9] #4 __libc_start_main at ??:? [14] #4 __libc_start_main at ??:? [10] #4 __libc_start_main at ??:? [5] #4 __libc_start_main at ??:? [23] #4 __libc_start_main at ??:? [16] #4 __libc_start_main at ??:? [26] #4 __libc_start_main at ??:? [19] #4 __libc_start_main at ??:? [1] #4 __libc_start_main at ??:? [17] #4 __libc_start_main at ??:? [15] #4 __libc_start_main in /lib64/libc.so.6 [21] #5 in /lib64/libc.so.6 [3] #5 in /lib64/libc.so.6 [11] #5 in /lib64/libc.so.6 [29] #5 in /lib64/libc.so.6 [4] #5 in /lib64/libc.so.6 [0] #5 in /lib64/libc.so.6 [18] #5 in /lib64/libc.so.6 [28] #5 in /lib64/libc.so.6 [2] #5 in /lib64/libc.so.6 [6] #5 in /lib64/libc.so.6 [13] #5 in /lib64/libc.so.6 [22] #5 in /lib64/libc.so.6 [27] #5 in /lib64/libc.so.6 [20] #5 in /lib64/libc.so.6 [23] #5 in /lib64/libc.so.6 [14] #5 in /lib64/libc.so.6 [8] #5 in /lib64/libc.so.6 [25] #5 in /lib64/libc.so.6 [10] #5 in /lib64/libc.so.6 [5] #5 in /lib64/libc.so.6 [24] #5 in /lib64/libc.so.6 [12] #5 in /lib64/libc.so.6 [9] #5 in /lib64/libc.so.6 [16] #5 in /lib64/libc.so.6 [19] #5 in /lib64/libc.so.6 [26] #5 in /lib64/libc.so.6 [7] #5 in /lib64/libc.so.6
-
Selecting default blending method: none Selecting dragModel for (solids in water): SchillerNaumann Selecting swarmCorrection for (solids in water): none #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigSegv::sigHandler(int) at ??:? #2 ? in /lib64/libc.so.6 #3 ? at ??:? #4 __libc_start_main in /lib64/libc.so.6 #5 ? at ??:? Segmentation fault (core dumped)
-
I guess you use
myBeta_
just like alphaMax:myBeta()
, or just by its name?
the position where you put the declaration ofmyBeta_
shows thatmyBeta_
is a private variable.
myBeta_(phaseDict_.lookuporDefault("myBeta", 1.0)),
is OK, because it's just initialization.you should define a member function to return a private variable just like alphaMax().
the errors seems like lost address of something. Maybe the private variable's address without authority.
-
@kimy try this way: just define myBeta_ and do not use it.
see is there any error. if not, the errors are caused by function myBeta().
otherwise, keep on delete the part of code you added until the errors disapear.
you'll find the "error" code.if the error occurs after you delete all the modification. you should check the makefile.
principle: make sure origin code works well. then, add your code slowly. (add one or two lines and run it )
so it's easy find which part of code is wrong. -
I really don't know why the error always happen in which I did not used myBeta only definition. Even thought, I only added one piece of codes, such as "scalar myBeta". The same error occurs. Could you please help me to try to define one scalar in those file and see what will happen? Really thanks for your help!
-
here is diff result of lib file and case file compared with origin files.
diff.zipoutput:
PIMPLE: Iteration 1 alphaMax():0.62alphaMax lue lue lue lue lue lue alphamyBeta():1.23myBeta ha ha ha ha ha ha ha ha alphaMax():1alphaMax lue lue lue lue lue lue alphamyBeta():1myBeta ha ha ha ha ha ha ha ha MULES: Solving for alpha.particles MULES: Solving for alpha.air particles fraction, min, max = 0.275003 0 0.55 air fraction, min, max = 0.724997 0.45 1 Phase-sum volume fraction, min, max = 1 1 1 alphaMax():0.62alphaMax lue lue lue lue lue lue alphamyBeta():1.23myBeta ha ha ha ha ha ha ha ha alphaMax():1alphaMax lue lue lue lue lue lue alphamyBeta():1myBeta ha ha ha ha ha ha ha ha
my way(without mention the modification shown in diff file ):
- copy entire multiphaseEulerFoam into $FOAM_RUN/applications/solvers (bu not ./Allwamke)
can@x260-TC ~/Documents/code/C/openfoam/can-8/applications/solvers %tree -L 2 (git)-[master]- . └── multiphaseEulerFoam ├── Allwclean ├── Allwmake ├── functionObjects ├── include ├── interfacialCompositionModels ├── interfacialModels ├── multiphaseCompressibleMomentumTransportModels ├── multiphaseEulerFoam ├── multiphaseThermophysicalTransportModels └── phaseSystems 9 directories, 2 files
- find and replace all
$(FOAM_LIBBIN)
with$(FOAM_USER_LIBBIN)
find ./ -type f -exec sed -i 's/\$(FOAM_LIBBIN)/\$(FOAM_USER_LIBBIN)/' {} \;
- enter
phaseSystems
runwmake
to buildlibmyphaseSystem.so
- enter
multiphaseEulerFoam
runwmake
(not ./Allwamke) to build solvermymultiphaseEulerFoam
- run the case
-
@bestucan Many Thanks. I have a confusion that you defined the following two scalar and function in phaseModel.H
< scalar myBeta_; 195,196d193 < < scalar myBeta() const;
While in original file, according to the definition of alphaMax
scalar myBeta() const { return myBeta_; }
and you put this code in phaseModel.C ?
/home/can/.local/share/OpenFOAM/OpenFOAM-8/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C 88,89c88 < alphaMax_(fluid.subDict(phaseName).lookupOrDefault("alphaMax", 1.0)), < myBeta_(fluid.subDict(phaseName).lookupOrDefault("myBeta", 1.0)) --- > alphaMax_(fluid.subDict(phaseName).lookupOrDefault("alphaMax", 1.0)) 143,147d141 < } < < Foam::scalar Foam::phaseModel::myBeta() const < { < retu
-
@kimy yes, declaration in .H file and definition in .C file.
declaration of function myBeta() in phaseModel.H
//- Return the maximum phase-fraction (e.g. packing limit) scalar alphaMax() const; scalar myBeta() const;
and definition of function myBeta() in phaseModel.C
Foam::scalar Foam::phaseModel::alphaMax() const { return alphaMax_; } Foam::scalar Foam::phaseModel::myBeta() const { return myBeta_; }
-
@bestucan But why alphaMax() was originally defined in the phaseModel.H without any error?
scalar alphaMax() const { return alphaMax_; }
After I defined only scalar myBeta() in phaseModel.H, the following error occurs:
In file included from phaseModel/phaseModel.C:26:0: phaseModel/phaseModel.H:158:29: error: invalid declarator before 'd' tmp<volScalarField> d() const; ^ phaseModel/phaseModel.H:162:26: error: non-member function 'const Foam::PhaseCompressibleTurbulenceModel<Foam::phaseModel>& Foam::turbulence()' cannot have cv-qualifier turbulence() const;
-
@kimy because the position of this part
scalar alphaMax() const { return alphaMax_; }
in phaseModel.H belong to the declaration of class phaseModel.
so you do have to name alphaMax() as phaseModel::alphaMax()
as for "Foam::", just for rigorous."declaration in H and define in C" is not something like ban. just a rule free to follow. and it's a good habit.
you had edit your last post and delete the important part. I've seen it. you lost a ";". and error also said "invalid declarator before 'd'"
-
@bestucan I am a little bit crazy because my files are totally same as yours.......Still error after run. Note that I did not change the default library into user's library (All of them I leave it as defualt "LIB = $(FOAM_LIBBIN)/liblibcompressibleTwoPhaseSystem"
). -
Selecting default blending method: none Selecting dragModel for (solids in water): SchillerNaumann Selecting swarmCorrection for (solids in water): none #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigSegv::sigHandler(int) at ??:? #2 ? in /lib64/libc.so.6 #3 ? at ??:? #4 __libc_start_main in /lib64/libc.so.6 #5 ? at ??:? Segmentation fault (core dumped)
-
@kimy do it slowly.
1 find a normal case which works well. ensure basement is good
2 add myBeta() only, and not use it. ensure compile works
3 use cout << myBeta() << "somg flag". ensure function myBeta() works.
4 use myBeta_ as a constant value in calculation. ensure framework is well.
5 use myBeta_ as variabledivide int more step if needed
then use it as your wish. special case, special solver. If something wrong. there's nothing to do with myBeta(). maybe case? maybe solver? maybe variable overflow?
you combine all steps into one step. it's hardly to debug.
have you print myBeta_ value? just same as the value in case file?the error message seems not a special error. something about cout (Ostream&)