Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Nektar::SolverUtils::ALERotate Struct Referencefinal

#include <ALEHelper.h>

Inheritance diagram for Nektar::SolverUtils::ALERotate:
[legend]

Public Member Functions

 ALERotate (SpatialDomains::ZoneBaseShPtr zone)
 
void v_UpdateGridVel (const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity) final
 
bool v_UpdateNormalsFlag () final
 
void v_ResetMatricesNormal (Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, MultiRegions::ExpListSharedPtr > &fields) final
 
- Public Member Functions inherited from Nektar::SolverUtils::ALEBase
virtual ~ALEBase ()=default
 
void UpdateGridVel (const NekDouble time, Array< OneD, MultiRegions::ExpListSharedPtr > &fields, Array< OneD, Array< OneD, NekDouble > > &gridVelocity)
 
void ResetMatricesNormal (Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 
bool UpdateNormalsFlag ()
 

Private Attributes

SpatialDomains::ZoneRotateShPtr m_zone
 

Additional Inherited Members

- Public Attributes inherited from Nektar::SolverUtils::ALEBase
bool m_meshDistorted = false
 

Detailed Description

Definition at line 202 of file ALEHelper.h.

Constructor & Destructor Documentation

◆ ALERotate()

Nektar::SolverUtils::ALERotate::ALERotate ( SpatialDomains::ZoneBaseShPtr  zone)

Definition at line 346 of file ALEHelper.cpp.

347 : m_zone(std::static_pointer_cast<SpatialDomains::ZoneRotate>(zone))
348{
349}
SpatialDomains::ZoneRotateShPtr m_zone
Definition ALEHelper.h:221

Member Function Documentation

◆ v_ResetMatricesNormal()

void Nektar::SolverUtils::ALERotate::v_ResetMatricesNormal ( Array< OneD, Array< OneD, NekDouble > > &  traceNormals,
Array< OneD, MultiRegions::ExpListSharedPtr > &  fields 
)
finalvirtual

Implements Nektar::SolverUtils::ALEBase.

Definition at line 399 of file ALEHelper.cpp.

402{
403
404 auto curvedEdges = fields[0]->GetGraph()->GetCurvedEdges();
405 auto curvedFaces = fields[0]->GetGraph()->GetCurvedFaces();
406
407 // The order of the resets below is v important to avoid errors
408 if (m_meshDistorted)
409 {
410 for (auto &field : fields)
411 {
412 field->ResetMatrices();
413 }
414 }
415
416 // Loop over all elements and faces and edges and reset geometry
417 // information. Only need to do this on the first field as the geometry
418 // information is shared.
419 if (m_zone->GetMoved() && m_zone->v_GetAngle() != 0)
420 {
421 auto conEl = m_zone->GetConstituentElements();
422 for (const auto &i : conEl)
423 {
424 for (const auto &j : i)
425 {
426 j->ResetNonRecursive(curvedEdges, curvedFaces);
427 }
428 }
429
430 // We need to rebuild geometric factors on the trace elements
431 for (const auto &i : conEl[fields[0]->GetShapeDimension() -
432 1]) // This only takes the trace elements
433 {
434 fields[0]->GetTrace()->GetExpFromGeomId(i->GetGlobalID())->Reset();
435 }
436 }
437
438 if (m_zone->GetMoved() && m_zone->v_GetAngle() != 0)
439 {
440 auto conEl = m_zone->GetConstituentElements();
441 // Loop over zone elements expansions and rebuild geometric
442 // factors
443 for (const auto &i :
444 conEl[0]) // This only takes highest dimensioned elements
445 {
446 fields[0]->GetExpFromGeomId(i->GetGlobalID())->Reset();
447 }
448 }
449
450 if (m_zone->GetMoved() && m_zone->v_GetAngle() != 0)
451 {
452 auto conEl = m_zone->GetConstituentElements();
453 // Loop over zone elements expansions and rebuild geometric factors
454 // and recalc trace normals
455 for (const auto &i :
456 conEl[0]) // This only takes highest dimensioned elements
457 {
458 int nfaces =
459 fields[0]->GetExpFromGeomId(i->GetGlobalID())->GetNtraces();
460 for (int j = 0; j < nfaces; ++j)
461 {
462 fields[0]
463 ->GetExpFromGeomId(i->GetGlobalID())
464 ->ComputeTraceNormal(j);
465 }
466 }
467 }
468
469 for (auto &field : fields)
470 {
471 // Reset collections (despite the default being eNoCollection it does
472 // remember the last auto-tuned values), eNoImpType gives lots of output
473 field->CreateCollections(Collections::eNoCollection);
474 }
475
476 // Reload new trace normals in to the solver cache
477 fields[0]->GetTrace()->GetNormals(traceNormals);
478}

References Nektar::Collections::eNoCollection, Nektar::SolverUtils::ALEBase::m_meshDistorted, and m_zone.

◆ v_UpdateGridVel()

void Nektar::SolverUtils::ALERotate::v_UpdateGridVel ( const NekDouble  time,
Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
Array< OneD, Array< OneD, NekDouble > > &  gridVelocity 
)
finalvirtual

Implements Nektar::SolverUtils::ALEBase.

Definition at line 351 of file ALEHelper.cpp.

355{
356
357 auto angVel = m_zone->GetAngularVel(time);
358 auto axis = m_zone->GetAxis();
359 auto origin = m_zone->GetOrigin();
360
361 auto exp = fields[0]->GetExp();
362
363 auto elements = m_zone->GetElements();
364 for (auto &el : elements)
365 {
366 int indx = fields[0]->GetElmtToExpId(el->GetGlobalID());
367 int offset = fields[0]->GetPhys_Offset(indx);
368 auto expansion = (*exp)[indx];
369
370 int nq = expansion->GetTotPoints();
371
372 Array<OneD, NekDouble> xc(nq, 0.0), yc(nq, 0.0), zc(nq, 0.0);
373 Array<OneD, NekDouble> norm(3, 0.0);
374 expansion->GetCoords(xc, yc, zc);
375 for (int i = 0; i < nq; ++i)
376 {
377 // Vector from origin to point
378 NekDouble xpointMinOrigin = xc[i] - origin(0);
379 NekDouble ypointMinOrigin = yc[i] - origin(1);
380 NekDouble zpointMinOrigin = zc[i] - origin(2);
381
382 // Vector orthogonal to plane formed by axis and point
383 // We negate angVel here as by convention a positive angular
384 // velocity is counter-clockwise
385 norm[0] = (ypointMinOrigin * axis[2] - zpointMinOrigin * axis[1]) *
386 (-angVel);
387 norm[1] = (zpointMinOrigin * axis[0] - xpointMinOrigin * axis[2]) *
388 (-angVel);
389 norm[2] = (xpointMinOrigin * axis[1] - ypointMinOrigin * axis[0]) *
390 (-angVel);
391 for (int j = 0; j < gridVelocity.size(); ++j)
392 {
393 gridVelocity[j][offset + i] = norm[j];
394 }
395 }
396 }
397}
const NekPoint< NekDouble > origin

References m_zone.

◆ v_UpdateNormalsFlag()

bool Nektar::SolverUtils::ALERotate::v_UpdateNormalsFlag ( )
inlinefinalvirtual

Implements Nektar::SolverUtils::ALEBase.

Definition at line 211 of file ALEHelper.h.

212 {
213 return true;
214 }

Member Data Documentation

◆ m_zone

SpatialDomains::ZoneRotateShPtr Nektar::SolverUtils::ALERotate::m_zone
private

Definition at line 221 of file ALEHelper.h.

Referenced by v_ResetMatricesNormal(), and v_UpdateGridVel().