Inheriting kOmega: why can't I change the constructor?
Dear All,
I am modifying some RAS models in order for them to work better with two-phase stratified flows. It was observed that standard models produce excessive viscosity at the interface and due to this overpredict pressure gradients. Anyway, I am having a problem with a fairly simple, I should think, piece of code. Please have a look at this: Code:
#ifndef kOmegaStrat_H Description Resource Path Location Type no matching function for call to Code:
‘Foam::incompressible::RASModels::kOmegaStrat::kOmegaStrat(const Foam::volVectorField&, const Foam::surfaceScalarField&, Foam::transportModel&, const Foam::word&)’ stratTurbulence line 126, external location: /home/c111269/OpenFOAM/OpenFOAM-2.0.x/src/turbulenceModels/incompressible/RAS/lnInclude/RASModel.H C/C++ Problem In fact, I have already written a small library by writing my own super class equivalent to RASModel. Then I create particular turbulence models by inheriting from this class. This approach, however, has certain drawbacks. For example I also had to rewrite yPlusRAS tool and all the Wall Functions I am using. It is a bit tedious, especially that the changes I have to implement are usually minute. Is there any way to do it more elegantly and more... pragmatically? |
a class can accept different constructor , so instead of changing the present constructor, add ur new constructor beside it , may be it works
|
Thanks for the reply.
I know that the class can have several constructors and indeed I have already checked that if I use a constructor without alpha1 in the argument list, the library compiles. But still I have a duty to my class to initialise alpha1 with a reasonable value and I do not feel competent to fulfil this duty without a proper reference. :-) At the end of the day, I would like to be able to use this class in a VOF solver like interFoam in the same manner it works now i.e. by invoking turbulenceModel constructor, perhaps with a different set of parameters. So I think that that my problem can be solved by changing the super class i.e. turbulenceModel. There's this part I don't quite understand: Code:
turbulenceModel |
You probably broke the runtime selection. take a look at this link, it may be useful.
http://openfoamwiki.net/index.php/Op...tion_mechanism It is a very useful feature, especially if you do not know apriori which model will be used. But it can be touchy. |
Thank you - that was a very important article. Now it all makes sense. Just to make it clear - I haven't broken the run time selection mechanism yet! I intend to do it at some point, but not now.
Hopefully after reading this article I will be able to fix it. I have also realised that for my purposes it's probably better to work with nu field which is available in standard incompressible RAS model. This would allow me to avoid changing the constructors and avoid a possibility of breaking run time selection mechanism. I simply have to save the lowest and the highest viscosity and make sure that the initial field contains the two extremes. The main idea is that I want to treat the gas phase differently than the liquid phase, so this is why I am going through all of this. But anyhow this was a very informative discussion - thank you for all the comments. |
All times are GMT -4. The time now is 13:15. |