CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Custom turbulence model for OpenFOAM-dev or 3.0.x

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 18, 2015, 11:15
Smile Custom turbulence model for OpenFOAM-dev or 3.0.x
  #1
Member
 
Pekka Pasanen
Join Date: Feb 2012
Location: Finland
Posts: 87
Rep Power: 14
zordiack is on a distinguished road
I was wondering if someone could point me in the right direction, because it wasn't so straight forward creating a custom turbulence model with the new system. I managed to get it working, but with error messages like these (it's a custom lib):

Duplicate entry LES in runtime selection table TurbulenceModel
#0 /home/pppekkapa/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib

More details here:

http://www.cfd-online.com/Forums/ope...tml#post578060

So basically the only working way I found was to create copies of src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C and src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C. Then I deleted all the other models and used the following to create my own model:

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2013-2015 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.
    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/

#include "IncompressibleTurbulenceModel.H"
#include "incompressible/transportModel/transportModel.H"
#include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"

#include "laminar.H"
#include "RASModel.H"
#include "LESModel.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

makeBaseTurbulenceModel
(
    geometricOneField,
    geometricOneField,
    incompressibleTurbulenceModel,
    IncompressibleTurbulenceModel,
    transportModel
);

#define makeRASModel(Type)                                                     \
    makeTemplatedTurbulenceModel                                               \
    (transportModelIncompressibleTurbulenceModel, RAS, Type)

#define makeLESModel(Type)                                                     \
    makeTemplatedTurbulenceModel                                               \
    (transportModelIncompressibleTurbulenceModel, LES, Type)


// -------------------------------------------------------------------------- //
// RAS models
// -------------------------------------------------------------------------- //

#include "kOmegaSSTSASnew.H"
makeRASModel(kOmegaSSTSASnew);
Trying to straightly compile kOmegaSSTSASnew.C leads errors like these (this was version of kOmegaSST):

Code:
kOmegaSSTv2.C:41:21: error: redefinition of ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::RASModels::kOmegaSSTv2<BasicTurbulenceModel>::F1(const volScalarField&) const’
 tmp<volScalarField> kOmegaSSTv2<BasicTurbulenceModel>::kOmegaSSTv2::F1
                     ^
In file included from kOmegaSSTv2.H:323:0,
                 from kOmegaSSTv2.C:26:
kOmegaSSTv2.C:41:21: error: ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::RASModels::kOmegaSSTv2<BasicTurbulenceModel>::F1(const volScalarField&) const’ previously declared here
 tmp<volScalarField> kOmegaSSTv2<BasicTurbulenceModel>::kOmegaSSTv2::F1
I'm just trying to understand how this new template system works, and I'm not there yet
zordiack is offline   Reply With Quote

Old   December 21, 2015, 11:35
Default
  #2
Member
 
Pekka Pasanen
Join Date: Feb 2012
Location: Finland
Posts: 87
Rep Power: 14
zordiack is on a distinguished road
There is now an updated version in the github repository with no more complaints, for details see http://www.cfd-online.com/Forums/ope...tml#post578372.

I'm still kind of waiting for more tutorials on -dev or 3.0.x version custom implementations, I hope they keep on coming but in the mean time this is at least working:

https://github.com/zordiack/foam-dev

Big thanks to Alexey Matveichev for help.
zordiack is offline   Reply With Quote

Old   March 23, 2016, 12:00
Default
  #3
New Member
 
Join Date: Feb 2016
Posts: 6
Rep Power: 10
jasv is on a distinguished road
EDIT: I've posted the question as a new thread

Last edited by jasv; March 31, 2016 at 05:32. Reason: Created new thread an got an answer there.
jasv is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Overflow Error in Multiphase Modelling with Two Continuous Fluids ashtonJ CFX 6 August 11, 2014 14:32
Spalarat - Allmaras turbulence model saisanthoshm88 Main CFD Forum 1 June 16, 2014 16:33
Wrong calculation of nut in the kOmegaSST turbulence model FelixL OpenFOAM Bugs 27 March 27, 2012 09:02
Low Reynolds k-epsilon model YJZ ANSYS 1 August 20, 2010 13:57
Fan heater model: what turbulence source to use? andy20 CFX 7 March 3, 2008 16:42


All times are GMT -4. The time now is 12:08.