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 343 of file ALEHelper.cpp.

344 : m_zone(std::static_pointer_cast<SpatialDomains::ZoneRotate>(zone))
345{
346}
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 396 of file ALEHelper.cpp.

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

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 348 of file ALEHelper.cpp.

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