error when applying myCavitatingFoam
Hi everyone, I tried to do some adaptations to the cavitatingFoam. And the compile went well. However, when I tried to apply it to the throttle/ras/cavitatingFoam case, following error appears. I compared it with my succeed log file with cavitatingFoam, and found out the problem might be with the compressibility model. But I can't really find which part of the code leads to this. Can anyone offer any clue?
Create time Create mesh for time = 0 Reading thermodynamicProperties Reading field p Reading field U Reading/calculating face flux field phiv Reading/calculating face flux field phi Reading transportProperties Selecting incompressible transport model Newtonian Selecting incompressible transport model Newtonian #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigSegv::sigHandler(int) at ??:? #2 in "/lib/x86_64-linux-gnu/libc.so.6" #3 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) in "/usr/lib/x86_64-linux-gnu/libstdc++.so.6" #4 Foam::regIOobject::regIOobject(Foam::regIOobject const&) at ??:? #5 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::GeometricFiel d<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #6 at ??:? #7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #8 at ??:? Segmentation fault (core dumped) |
Hi,
Maybe I missed something but are you proposing people to guess your code modifications? |
5 Attachment(s)
Quote:
It seems to me that the error happened in the creatField.H. But I only added few lines there as following without other modifications. volScalarField rhov(twoPhaseProperties.rho1()); volScalarField rhol(twoPhaseProperties.rho2()); volScalarField B=rhol/psil; double N=11; double r=1.4; Regards |
Well,
Don't know what OF version/compiler you're using but this Code:
volScalarField rhov(twoPhaseProperties.rho1()); These lines should be something like: Code:
rhol |
Quote:
And I need the rhol and rhov as volScalarField beacuse there is a function in 0Equn.H: { volScalarField pgl=(rhov*rhol*(rhov-rhol))/(magSqr(rhov)*psil-magSqr(rhol)*psiv); if ( rho>rhol) p=pSat+(B/N)*(pow((rho/rhol),N)-1.0); else if (rho<rhov) p=pSat*pow((rho/rhov),r); else p=pSat+pgl*log10(rhov*psil*(rhol+alphav*(rhov-rhol))/(rhol*(rhov*psil-alphav*(rhov*psil-rhol*psiv)))); } Or is there other method I can do this? |
Hi,
I can't answer your question as I don't see your redefinition. Maybe it's OK, maybe it is the reason for the runtime error. As I don't know what else you've redefined (and think that one should guess it), I will assume variables in you expression have types as in original cavitatingFoam. This Code:
{ 1. Iterate over volume field and check your condition is every cell. Code:
dimensionedScalar pgl=(rhov*rhol*(rhov-rhol))/(magSqr(rhov)*psil-magSqr(rhol)*psiv); 2. These is sign function which return -1 if expression is below zero, 0 is expression is 0, and 1 if expression is above zero. You need 3 conditions: rho - rhol, rho - rhov, everything else. Expr1 is value of p for rhol < rho, expr2 is value of p for rho < rhov, expr3 is everything else. Also assuming rhov < rhol: Code:
const volScalarField s1(sign(rho - rhol)); |
Hi, thanks for the brilliant suggestion, I have been stuck on the expression for a long time. I have learnt a lesson from here. Now I am able to wmake the solver without error.
However, following error appears again when I am trying to apply it to the throttle case. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading thermodynamicProperties Reading field p Reading field U Reading/calculating face flux field phiv Reading/calculating face flux field phi Reading transportProperties Selecting incompressible transport model Newtonian Selecting incompressible transport model Newtonian #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigSegv::sigHandler(int) at ??:? #2 in "/lib/x86_64-linux-gnu/libc.so.6" #3 std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) in "/usr/lib/x86_64-linux-gnu/libstdc++.so.6" #4 Foam::regIOobject::regIOobject(Foam::regIOobject const&) at ??:? #5 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::GeometricFiel d<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #6 at ??:? #7 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #8 at ??:? Segmentation fault (core dumped) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // And this is how my relevant creatField.H looks like now. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "createPhiv.H" #include "compressibleCreatePhi.H" Info<< "Reading transportProperties\n" << endl; incompressibleTwoPhaseMixture twoPhaseProperties(U, phiv); volScalarField& alphav(twoPhaseProperties.alpha1()); alphav.oldTime(); volScalarField& alphal(twoPhaseProperties.alpha2()); dimensionedScalar rhov(twoPhaseProperties.rho1()); dimensionedScalar rhol(twoPhaseProperties.rho2()); volScalarField B=rhol/psil; double N=11; double r=1.4; Info<< "Creating compressibilityModel\n" << endl; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
5 Attachment(s)
Thanks for being so patient.
For the convenient, I have attached all the modified code in the attachment. For the pEqn.H, it is a immature version now. I planned to add more to it, such as nonorthogonal correction when I am able to run the case. |
Hm, you've changed rhol and rhov into dimensioned scalars and again trying to initialize volScalarField B from ratio of these scalars using = operator. It is OK but you have to create B properly first (via copy constructor from other volume field or via constructor from components). Will B be location dependent or it's another constant like rhol and rhov?
|
1 Attachment(s)
Quote:
Code:
Info<< "Reading transportProperties\n" << endl; Code:
forAll(rho,cellI) Code:
p[cellI]=pSat+pgl*log10(rhov*psil*(rhol+alphav[cellI]*(rhov-rhol))/(rhol*(rhov*psil-alphav[cellI]*(rhov*psil-rhol*psiv)))); |
Thanks again for being so patient. Or could you please tell me is there any place I can learn how to deal with these?
|
Well,
Basically you've got 3 different types here: 1. scalar 2. dimensionedScalar 3. volScalarField let's assume variables: S is scalar, DS is dimensioned scalar, VSF is volScalarField. 1. DS.value() is scalar. 2. VSF[cellI] (or VSF.internalField()[cellI]) is scalar. There are certain assignments that are valid, for example, you can assign VSF = DS. For the assignment to be valid, VSF should be correctly constructed. Either as a copy of another volScalarField, or from components. Returning to your code: Code:
p[cellI]=pSat.value()+(B/N)*(pow((rho/rhol),N)-1.0) Code:
0pEqn.H:23:18: erreur: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘double’ in assignment Code:
In file included from mycavitatingFoam.C:51:0: If you'd like to learn about iterating over volScalarField (or volVectorField): Code:
$ cd $FOAM_APP/solvers |
1 Attachment(s)
Hi, thanks for the advise. I have looked through the example files, redefined my rhov and rhol as scalar and managed to write my 0pEqn like this, no more no match error this time :D:
Code:
dimensionedScalar rhov00(twoPhaseProperties.rho1()); Code:
forAll(rho,cellI) Code:
0pEqn.H:27:55: error: call of overloaded ‘pow(double, Foam::scalar&)’ is ambiguous Code:
0pEqn.H:31:179: error: call of overloaded ‘log10(Foam::scalar)’ is ambiguous Code:
{ |
There are lots of fancy errors ;) like
Code:
In file included from pEqn.H:37:0, Code:
pow -> std::pow |
Hi, I have been able to solve the fancy problem by predefine a scalar pSat :)
Code:
scalar pSat00=pSat.value(); Now I am able to run the case, although it will explode at last. I think I am going to fix the equations now. :D Thanks for all the advise and patience all the way. Best. |
All times are GMT -4. The time now is 18:29. |