driftFluxFoam viscosity model modification problem
5 Attachment(s)
Hi everyone,
I’m quite a beginner on OpenFoam and I would need some help about a solver modification I’m trying to make. The aim I would like to build a model that respresents the behavior of activated sludge inside a secondary clarifier (basicly I need to make a model about the sedimentation of a non-newtonian fluid). For this purpose I chose the solver “driftFluxFoam” (which might be my first mistake…) My problem is that in “driftFluxFoam” the non-newtonian behaviours follow laws from this type : https://www.cfd-online.com/Forums/da...BJRU5ErkJggg== Where, γ is the strain rate.Whereas, from the literature I found, the activated sludge viscosity is calculated from : https://www.cfd-online.com/Forums/da...BJRU5ErkJggg== I found that in the viscosityModels, the viscosity was calculated from this strain rate (through the strainRate function). I then tried to adapt the driftFluxFoam solver to solve [2]. The code In the driftFluxFoam solver, I added, inside the mixtureViscosityModels :
Code:
\*---------------------------------------------------------------------------*/ Code:
Class Code:
\*---------------------------------------------------------------------------*/ Code:
SourceFiles The problem When I try to compile the solver, I’m having some troubles with a part of the strainRateFunction (see attached file) From what I understood, this problems comes from the fact that my code risks to modify a variable that shouldn’t be modified (const). But I have no idea about how to fix this… What I have tried I tried to avoid the parts of the code at the origin of my problem (with “//”), then the solver compiles, but when I try to run it, I’m getting an error message (“symbol look up error”). I also tried to make my solver without the strainRateFunction replacing “strainRate()” with “sqrt(2.0)*mag(symm(fvc::grad(U_)))” directly inside “Casson.C”. The solver also compiles but crashes when I try to run it. This time the problem came from LHS and RHS which didn’t have the same dimension. As I said I’m very new to OpenFoam, and to be perfectly honest, I don’t really understand how the programming process… That is why I expect quite some huge mistakes and apologize about this… Finally, I don't know if it's usefull, but attached the code about incompressibleTwoPhaseInteratingmixture. As I said, maybe my first mistake was to choose driftFluxFoam… If you know another solver which would enable be to solve my problem, it would be a pleasure to try it ! I know it's quite time consuming to read all this... So thanks in advance for your help ! |
Problem solved...
When I declared my variable mu_ in strainRateFunction.H, I used "const volScalarFiel mu_" where I should only have used "volScalarFiel mu_" in order to enable the correct() function to modify the mu_ variable ! |
Unfortunately, I'm running into another type of error :
Code:
symbol lookup error: /home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so: undefined symbol: _ZNK4Foam22mixtureViscosityModels18strainRateFunction2muERKNS_14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE Code:
c++filt _ZNK4Foam22mixtureViscosityModels18strainRateFunction2muERKNS_14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE Code:
Foam::tmp<Foam::volScalarField> Any idea about how to fix this ? |
did you try to include the library you compiled in the controlDict
|
Hi mAlleto,
Thank you very much for your answer, I just tried this : Code:
oamFile From what I read, generally those problems come from the wmake files. Here are the wmake files of my solver : File Code:
incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C Options Code:
"EXE_INC = \ The wmake files for the mixtureViscosityModels solver are : Files Code:
mixtureViscosityModel/mixtureViscosityModel.C Options Code:
EXE_INC = \ The error I get tells me that it comes from the compiledlibdriftFluxTransportModels.so file. More precisely from the strainRateFunction.C (see previous post). I'm not really used to link different libraries, and I suspect an error in my options files but can't find it... Thanks again for the time you took mAlleto ! |
Quote:
Did you define the function: mu(const volScalarField& muc) const; somewhere in the code a pice of code tries the execute the function mu which takes a const volScalarField as argument but it does not find it. So the error is generated from it. Or better said it has found the declaration but not the definition. So I ask if you declared it |
You were perfectly right :
In the mixtureViscosityModel.H, I declared : Code:
//- Return the mixture viscosity Code:
//- Return the mixture viscosity I solved the problem by supressing the declaration of mu(const volScalarField& muc) in strainRateFunction.H and by modifying the declaration in mixtureViscosityModel.H as follows : mixtureViscosityModel.H Code:
//- Return the mixture viscosity Unfortunately, as soon as a problem is solved, another comes up... The error message I'm getting now is : Code:
driftFluxFoam_Casson: symbol lookup error: /home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so: undefined symbol: _ZTIN4Foam21mixtureViscosityModelE Code:
c++filt _ZTIN4Foam21mixtureViscosityModelE |
Quote:
By the way why did you put Code:
incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C usually you put only the EXE |
Code:
The error I get tells me that it comes from the compiledlibdriftFluxTransportModels.so file. More precisely from the strainRateFunction.C (see previous post). For the actual error : Code:
driftFluxFoam_Casson: symbol lookup error: /home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so: undefined symbol: _ZTIN4Foam21mixtureViscosityModelE Code:
c++filt _ZTIN4Foam21mixtureViscosityModelE Or is it again a declaration problem in the code ? Just in case... Here's a wetransfer link to download my solver an the test case I use to see if it works : https://we.tl/t-7VZHXDPdKU |
what version of OF did you use to compile your code?
|
Hi mAlleto,
I'm using OF5.0 ! Do you think I should use the last version ? |
I compiled your code with OF6 and a bunch of errors popped up. Probably some classes have changed from OF5 and OF6.
Can you try to post a code which compiles with OF6? Otherwise it would take me too long to figure out what's going wrong. best michael |
Ok i was able to compile your code with OF6 by changing alphaEqn.H with the one of OF. I get the the same error as you when executing it.
when looking through Make/options I found that you included twice a the viscosity model: EXE_INC = \ -IincompressibleTwoPhaseInteractingMixture \ -ImixtureViscosityModels/lnInclude \ -I./relativeVelocityModels/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude EXE_LIBS = \ -ldriftFluxTransportModels \ -> the one of OF -ldriftFluxRelativeVelocityModels \ -ltwoPhaseMixture \ -lfiniteVolume \ -lmeshTools \ -lsampling \ -lfvOptions \ -lcompressibleTransportModels \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ -L$(FOAM_USER_LIBBIN)/libdriftFluxTransportModels -> your when removing the library of OF i get similar errors as you but already at compile time. There must be a naming conflict somewhere. |
Hi mAlletto,
indeed there was a naming problem... I began to suspect it when I tried to run my test case with the original driftFluxFoam and got the same error... driftFluxFoam tried to access my user library : Code:
/home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so I then changed the names of my solver and library to Cassonsed and libCassonsed.so and the error went away... Now the error I get is quite more basic : Code:
-> FOAM FATAL ERROR: Code:
{ Thank you very much for what you're doing, you're helping me a lot ! |
Just looking at the other viscosity models I would have just copied one and renamed it.
Afterward I would have modified the mu and read function (letting the input arguments as they are). By the way you don't need any strain rate functions. You can use the velocity U to calculate it. By compiling the new viscosity model it should by selectable at run time. |
Yes, I already tried that :
Code:
I also tried to make my solver without the strainRateFunction replacing “strainRate()” with “sqrt(2.0)*mag(symm(fvc::grad(U_)))” directly inside “Casson.C”. The solver also compiles but crashes when I try to run it. With my C++ level, it might indeed be more appriopriate just to modify the plastic solver just to fulfill my needs ! I'll try this again and hope I'll be able to find the solution about the LHS and RHS dimensions ! Thanks a lot michael ! |
All times are GMT -4. The time now is 13:52. |