|
[Sponsors] |
runTimeSelection of viscosityModels in pimpleFoam ! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 18, 2014, 00:12 |
runTimeSelection of viscosityModels in pimpleFoam !
|
#1 |
Member
xuhe-openfoam
Join Date: Aug 2013
Location: DaLian,china
Posts: 82
Rep Power: 13 |
hi !
In pimpleFoam/createFields.H , there is a line of code : Code:
singlePhaseTransportModel laminarTransport(U, phi); Code:
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // 32 33 Foam::singlePhaseTransportModel::singlePhaseTransportModel 34 ( 35 const volVectorField& U, 36 const surfaceScalarField& phi 37 ) 38 : 39 transportModel(U, phi), 40 viscosityModelPtr_(viscosityModel::New("nu", *this, U, phi)) 41 {} 42 31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // 32 33 Foam::transportModel::transportModel 34 ( 35 const volVectorField& U, 36 const surfaceScalarField& phi 37 ) 38 : 39 IOdictionary 40 ( 41 IOobject 42 ( 43 "transportProperties", 44 U.time().constant(), 45 U.db(), 46 IOobject::MUST_READ_IF_MODIFIED, 47 IOobject::NO_WRITE 48 ) 49 ) 50 {} Code:
Foam::autoPtr<Foam::viscosityModel> Foam::viscosityModel::New ( const word& name, const dictionary& viscosityProperties, const volVectorField& U, const surfaceScalarField& phi ) { const word modelType(viscosityProperties.lookup("transportModel")); Info<< "Selecting incompressible transport model " << modelType << endl; dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(modelType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalErrorIn ( "viscosityModel::New(const volVectorField&, " "const surfaceScalarField&)" ) << "Unknown viscosityModel type " << modelType << nl << nl << "Valid viscosityModels are : " << endl << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } return autoPtr<viscosityModel> (cstrIter()(name, viscosityProperties, U, phi)); } thanks! |
|
April 18, 2014, 02:30 |
|
#2 |
Senior Member
|
Hi,
Yes. Code:
class transportModel : public IOdictionary { ... } Code:
Foam::transportModel::transportModel ( const volVectorField& U, const surfaceScalarField& phi ) : IOdictionary ( IOobject ( "transportProperties", U.time().constant(), U.db(), IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ) {} |
|
April 18, 2014, 03:08 |
|
#3 |
Member
xuhe-openfoam
Join Date: Aug 2013
Location: DaLian,china
Posts: 82
Rep Power: 13 |
Thanks for your reply !
runTimeSelection mechanism is so beautiful ! so is the objectRegistry. |
|
August 4, 2015, 20:45 |
transportmodel
|
#4 |
New Member
jafar
Join Date: Jul 2014
Posts: 16
Rep Power: 12 |
Hi
I am working on creeping flow (non- Newtonian steady),i used simple foam with a viscosity model ,i need to use kinematic viscosity (nu(), which returned from viscosity model) to calculate shear stress ,how can i use nu in a utility or a function?i modify the utility "stresscomponent.C" as follow but this message coming "nu is not declared in this scope" code: #include "fvCFD.H" #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" #include "zeroGradientFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { timeSelector::addOptions(); # include "setRootCase.H" # include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" forAll(timeDirs, timeI) { runTime.setTime(timeDirs[timeI], timeI); Info<< "Time = " << runTime.timeName() << endl; IOobject Uheader ( "U", runTime.timeName(), mesh, IOobject::MUST_READ ); // Check U exists if (Uheader.headerOk()) { mesh.readUpdate(); Info<< " Reading U" << endl; volVectorField U(Uheader, mesh); # include "createPhi.H" singlePhaseTransportModel laminarTransport(U, phi); volScalarField strainRate ( IOobject ( "strainRate", runTime.timeName(), mesh, IOobject::NO_READ ), nu()*sqrt(2.0f)*mag(symm(fvc::gra d(U))) //this command will calculate strainRate ); strainRate.write();//this will write file "StrainRate" in each time dir!! } else { Info<< " No U" << endl; } Info<< endl; } Info<< "End" << endl; return 0; } best regards jafar Last edited by bagherij; August 4, 2015 at 20:51. Reason: more explain |
|
Tags |
runtimeselection |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Running stably with a large Courant number using pimpleFoam | mlawson | OpenFOAM | 11 | November 29, 2014 11:37 |
pimpleFoam initialization? | TBERGE | OpenFOAM Running, Solving & CFD | 2 | April 2, 2014 09:20 |
pimpleFoam: turbulence->correct(); is not executed when using residualControl | hfs | OpenFOAM Running, Solving & CFD | 3 | October 29, 2013 09:35 |
Understanding pimpleFoam convergence criterion | Nucleophobe | OpenFOAM Running, Solving & CFD | 0 | March 13, 2013 19:46 |
Differences simpleFoam vs. pimpleFoam / RASModel.H vs turbulenceModel.H | uli | OpenFOAM Programming & Development | 7 | January 26, 2013 16:01 |