38 #include <boost/algorithm/string.hpp>
57 UnsteadySystem(pSession),
58 m_subSteppingScheme(false),
59 m_SmoothAdvection(false),
68 int numfields =
m_fields.num_elements();
69 std::string velids[] = {
"u",
"v",
"w"};
76 for(j = 0; j < numfields; ++j)
79 if(boost::iequals(velids[i], var))
85 ASSERTL0(j != numfields,
"Failed to find field: " + var);
123 for(
int n = 0; n <
m_fields[0]->GetBndConditions().num_elements(); ++n)
128 m_fields[0]->GetBndConditions()[n]->GetUserDefined() ==
130 m_fields[0]->GetBndConditions()[n]->GetUserDefined() ==
132 m_fields[0]->GetBndConditions()[n]->GetUserDefined() ==
134 m_fields[0]->GetBndConditions()[n]->GetUserDefined() ==
136 m_fields[0]->GetBndConditions()[n]->GetUserDefined() ==
138 m_fields[0]->GetBndConditions()[n]->GetUserDefined() ==
140 "Unknown USERDEFINEDTYPE boundary condition");
146 ASSERTL0(
false,
"Unknown or undefined equation type");
152 std::string vConvectiveType;
156 vConvectiveType =
"NoAdvection";
160 vConvectiveType =
"Convective";
163 vConvectiveType =
"Linearised";
172 vConvectiveType =
m_session->GetTag(
"AdvectiveType");
188 for (i = 0; i <
m_fields.num_elements(); ++i)
192 Array<OneD, const SpatialDomains::BoundaryConditionShPtr > BndConds;
193 Array<OneD, MultiRegions::ExpListSharedPtr> BndExp;
196 BndConds =
m_fields[i]->GetBndConditions();
197 BndExp =
m_fields[i]->GetBndCondExpansions();
198 for(
int n = 0; n < BndConds.num_elements(); ++n)
203 "Radiation boundary condition must be of type Robin <R>");
210 radpts += BndExp[n]->GetTotPoints();
214 m_fieldsRadiationFactor[i] = Array<OneD, NekDouble>(radpts);
218 for(
int n = 0; n < BndConds.num_elements(); ++n)
223 int npoints = BndExp[n]->GetNpoints();
224 Array<OneD, NekDouble> x0(npoints,0.0);
225 Array<OneD, NekDouble> x1(npoints,0.0);
226 Array<OneD, NekDouble> x2(npoints,0.0);
227 Array<OneD, NekDouble> tmpArray;
229 BndExp[n]->GetCoords(x0,x1,x2);
232 boost::static_pointer_cast<
234 >(BndConds[n])->m_robinPrimitiveCoeff;
237 tmpArray = m_fieldsRadiationFactor[i]+ radpts);
251 std::string vExtrapolation =
"Standard";
253 if (
m_session->DefinesSolverInfo(
"Extrapolation"))
255 vExtrapolation =
m_session->GetSolverInfo(
"Extrapolation");
280 Array<
OneD, Array<OneD, NekDouble> > &physfield,
281 Array<
OneD, Array<OneD, NekDouble> > &flux)
283 ASSERTL1(flux.num_elements() ==
m_velocity.num_elements(),
"Dimension of flux array and velocity array do not match");
285 for(
int j = 0; j < flux.num_elements(); ++j)
295 Array<
OneD, Array<OneD, NekDouble> > &numflux)
307 Array<OneD, NekDouble> Fwd(2*nTracePts);
310 Array<OneD, NekDouble> Bwd = Fwd + nTracePts;
313 Array<OneD, NekDouble> Vn (nTracePts, 0.0);
316 for(i = 0; i < nDimensions; ++i)
323 for(i = 0; i < numflux.num_elements(); ++i)
326 m_fields[i]->GetFwdBwdTracePhys(physfield[i], Fwd, Bwd);
329 m_fields[i]->GetTrace()->Upwind(Vn, Fwd, Bwd, numflux[i]);
333 Vmath::Vmul(nTracePts, numflux[i], 1, Vn, 1, numflux[i], 1);
341 Array<
OneD, Array<OneD, NekDouble> > &outarray,
342 Array<OneD, NekDouble> &wk)
345 int nqtot =
m_fields[0]->GetTotPoints();
347 Array<OneD, Array<OneD, NekDouble> > velocity(VelDim);
348 Array<OneD, NekDouble > Deriv;
349 for(i = 0; i < VelDim; ++i)
354 if(wk.num_elements())
356 ASSERTL0(wk.num_elements() >= nqtot*VelDim,
357 "Workspace is not sufficient");
362 Deriv = Array<OneD, NekDouble> (nqtot*VelDim);
376 int nvariables =
m_fields.num_elements();
378 for (i = 0; i < nvariables; ++i)
380 for(n = 0; n <
m_fields[i]->GetBndConditions().num_elements(); ++n)
382 if(
m_fields[i]->GetBndConditions()[n]->GetUserDefined() ==
386 m_fields[i]->EvaluateBoundaryConditions(time, varName);
403 Array<OneD, const SpatialDomains::BoundaryConditionShPtr > BndConds;
404 Array<OneD, MultiRegions::ExpListSharedPtr> BndExp;
407 BndConds =
m_fields[fieldid]->GetBndConditions();
408 BndExp =
m_fields[fieldid]->GetBndCondExpansions();
414 int elmtid,nq,offset, boundary;
415 Array<OneD, NekDouble> Bvals, U;
419 for(cnt = n = 0; n < BndConds.num_elements(); ++n)
425 for(i = 0; i < BndExp[n]->GetExpSize(); ++i,cnt++)
428 elmt =
m_fields[fieldid]->GetExp(elmtid);
429 offset =
m_fields[fieldid]->GetPhys_Offset(elmtid);
431 U =
m_fields[fieldid]->UpdatePhys() + offset;
432 Bc = BndExp[n]->GetExp(i);
437 nq = Bc->GetTotPoints();
438 Array<OneD, NekDouble> ubc(nq);
439 elmt->GetTracePhysVals(boundary,Bc,U,ubc);
444 Bvals = BndExp[n]->UpdateCoeffs()+BndExp[n]->GetCoeff_Offset(i);
446 Bc->IProductWRTBase(ubc,Bvals);
448 cnt1 += BndExp[n]->GetTotPoints();
456 cnt += BndExp[n]->GetExpSize();
460 ASSERTL0(
false,
"Unknown USERDEFINEDTYPE in pressure boundary condition");
483 bool returnval =
false;
488 int ncoeffs =
m_fields[0]->GetNcoeffs();
490 for(
int i = 0; i <
m_fields.num_elements(); ++i)
511 int n_element =
m_fields[0]->GetExpSize();
514 Array<OneD, int> ExpOrderList (n_element, ExpOrder);
518 Array<OneD, NekDouble> cfl (n_element, 0.0);
519 Array<OneD, NekDouble> stdVelocity(n_element, 0.0);
520 Array<OneD, Array<OneD, NekDouble> > velfields;
524 velfields = Array<OneD, Array<OneD, NekDouble> >(2);
526 for(
int i = 0; i < 2; ++i)
533 velfields = Array<OneD, Array<OneD, NekDouble> >(n_vel);
535 for(
int i = 0; i < n_vel; ++i)
543 for(
int el = 0; el < n_element; ++el)
545 cfl[el] =
m_timestep*(stdVelocity[el] * cLambda *
546 (ExpOrder[el]-1) * (ExpOrder[el]-1));
557 int n_element =
m_fields[0]->GetExpSize();
564 CFL = CFL_loc = cfl[elmtid];
568 elmtid =
m_fields[0]->GetExp(elmtid)->GetGeom()->GetGlobalID();
579 elmtid = elmtid%
m_fields[0]->GetPlane(0)->GetExpSize();
606 if(
m_comm->GetRank() == 0)
608 cout <<
"CFL (zero plane): "<< cfl <<
" (in elmt "
609 << elmtid <<
")" << endl;
617 cout <<
"Reached Steady State to tolerance "