Programming issues
Hi everybody, I have some compiling problems which are very probably due to my lack of knowledge in programming inside the OpenFOAM/C++ frame...however, I'm trying to compile a .C source file which contains the following piece of code:
tmp<volScalarField> kOmegaSI::kiKappa() const { return (1/(pow(omega_,3.0)))*((fvc::grad(k_))&(fvc::grad(ome ga_))); } tmp<volScalarField> kOmegaSI::fBetaStar() const { { if (kiKappa() > scalar(0.0)) { return ((scalar(680.0)+sqr(kiKappa()))/(scalar(400.0)+sqr(kiKappa()))); } else { return scalar(1.0); } } } and this is the error message after runninng the wmake utility kOmegaSI/kOmegaSI.C:56: error: no match for ‘operator>’ in ‘Foam::incompressible::RASModels::kOmegaSI::kiKapp a() const() > 0.0’ kOmegaSI/kOmegaSI.C:60: error: conversion from ‘double’ to non-scalar type ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ requested Line 56 is: if (kiKappa() > scalar(0.0)) { Line 60 is: return scalar(1.0); Can someone please give me some help about it? Thank you in advance PS - What I'm trying to do is to implement the revised version of Wilcox's k-omega turbulence model. For the definition of the correction-functions of the closure coefficients (such as fBetaStar) I've took some inspiration from the Launder-Sharma Low-Re k-epsilon model source code. |
Any replies? I could post more information if necessary...
|
kiKappa seems to be a tmp<volScalarField>
so what does it mean when you write kiKappa() > 0? Thats what it tells you on the line: kOmegaSI/kOmegaSI.C:56: error: no match for ‘operator>’ in ‘Foam::incompressible::RASModels::kOmegaSI::kiKapp a() const() > 0.0’ Does it mean that every element of kiKappa should be larger than zero? what about the ones that are not? you cant compare fields to a scalar, its like you have a vector a=(1, 2, 3) and you write a > 0. What does that mean?...nothing. You have to rethink your code there. |
Quote:
As you have noticed, I've made some conceptual mistakes, so I will really appreciate if you could give me some advices about how to correct the code...anyway, thank you once again |
try kiKappa.value() > 0.
I am not sure it will work or not |
I havent compiled this, so it probably wont work, but you have to do it
something like this. you probably dont have access to runTime and mesh, so you need to replace runTime_ and mesh_ with the appropriate equivalents and set the correct dimension in dimensionSet Code:
|
Quote:
|
Quote:
|
All times are GMT -4. The time now is 09:27. |