void unPackage::ReadFile() { lua_pushlightuserdata(GLuaState(), this); lua_pushcclosure(GLuaState(), Lua_GetFileOffset, 1); //lua_pushcfunction(GLuaState(), Lua_GetFileOffset); lua_setglobal(GLuaState(), "GetOffset"); // Create dummy root element RootElement.reset( new unElement(GName(wxT("File")), GNameNone(), GName(wxT("File")), GNameNone()) ); // Create root primitive RootPrimitive.reset( GPrimitives().CreatePrimitive(GName(wxT("object")), RootElement.get(), NULL) ); static_cast<unOBJECT*>(RootPrimitive.get())->SetElementType(RootElement->GetTypeID()); // Read root primitive RootPrimitive->Read(*this); // Delay loading bDelayLoading = true; for( vector<unPrimitive*>::iterator it=DelayLoaded.begin(); it!=DelayLoaded.end(); ++it ) { (*it)->Read(*this); } }
void oneEqEddy::correct(const tmp<volTensorField>& tgradU) { const volTensorField& gradU = tgradU(); GenEddyVisc::correct(gradU); volScalarField divU(fvc::div(phi()/fvc::interpolate(rho()))); volScalarField G(GName(), 2*muSgs_*(gradU && dev(symm(gradU)))); tmp<fvScalarMatrix> kEqn ( fvm::ddt(rho(), k_) + fvm::div(phi(), k_) - fvm::laplacian(DkEff(), k_) == G - fvm::SuSp(2.0/3.0*rho()*divU, k_) - fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_) ); kEqn().relax(); kEqn().solve(); bound(k_, kMin_); updateSubGridScaleFields(); }
void kEpsilonSources::correct() { RASModel::correct(); if (!turbulence_) { return; } volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_)))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); // Dissipation equation tmp<fvScalarMatrix> epsEqn ( fvm::ddt(epsilon_) + fvm::div(phi_, epsilon_) - fvm::laplacian(DepsilonEff(), epsilon_) == C1_*G*epsilon_/k_ - fvm::Sp(C2_*epsilon_/k_, epsilon_) + fvOptions(epsilon_) ); epsEqn().relax(); fvOptions.constrain(epsEqn()); epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); fvOptions.correct(epsilon_); bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn ( fvm::ddt(k_) + fvm::div(phi_, k_) - fvm::laplacian(DkEff(), k_) == G - fvm::Sp(epsilon_/k_, k_) + fvOptions(k_) ); kEqn().relax(); fvOptions.constrain(kEqn()); solve(kEqn); fvOptions.correct(k_); bound(k_, kMin_); // Re-calculate viscosity nut_ = Cmu_*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); }
void kOmega::correct() { RASModel::correct(); if (!turbulence_) { return; } volScalarField G(GName(), nut_*2*magSqr(symm(fvc::grad(U_)))); // Update omega and G at the wall omega_.boundaryField().updateCoeffs(); // Turbulence specific dissipation rate equation tmp<fvScalarMatrix> omegaEqn ( fvm::ddt(omega_) + fvm::div(phi_, omega_) - fvm::laplacian(DomegaEff(), omega_) == alpha_*G*omega_/k_ - fvm::Sp(beta_*omega_, omega_) ); omegaEqn().relax(); omegaEqn().boundaryManipulate(omega_.boundaryField()); solve(omegaEqn); bound(omega_, omegaMin_); // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn ( fvm::ddt(k_) + fvm::div(phi_, k_) - fvm::laplacian(DkEff(), k_) == G - fvm::Sp(Cmu_*omega_, k_) ); kEqn().relax(); solve(kEqn); bound(k_, kMin_); // Re-calculate viscosity nut_ = k_/omega_; nut_.correctBoundaryConditions(); }
int unElements::OnLoadElement( void* elementsPtr, int /*argc*/, char** argv, char** /*azColName*/ ) { // Get reference to caller unElements* caller = static_cast<unElements*>(elementsPtr); // Get parent element unNameID parentName = GName(wxString(argv[0], wxConvUTF8)); unElement* parent = caller->GetElementByType(parentName, true); if( !parent ) { parent = new unElement(parentName, GNameNone(), parentName, GNameNone()); caller->AddElement(parent); //wxLogMessage(wxT("%s"), parent->Type.c_str()); } // Add child to parent parent->AddChild(new unElement ( GName(wxString(argv[1], wxConvUTF8)) , GName(wxString(argv[2], wxConvUTF8)) , GName(wxString(argv[3], wxConvUTF8)) , GName(wxString(argv[4], wxConvUTF8)))); return SQLITE_OK; }
unElement* unElements::GetElementNumbered( const wxString& name, qword number, bool bCanFail/*=false */ ) { unElementMap::iterator it = ElementsByType.find(GName(wxString::Format(wxT("%s.0x%.2llx"),name.c_str(), number))); if( it == ElementsByType.end() ) { it = ElementsByType.find(GName(wxString::Format(wxT("%s.0x%.4llx"),name.c_str(), number))); if( it == ElementsByType.end() ) { it = ElementsByType.find(GName(wxString::Format(wxT("%s.0x%.8llx"),name.c_str(), number))); if( it == ElementsByType.end() ) { it = ElementsByType.find(GName(wxString::Format(wxT("%s.0x%.16llx"),name.c_str(), number))); } } } if( it != ElementsByType.end() ) return (*it).second; else if( bCanFail ) return NULL; else throw unException( wxT("Unknown element requested: %s"), name.c_str() ); }
void oneEqEddy::correct(const tmp<volTensorField>& gradU) { GenEddyVisc::correct(gradU); volScalarField G(GName(), 2.0*nuSgs_*magSqr(symm(gradU))); tmp<fvScalarMatrix> kEqn ( fvm::ddt(k_) + fvm::div(phi(), k_) - fvm::laplacian(DkEff(), k_) == G - fvm::Sp(ce_*sqrt(k_)/delta(), k_) ); kEqn().relax(); kEqn().solve(); bound(k_, kMin_); updateSubGridScaleFields(); }
void tatunRNG::correct() { if (!turbulence_) { // Re-calculate viscosity mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity alphat_ = mut_/Prt_; alphat_.correctBoundaryConditions(); return; } RASModel::correct(); volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_))); if (mesh_.moving()) { divU += fvc::div(mesh_.phi()); } tmp<volTensorField> tgradU = fvc::grad(U_); volScalarField S2((tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); //volScalarField G(type() + ".G", mut_*S2); volScalarField G(GName(), mut_*S2); // changed from 2.1.1 --> 2.2.2 volScalarField eta(sqrt(mag(S2))*k_/epsilon_); volScalarField eta3(eta*sqr(eta)); volScalarField R ( ((eta*(-eta/eta0_ + scalar(1)))/(beta_*eta3 + scalar(1))) ); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); // Dissipation equation tmp<fvScalarMatrix> epsEqn ( fvm::ddt(rho_, epsilon_) + fvm::div(phi_, epsilon_) - fvm::laplacian(DepsilonEff(), epsilon_) == (C1_ - R)*G*epsilon_/k_ - fvm::SuSp(((2.0/3.0)*C1_ + C3_)*rho_*divU, epsilon_) - fvm::Sp(C2_*rho_*epsilon_/k_, epsilon_) ); epsEqn().relax(); epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); bound(epsilon_, epsilonMin_); volScalarField YMperk = 2.0*rho_*epsilon_/(soundSpeed_*soundSpeed_); // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn ( fvm::ddt(rho_, k_) + fvm::div(phi_, k_) - fvm::laplacian(DkEff(), k_) == G - fvm::SuSp(2.0/3.0*rho_*divU, k_) - fvm::Sp(rho_*epsilon_/k_, k_) - fvm::Sp(YMperk, k_) ); kEqn().relax(); solve(kEqn); bound(k_, kMin_); // Re-calculate viscosity mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity alphat_ = mut_/Prt_; alphat_.correctBoundaryConditions(); }
void PDRkEpsilon::correct() { if (!turbulence_) { // Re-calculate viscosity nut_ = Cmu_*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity //***HGWalphat_ = mut_/Prt_; // alphat_.correctBoundaryConditions(); return; } RASModel::correct(); volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_))); if (mesh_.moving()) { divU += fvc::div(mesh_.phi()); } tmp<volTensorField> tgradU = fvc::grad(U_); volScalarField G(GName(), rho_*nut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); // Update espsilon and G at the wall epsilon_.boundaryFieldRef().updateCoeffs(); // Add the blockage generation term so that it is included consistently // in both the k and epsilon equations const volScalarField& betav = U_.db().lookupObject<volScalarField>("betav"); const volScalarField& Lobs = U_.db().lookupObject<volScalarField>("Lobs"); const PDRDragModel& drag = U_.db().lookupObject<PDRDragModel>("PDRDragModel"); volScalarField GR(drag.Gk()); volScalarField LI (C4_*(Lobs + dimensionedScalar(dimLength, rootVSmall))); // Dissipation equation tmp<fvScalarMatrix> epsEqn ( betav*fvm::ddt(rho_, epsilon_) + fvm::div(phi_, epsilon_) - fvm::laplacian(rho_*DepsilonEff(), epsilon_) == C1_*betav*G*epsilon_/k_ + 1.5*pow(Cmu_, 3.0/4.0)*GR*sqrt(k_)/LI - fvm::SuSp(((2.0/3.0)*C1_)*betav*rho_*divU, epsilon_) - fvm::Sp(C2_*betav*rho_*epsilon_/k_, epsilon_) ); epsEqn.ref().relax(); epsEqn.ref().boundaryManipulate(epsilon_.boundaryFieldRef()); solve(epsEqn); bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn ( betav*fvm::ddt(rho_, k_) + fvm::div(phi_, k_) - fvm::laplacian(rho_*DkEff(), k_) == betav*G + GR - fvm::SuSp((2.0/3.0)*betav*rho_*divU, k_) - fvm::Sp(betav*rho_*epsilon_/k_, k_) ); kEqn.ref().relax(); solve(kEqn); bound(k_, kMin_); // Re-calculate viscosity nut_ = Cmu_*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity //***HGWalphat_ = mut_/Prt_; // alphat_.correctBoundaryConditions(); }
void kEpsilon::correct() { if (!turbulence_) { // Re-calculate viscosity mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity alphat_ = mut_/Prt_; alphat_.correctBoundaryConditions(); return; } RASModel::correct(); volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_))); if (mesh_.moving()) { divU += fvc::div(mesh_.phi()); } tmp<volTensorField> tgradU = fvc::grad(U_); volScalarField G(GName(), mut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); // Dissipation equation tmp<fvScalarMatrix> epsEqn ( fvm::ddt(rho_, epsilon_) + fvm::div(phi_, epsilon_) - fvm::laplacian(DepsilonEff(), epsilon_) == C1_*G*epsilon_/k_ - fvm::SuSp(((2.0/3.0)*C1_ + C3_)*rho_*divU, epsilon_) - fvm::Sp(C2_*rho_*epsilon_/k_, epsilon_) ); epsEqn().relax(); epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn ( fvm::ddt(rho_, k_) + fvm::div(phi_, k_) - fvm::laplacian(DkEff(), k_) == G - fvm::SuSp((2.0/3.0)*rho_*divU, k_) - fvm::Sp(rho_*epsilon_/k_, k_) ); kEqn().relax(); solve(kEqn); bound(k_, kMin_); // Re-calculate viscosity mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity alphat_ = mut_/Prt_; alphat_.correctBoundaryConditions(); }