|
This email from saad.debbahi@gmail.com originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders list to disable email stamping for this address. |
void VelocityCorrectionScheme::v_SolveViscous(const Array<OneD, const Array<OneD, NekDouble>> &Forcing,const Array<OneD, const Array<OneD, NekDouble>> &inarray,Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble aii_Dt){StdRegions::ConstFactorMap factors;StdRegions::VarCoeffMap varCoeffMap = StdRegions::NullVarCoeffMap;MultiRegions::VarFactorsMap varFactorsMap = MultiRegions::NullVarFactorsMap;
AppendSVVFactors(factors, varFactorsMap);ComputeGJPNormalVelocity(inarray, varCoeffMap);/*switch (coordim){case 3:Exp->GetCoords(xc0, xc1, xc2);break;default:ASSERTL0(false, "Coordim not valid");break;}*/
/////////////////////////////////////////////////////////////////////////////////////////// Modifications to account for variable viscosity start here://///////
int nuflag=0; //initialiazed to 0, fall back to constant viscosity if nu(T) is not definedtime_t rawTime;time(&rawTime);NekDouble time = static_cast<NekDouble>(rawTime);//ensure time is of NekDouble type
// if the function nuOfT is defined in the session file, evaluate the function and set variable viscosityif(m_session->DefinesFunction("nuOfT")){Array<OneD, NekDouble> xxc0,xxc1,xxc2;// declare NekDouble arrays to hold coordinates
int nqv;// total pointsint coordim=3;// default dimensionLibUtilities::EquationSharedPtr nuOfTfunc;nqv=m_fields[0]->GetTotPoints();
// allocate 0.0 valued arrays of totalpoints size, to receive the space coordinatesxxc0 = Array<OneD, NekDouble>(nqv, 0.0);xxc1 = Array<OneD, NekDouble>(nqv, 0.0);xxc2 = Array<OneD, NekDouble>(nqv, 0.0);
m_fields[0]->GetCoords(xxc0,xxc1,xxc2);coordim=m_fields[0]->GetCoordim(0);
Array<OneD,NekDouble> nuOfT(nqv,0.0);// 0.0 valued nekdouble array to hold viscosity value at each point of spacenuOfTfunc=m_session->GetFunction("nuOfT",0);
nuOfTfunc->Evaluate(xxc0,xxc1,xxc2,nuOfT);// evaluate the function nu(T)varCoeffMap[StdRegions::eVarCoeffD00]=nuOfT;// assign the values of viscosity for the three diagonal components (same) evaluatedvarCoeffMap[StdRegions::eVarCoeffD11]=nuOfT;// at every point of space using the decalred nu(T) functionvarCoeffMap[StdRegions::eVarCoeffD22]=nuOfT;
nuflag=1;// set the variable viscosity flag
}
// Solve Helmholtz system and put in Physical spacefor (int i = 0; i < m_nConvectiveFields; ++i){
// Add diffusion coefficient to GJP matrix operator (Implicit part)if (m_useGJPStabilisation){factors[StdRegions::eFactorGJP] = m_GJPJumpScale / m_diffCoeff[i];}
// Setup coefficients for equationfactors[StdRegions::eFactorLambda] = 1.0 / aii_Dt / m_diffCoeff[i];if (nuflag==1) factors[StdRegions::eFactorTime]=time;//if the nuOfT nu(T) function is defined set the tume factor,//else continue with constant viscosity
m_fields[i]->HelmSolve(Forcing[i], m_fields[i]->UpdateCoeffs(), factors,varCoeffMap, varFactorsMap);m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(), outarray[i]);}
}