|
[Sponsors] |
Create runTime selectable class with subModels |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 1, 2022, 14:32 |
Create runTime selectable class with subModels
|
#1 |
New Member
Join Date: Dec 2021
Posts: 23
Rep Power: 4 |
Hello to all,
I would like to create a class representing a model. Since there will be different models, it needs to be runTime selectable. Each model, will need a subModel defined for the system of equations which should also be runTime selectable. The main idea is illustrated in the image bellow: I was thinking of doing this based on the structure of the viscosity model. Code:
Foam::autoPtr<Foam::viscosityModel> Foam::viscosityModel::New ( const word& name, const dictionary& dict, const volVectorField& U, const surfaceScalarField& phi ) { const word modelType(dict.get<word>("transportModel")); Info<< "Selecting incompressible transport model " << modelType << endl; auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); if (!cstrIter.found()) { FatalIOErrorInLookup ( dict, "viscosityModel", modelType, *dictionaryConstructorTablePtr_ ) << exit(FatalIOError); } return autoPtr<viscosityModel>(cstrIter()(name, dict, U, phi)); } Is this a suitable strategy? Do you know of a better approach? Does the use of autoPtr [unique_ptr] have any influence in parallel processing? Thanks |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
RunTime Selection and the Templates mess | ELwardi | OpenFOAM Programming & Development | 0 | September 4, 2020 09:24 |
Meshing a Sphere | Ajay | FLUENT | 10 | September 3, 2016 14:18 |
Where's the singularity/mesh flaw? | audrich | FLUENT | 3 | August 4, 2009 01:07 |
A problem about class OFstream | jennyrui2008 | OpenFOAM Running, Solving & CFD | 0 | December 5, 2008 03:55 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 11:55 |