|
[Sponsors] |
April 9, 2014, 04:09 |
Whats wrong with this volScalarField?
|
#1 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17 |
Hi guys,
In my code I have this We definition: Code:
volScalarField We(2*rho2*pow(epsilon,0.6667)*pow(d,1.6667)); Code:
volScalarField Web(-1.5*(1/We)); Code:
#0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::divide(Foam::Field<double>&, double const&, Foam::UList<double> const&) at ??:? #4 void Foam::divide<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::dimensioned<double> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::dimensioned<double> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #6 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(double const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:? #7 at ??:? #8 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #9 at ??:? Floating point exception (core dumped) Code:
volScalarField Web(-1.5*(pow(We,-1)); Code:
#0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 in "/lib/x86_64-linux-gnu/libc.so.6" #3 in "/lib/x86_64-linux-gnu/libm.so.6" #4 pow in "/lib/x86_64-linux-gnu/libm.so.6" #5 Foam::pow(Foam::Field<double>&, Foam::UList<double> const&, double const&) at ??:? #6 void Foam::pow<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensioned<double> const&) at ??:? #7 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::pow<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensioned<double> const&) at ??:? #8 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::pow<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, double const&) at ??:? #9 at ??:? #10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" PS. If I define it like this: Code:
volScalarField Web(-1.5*(pow(We,1)); |
|
April 9, 2014, 04:27 |
|
#2 |
Senior Member
|
Hi,
as the error is in division, it seems that We is zero somewhere. |
|
April 9, 2014, 04:36 |
|
#3 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17 |
||
April 9, 2014, 04:38 |
|
#4 |
Senior Member
|
This time it's just common sense
|
|
April 18, 2014, 16:16 |
|
#5 |
New Member
Amjad
Join Date: May 2012
Posts: 21
Rep Power: 13 |
hallo
how did u solve this problem plz |
|
April 18, 2014, 21:12 |
|
#6 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17 |
Just like Alexey have said,
when you are using pow() function. Watch out your denominator, it can not be zero. So if you wanna use this function as this: pow(e,-1). You'd better define a small number like SMALL=1e-6, and write it as pow(e+SMALL,-1). This worked for my problem. Regards, |
|
April 19, 2014, 00:52 |
|
#7 |
New Member
Amjad
Join Date: May 2012
Posts: 21
Rep Power: 13 |
I am trying to write a code to estimate the turbulence intensity in openfoam. the code does not work, when mag (U) is equal to zero.
volScalarField Intensity ( IOobject ( "Intensity", runTime.timeName(), mesh, IOobject::NO_READ ), sqrt((2.0/3.0)*k)/mag(UMean) ); |
|
April 19, 2014, 01:45 |
|
#8 |
Senior Member
|
||
April 19, 2014, 02:02 |
|
#9 |
New Member
Amjad
Join Date: May 2012
Posts: 21
Rep Power: 13 |
thanks for ur reply but i have a new problem now, I get
--> FOAM FATAL ERROR: Arguments of max have different dimensions dimensions : [0 0 0 0 0 0 0] and [0 1 -1 0 0 0 0] thanks |
|
April 19, 2014, 02:06 |
|
#10 |
Senior Member
|
Oh, forgot about dimensions. Then it should be something like:
Code:
sqrt((2.0/3.0)*k)/max(dimensionedScalar("uSMALL", dimVelocity, SMALL), mag(UMean)) |
|
April 19, 2014, 02:09 |
|
#11 |
New Member
Amjad
Join Date: May 2012
Posts: 21
Rep Power: 13 |
thanks it is working very good now
|
|
April 19, 2014, 04:02 |
|
#12 |
New Member
Amjad
Join Date: May 2012
Posts: 21
Rep Power: 13 |
hi again,
but i still get strange values at the wall where the velocity zero |
|
April 19, 2014, 04:09 |
|
#13 |
Senior Member
|
And by strange values you mean? What BCs did you use for k on this wall with non-slip BC for velocity?
|
|
April 19, 2014, 04:20 |
|
#14 |
New Member
Amjad
Join Date: May 2012
Posts: 21
Rep Power: 13 |
i meant with strang values that they are too hight 1e+13. and the BCs is fixed wall and i used wall function here for K
|
|
April 19, 2014, 07:23 |
|
#15 |
Senior Member
|
OK.
Let's forget for a moment about volume fields. If you have expression y/x in your model, rewriting it as y/(x + small) will help you to resolve a problem with 0/0. But it will give you very high values if y is non-zero. Now returning to OpenFOAM. You've got non-slip BC for velocity at the wall and you've got non-zero value of k at the same wall. Why? If there's no motion why there is turbulence? If you're using kqRWallFunction for k, it's actually simple zero-gradient boundary condition and you have to use appropriate mesh so k go to 0 at the wall. Or maybe your solution is not converged. Or maybe your initial conditions do not make sense. Or ... First fix your model, then fix code. Last edited by alexeym; April 19, 2014 at 07:40. Reason: typo |
|
April 19, 2014, 08:21 |
|
#16 |
New Member
Amjad
Join Date: May 2012
Posts: 21
Rep Power: 13 |
thanks for ur help, I think there is no proplem with K. the problem is mag(U) because it too small
at the wall, them K/mag(u) will be too high. my code is attached. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 09:21 |
udf error | srihari | FLUENT | 1 | October 31, 2016 14:18 |
make a dimensionedScalar to be volScalarField | sharonyue | OpenFOAM Programming & Development | 4 | April 2, 2014 05:44 |
multiplicate all elements of volScalarField with scalar to get new volScalarField | maybee | OpenFOAM Programming & Development | 2 | February 18, 2014 15:43 |
writing execFlowFunctionObjects | immortality | OpenFOAM Post-Processing | 30 | September 15, 2013 06:16 |