const incompressible::turbulenceModel &swakIncompressibleTurbulencePluginFunction::turbInternal( const fvMesh ® ) { static HashPtrTable<incompressible::turbulenceModel> turb_; if(reg.foundObject<incompressible::turbulenceModel>("turbulenceProperties")) { if(debug) { Info << "swakIncompressibleTurbulencePluginFunction::turbInternal: " << "turbulence model already in memory" << endl; } // Somebody else already registered this return reg.lookupObject<incompressible::turbulenceModel>("turbulenceProperties"); } if(reg.foundObject<incompressible::LESModel>("LESProperties")) { if(debug) { Info << "swakIncompressibleTurbulencePluginFunction::turbInternal: " << "LES already in memory" << endl; } // Somebody else already registered this return reg.lookupObject<incompressible::LESModel>("LESProperties"); } if(reg.foundObject<incompressible::RASModel>("RASProperties")) { if(debug) { Info << "swakIncompressibleTurbulencePluginFunction::turbInternal: " << "RAS already in memory" << endl; } // Somebody else already registered this return reg.lookupObject<incompressible::RASModel>("RASProperties"); } if(!turb_.found(reg.name())) { if(debug) { Info << "swakIncompressibleTurbulencePluginFunction::turbInternal: " << "not yet in memory for " << reg.name() << endl; } turb_.set( reg.name(), incompressible::turbulenceModel::New( reg.lookupObject<volVectorField>("U"), reg.lookupObject<surfaceScalarField>("phi"), const_cast<transportModel &>(transportInternal(reg)) ).ptr() ); } return *(turb_[reg.name()]); }
const basicThermo &swakThermophysicalPluginFunction::thermoInternal( const fvMesh ® ) { static HashPtrTable<basicThermo> thermo_; if(reg.foundObject<basicThermo>("thermophysicalProperties")) { if(debug) { Info << "swakThermophysicalPluginFunction::thermoInternal: " << "already in memory" << endl; } // Somebody else already registered this return reg.lookupObject<basicThermo>("thermophysicalProperties"); } if(!thermo_.found(reg.name())) { if(debug) { Info << "swakThermophysicalPluginFunction::thermoInternal: " << "not yet in memory for " << reg.name() << endl; } bool usePsi=true; { // make sure it is gone before we create the object IOdictionary dict ( IOobject ( "thermophysicalProperties", reg.time().constant(), reg, IOobject::MUST_READ, IOobject::NO_WRITE ) ); word thermoTypeName=dict["thermoType"]; basicRhoThermo::fvMeshConstructorTable::iterator cstrIter = basicRhoThermo::fvMeshConstructorTablePtr_->find( thermoTypeName ); if (cstrIter != basicRhoThermo::fvMeshConstructorTablePtr_->end()) { if(debug) { Info << thermoTypeName << " is a basicRhoThermo-type"; } usePsi=false; } else if(debug) { Info << "No " << thermoTypeName << " in basicRhoThermo-types " #ifdef FOAM_HAS_SORTED_TOC << basicRhoThermo::fvMeshConstructorTablePtr_->sortedToc() #else << basicRhoThermo::fvMeshConstructorTablePtr_->toc() #endif << endl; } if(usePsi) { basicPsiThermo::fvMeshConstructorTable::iterator cstrIter = basicPsiThermo::fvMeshConstructorTablePtr_->find( thermoTypeName ); if(cstrIter != basicPsiThermo::fvMeshConstructorTablePtr_->end()) { if(debug) { Info << thermoTypeName << " is a basicPsiThermo-type"; } } else if(debug) { Info << "No " << thermoTypeName << " in basicPsiThermo-types " #ifdef FOAM_HAS_SORTED_TOC << basicPsiThermo::fvMeshConstructorTablePtr_->sortedToc() #else << basicPsiThermo::fvMeshConstructorTablePtr_->toc() #endif << endl; } } } // Create it ourself because nobody registered it if(usePsi) { thermo_.set( reg.name(), basicPsiThermo::New(reg).ptr() ); } else { thermo_.set( reg.name(), basicRhoThermo::New(reg).ptr() ); } } return *(thermo_[reg.name()]); }