Nektar++
Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Nektar::AcousticSystem Class Referenceabstract

#include <AcousticSystem.h>

Inheritance diagram for Nektar::AcousticSystem:
[legend]

Protected Member Functions

 AcousticSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises UnsteadySystem class members. More...
 
 ~AcousticSystem () override=default
 
void v_InitObject (bool DeclareFields=true) override
 Initialization object for the AcousticSystem class. More...
 
void DoOdeRhs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Compute the right-hand side. More...
 
void DoOdeProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Compute the projection and call the method for imposing the boundary conditions in case of discontinuous projection. More...
 
virtual void v_AddLinTerm (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)=0
 
virtual void v_GetFluxVector (const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)=0
 
virtual void v_RiemannInvariantBC (int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &BfFwd, Array< OneD, Array< OneD, NekDouble > > &physarray)=0
 
bool v_PreIntegrate (int step) override
 v_PreIntegrate More...
 
void v_Output () override
 
Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor) override
 Compute the advection velocity in the standard space for each element of the expansion. More...
 
void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables) override
 
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetBasefieldFwdBwd ()
 
- Protected Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
SOLVER_UTILS_EXPORT void v_InitObject (bool DeclareField=true) override
 Initialisation object for EquationSystem. More...
 
SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step) override
 
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor=1.0)
 
- Protected Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT UnsteadySystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises UnsteadySystem class members. More...
 
SOLVER_UTILS_EXPORT void v_InitObject (bool DeclareField=true) override
 Init object for UnsteadySystem class. More...
 
SOLVER_UTILS_EXPORT void v_DoSolve () override
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_PrintStatusInformation (const int step, const NekDouble cpuTime)
 Print Status Information. More...
 
virtual SOLVER_UTILS_EXPORT void v_PrintSummaryStatistics (const NekDouble intTime)
 Print Summary Statistics. More...
 
SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true) override
 Sets up initial conditions. More...
 
SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s) override
 Print a summary of time stepping parameters. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Return the timestep to be used for the next step in the time-marching loop. More...
 
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans ()
 
virtual SOLVER_UTILS_EXPORT void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
virtual SOLVER_UTILS_EXPORT bool v_UpdateTimeStepCheck ()
 
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control. More...
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time, int &nchk)
 
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff (const Array< OneD, Array< OneD, NekDouble > > vel, StdRegions::VarCoeffMap &varCoeffMap)
 Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h time velocity. More...
 
SOLVER_UTILS_EXPORT void DoDummyProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Perform dummy projection. More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT void v_InitObject (bool DeclareFeld=true)
 Initialisation object for EquationSystem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true)
 Virtual function for initialisation implementation. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Virtual function for solve implementation. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_H1Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the H_1 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys ()
 Virtual function for transformation to physical space. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff ()
 Virtual function for transformation to coefficient space. More...
 
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &l)
 Virtual function for generating summary information. More...
 
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution (unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 
virtual SOLVER_UTILS_EXPORT void v_Output (void)
 
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure (void)
 
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp (void)
 Virtual function to identify if operator is negated in DoSolve. More...
 
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 

Protected Attributes

int m_ip
 indices of the fields More...
 
int m_irho
 
int m_iu
 
bool m_conservative
 we are dealing with a conservative formualtion More...
 
SolverUtils::CouplingSharedPtr m_coupling
 
SolverUtils::AdvectionSharedPtr m_advection
 
std::vector< SolverUtils::ForcingSharedPtrm_forcing
 
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
 
Array< OneD, Array< OneD, NekDouble > > m_bfFwdBwd
 
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
 
Array< OneD, Array< OneD, NekDouble > > m_bf
 
std::vector< std::string > m_bfNames
 
- Protected Attributes inherited from Nektar::SolverUtils::AdvectionSystem
SolverUtils::AdvectionSharedPtr m_advObject
 Advection term. More...
 
- Protected Attributes inherited from Nektar::SolverUtils::UnsteadySystem
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
Array< OneD, Array< OneD, NekDouble > > m_previousSolution
 Storage for previous solution for steady-state check. More...
 
std::vector< int > m_intVariables
 
NekDouble m_cflSafetyFactor
 CFL safety factor (comprise between 0 to 1). More...
 
NekDouble m_CFLGrowth
 CFL growth rate. More...
 
NekDouble m_CFLEnd
 Maximun cfl in cfl growth. More...
 
int m_abortSteps
 Number of steps between checks for abort conditions. More...
 
bool m_explicitDiffusion
 Indicates if explicit or implicit treatment of diffusion is used. More...
 
bool m_explicitAdvection
 Indicates if explicit or implicit treatment of advection is used. More...
 
bool m_explicitReaction
 Indicates if explicit or implicit treatment of reaction is used. More...
 
int m_steadyStateSteps
 Check for steady state at step interval. More...
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at. More...
 
int m_filtersInfosteps
 Number of time steps between outputting filters information. More...
 
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state. More...
 
std::ofstream m_errFile
 
NekDouble m_epsilon
 Diffusion coefficient. More...
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
bool m_verbose
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
std::map< std::string, SolverUtils::SessionFunctionSharedPtrm_sessionFunctions
 Map of known SessionFunctions. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Array holding all dependent variables. More...
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh. More...
 
std::string m_sessionName
 Name of the session. More...
 
NekDouble m_time
 Current time of simulation. More...
 
int m_initialStep
 Number of the step where the simulation should begin. More...
 
NekDouble m_fintime
 Finish time of the simulation. More...
 
NekDouble m_timestep
 Time step size. More...
 
NekDouble m_lambda
 Lambda constant in real system if one required. More...
 
NekDouble m_checktime
 Time between checkpoints. More...
 
NekDouble m_lastCheckTime
 
NekDouble m_TimeIncrementFactor
 
int m_nchk
 Number of checkpoints written so far. More...
 
int m_steps
 Number of steps to take. More...
 
int m_checksteps
 Number of steps between checkpoints. More...
 
int m_infosteps
 Number of time steps between outputting status information. More...
 
int m_iterPIT = 0
 Number of parallel-in-time time iteration. More...
 
int m_windowPIT = 0
 Index of windows for parallel-in-time time iteration. More...
 
int m_spacedim
 Spatial dimension (>= expansion dim). More...
 
int m_expdim
 Expansion dimension. More...
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform. More...
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations. More...
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation. More...
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction. More...
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity. More...
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields. More...
 
Array< OneD, NekDoublem_movingFrameData
 Moving reference frame status in the inertial frame X, Y, Z, Theta_x, Theta_y, Theta_z, U, V, W, Omega_x, Omega_y, Omega_z, A_x, A_y, A_z, DOmega_x, DOmega_y, DOmega_z, pivot_x, pivot_y, pivot_z. More...
 
std::vector< std::string > m_strFrameData
 variable name in m_movingFrameData More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 
- Protected Attributes inherited from Nektar::SolverUtils::ALEHelper
Array< OneD, MultiRegions::ExpListSharedPtrm_fieldsALE
 
Array< OneD, Array< OneD, NekDouble > > m_gridVelocity
 
Array< OneD, Array< OneD, NekDouble > > m_gridVelocityTrace
 
std::vector< ALEBaseShPtrm_ALEs
 
bool m_ALESolver = false
 
bool m_ImplicitALESolver = false
 
NekDouble m_prevStageTime = 0.0
 
int m_spaceDim
 

Private Member Functions

NekDouble GetCFLEstimate ()
 
void SetBoundaryConditions (Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
 Apply the Boundary Conditions to the AcousticSystem equations. More...
 
void WallBC (int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
 Wall boundary conditions for the AcousticSystem equations. More...
 
void WhiteNoiseBC (int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &BfFwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
 Wall boundary conditions for the AcousticSystem equations. More...
 
void CopyBoundaryTrace (const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
 
void UpdateBasefieldFwdBwd ()
 

Private Attributes

std::map< int, boost::mt19937 > m_rng
 
NekDouble m_whiteNoiseBC_lastUpdate
 
NekDouble m_whiteNoiseBC_p
 

Friends

class MemoryManager< AcousticSystem >
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
SOLVER_UTILS_EXPORT AdvectionSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
SOLVER_UTILS_EXPORT ~AdvectionSystem () override=default
 
SOLVER_UTILS_EXPORT AdvectionSharedPtr GetAdvObject ()
 Returns the advection object held by this instance. More...
 
SOLVER_UTILS_EXPORT Array< OneD, NekDoubleGetElmtCFLVals (const bool FlagAcousticCFL=true)
 
SOLVER_UTILS_EXPORT NekDouble GetCFLEstimate (int &elmtid)
 
- Public Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT ~UnsteadySystem () override=default
 Destructor. More...
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Calculate the larger time-step mantaining the problem stable. More...
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep ()
 
SOLVER_UTILS_EXPORT void SetTimeStep (const NekDouble timestep)
 
SOLVER_UTILS_EXPORT void SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
SOLVER_UTILS_EXPORT LibUtilities::TimeIntegrationSchemeSharedPtrGetTimeIntegrationScheme ()
 Returns the time integration scheme. More...
 
SOLVER_UTILS_EXPORT LibUtilities::TimeIntegrationSchemeOperatorsGetTimeIntegrationSchemeOperators ()
 Returns the time integration scheme operators. More...
 
- Public Member Functions inherited from Nektar::SolverUtils::EquationSystem
virtual SOLVER_UTILS_EXPORT ~EquationSystem ()
 Destructor. More...
 
SOLVER_UTILS_EXPORT void InitObject (bool DeclareField=true)
 Initialises the members of this object. More...
 
SOLVER_UTILS_EXPORT void DoInitialise (bool dumpInitialConditions=true)
 Perform any initialisation necessary before solving the problem. More...
 
SOLVER_UTILS_EXPORT void DoSolve ()
 Solve the problem. More...
 
SOLVER_UTILS_EXPORT void TransCoeffToPhys ()
 Transform from coefficient to physical space. More...
 
SOLVER_UTILS_EXPORT void TransPhysToCoeff ()
 Transform from physical to coefficient space. More...
 
SOLVER_UTILS_EXPORT void Output ()
 Perform output operations after solve. More...
 
SOLVER_UTILS_EXPORT std::string GetSessionName ()
 Get Session name. More...
 
template<class T >
std::shared_ptr< T > as ()
 
SOLVER_UTILS_EXPORT void ResetSessionName (std::string newname)
 Reset Session name. More...
 
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession ()
 Get Session name. More...
 
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure ()
 Get pressure field if available. More...
 
SOLVER_UTILS_EXPORT void ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
SOLVER_UTILS_EXPORT void PrintSummary (std::ostream &out)
 Print a summary of parameters and solver characteristics. More...
 
SOLVER_UTILS_EXPORT void SetLambda (NekDouble lambda)
 Set parameter m_lambda. More...
 
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction (std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
 Get a SessionFunction by name. More...
 
SOLVER_UTILS_EXPORT void SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 Initialise the data in the dependent fields. More...
 
SOLVER_UTILS_EXPORT void EvaluateExactSolution (int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 Evaluates an exact solution. More...
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
 Compute the L2 error between fields and a given exact solution. More...
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, bool Normalised=false)
 Compute the L2 error of the fields. More...
 
SOLVER_UTILS_EXPORT NekDouble LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Linf error computation. More...
 
SOLVER_UTILS_EXPORT NekDouble H1Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
 Compute the H1 error between fields and a given exact solution. More...
 
SOLVER_UTILS_EXPORT Array< OneD, NekDoubleErrorExtraPoints (unsigned int field)
 Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf]. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n)
 Write checkpoint file of m_fields. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n, MultiRegions::ExpListSharedPtr &field, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 Write checkpoint file of custom data fields. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow (const int n)
 Write base flow file of m_fields. More...
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname)
 Write field data to the given filename. More...
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname, MultiRegions::ExpListSharedPtr &field, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 Write input fields to the given filename. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
 Input field data from the given file. More...
 
SOLVER_UTILS_EXPORT void ImportFldToMultiDomains (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int ndomains)
 Input field data from the given file to multiple domains. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, std::vector< std::string > &fieldStr, Array< OneD, Array< OneD, NekDouble > > &coeffs)
 Output a field. Input field data into array from the given file. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, MultiRegions::ExpListSharedPtr &pField, std::string &pFieldName)
 Output a field. Input field data into ExpList from the given file. More...
 
SOLVER_UTILS_EXPORT void SessionSummary (SummaryList &vSummary)
 Write out a session summary. More...
 
SOLVER_UTILS_EXPORT Array< OneD, MultiRegions::ExpListSharedPtr > & UpdateFields ()
 
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMapUpdateFieldMetaDataMap ()
 Get hold of FieldInfoMap so it can be updated. More...
 
SOLVER_UTILS_EXPORT NekDouble GetTime ()
 Return final time. More...
 
SOLVER_UTILS_EXPORT int GetNcoeffs ()
 
SOLVER_UTILS_EXPORT int GetNcoeffs (const int eid)
 
SOLVER_UTILS_EXPORT int GetNumExpModes ()
 
SOLVER_UTILS_EXPORT const Array< OneD, int > GetNumExpModesPerExp ()
 
SOLVER_UTILS_EXPORT int GetNvariables ()
 
SOLVER_UTILS_EXPORT const std::string GetVariable (unsigned int i)
 
SOLVER_UTILS_EXPORT int GetTraceTotPoints ()
 
SOLVER_UTILS_EXPORT int GetTraceNpoints ()
 
SOLVER_UTILS_EXPORT int GetExpSize ()
 
SOLVER_UTILS_EXPORT int GetPhys_Offset (int n)
 
SOLVER_UTILS_EXPORT int GetCoeff_Offset (int n)
 
SOLVER_UTILS_EXPORT int GetTotPoints ()
 
SOLVER_UTILS_EXPORT int GetTotPoints (int n)
 
SOLVER_UTILS_EXPORT int GetNpoints ()
 
SOLVER_UTILS_EXPORT int GetSteps ()
 
SOLVER_UTILS_EXPORT void SetSteps (const int steps)
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep ()
 
SOLVER_UTILS_EXPORT void CopyFromPhysField (const int i, Array< OneD, NekDouble > &output)
 
SOLVER_UTILS_EXPORT void CopyToPhysField (const int i, const Array< OneD, const NekDouble > &input)
 
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > & UpdatePhysField (const int i)
 
SOLVER_UTILS_EXPORT void ZeroPhysFields ()
 
SOLVER_UTILS_EXPORT void FwdTransFields ()
 
SOLVER_UTILS_EXPORT void SetModifiedBasis (const bool modbasis)
 
SOLVER_UTILS_EXPORT int GetCheckpointNumber ()
 
SOLVER_UTILS_EXPORT void SetCheckpointNumber (int num)
 
SOLVER_UTILS_EXPORT int GetCheckpointSteps ()
 
SOLVER_UTILS_EXPORT void SetCheckpointSteps (int num)
 
SOLVER_UTILS_EXPORT int GetInfoSteps ()
 
SOLVER_UTILS_EXPORT void SetInfoSteps (int num)
 
SOLVER_UTILS_EXPORT void SetIterationNumberPIT (int num)
 
SOLVER_UTILS_EXPORT void SetWindowNumberPIT (int num)
 
SOLVER_UTILS_EXPORT Array< OneD, const Array< OneD, NekDouble > > GetTraceNormals ()
 
SOLVER_UTILS_EXPORT void SetTime (const NekDouble time)
 
SOLVER_UTILS_EXPORT void SetTimeStep (const NekDouble timestep)
 
SOLVER_UTILS_EXPORT void SetInitialStep (const int step)
 
SOLVER_UTILS_EXPORT void SetBoundaryConditions (NekDouble time)
 Evaluates the boundary conditions at the given time. More...
 
SOLVER_UTILS_EXPORT bool NegatedOp ()
 Identify if operator is negated in DoSolve. More...
 
- Public Member Functions inherited from Nektar::SolverUtils::ALEHelper
virtual ~ALEHelper ()=default
 
virtual SOLVER_UTILS_EXPORT void v_ALEInitObject (int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 
SOLVER_UTILS_EXPORT void InitObject (int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 
virtual SOLVER_UTILS_EXPORT void v_UpdateGridVelocity (const NekDouble &time)
 
virtual SOLVER_UTILS_EXPORT void v_ALEPreMultiplyMass (Array< OneD, Array< OneD, NekDouble > > &fields)
 
SOLVER_UTILS_EXPORT void ALEDoElmtInvMass (Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, Array< OneD, NekDouble > > &fields, NekDouble time)
 Update m_fields with u^n by multiplying by inverse mass matrix. That's then used in e.g. checkpoint output and L^2 error calculation. More...
 
SOLVER_UTILS_EXPORT void ALEDoElmtInvMassBwdTrans (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
SOLVER_UTILS_EXPORT void MoveMesh (const NekDouble &time, Array< OneD, Array< OneD, NekDouble > > &traceNormals)
 
const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocity ()
 
SOLVER_UTILS_EXPORT const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocityTrace ()
 
SOLVER_UTILS_EXPORT void ExtraFldOutputGridVelocity (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
- Static Public Attributes inherited from Nektar::SolverUtils::UnsteadySystem
static std::string cmdSetStartTime
 
static std::string cmdSetStartChkNum
 
- Protected Types inherited from Nektar::SolverUtils::EquationSystem
enum  HomogeneousType { eHomogeneous1D , eHomogeneous2D , eHomogeneous3D , eNotHomogeneous }
 Parameter for homogeneous expansions. More...
 
- Static Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
static std::string equationSystemTypeLookupIds []
 
static std::string projectionTypeLookupIds []
 

Detailed Description

Definition at line 59 of file AcousticSystem.h.

Constructor & Destructor Documentation

◆ AcousticSystem()

Nektar::AcousticSystem::AcousticSystem ( const LibUtilities::SessionReaderSharedPtr pSession,
const SpatialDomains::MeshGraphSharedPtr pGraph 
)
protected

Initialises UnsteadySystem class members.

Definition at line 54 of file AcousticSystem.cpp.

57 : UnsteadySystem(pSession, pGraph), AdvectionSystem(pSession, pGraph),
58 m_ip(-1), m_irho(-1), m_iu(1), m_conservative(false)
59{
60}
bool m_conservative
we are dealing with a conservative formualtion
int m_ip
indices of the fields
SOLVER_UTILS_EXPORT AdvectionSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
SOLVER_UTILS_EXPORT UnsteadySystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.

◆ ~AcousticSystem()

Nektar::AcousticSystem::~AcousticSystem ( )
overrideprotecteddefault

Member Function Documentation

◆ CopyBoundaryTrace()

void Nektar::AcousticSystem::CopyBoundaryTrace ( const Array< OneD, NekDouble > &  Fwd,
Array< OneD, NekDouble > &  Bwd 
)
private

Definition at line 593 of file AcousticSystem.cpp.

595{
596 int cnt = 0;
597 // loop over Boundary Regions
598 for (int bcRegion = 0; bcRegion < m_fields[0]->GetBndConditions().size();
599 ++bcRegion)
600 {
601
602 // Copy the forward trace of the field to the backward trace
603 int e, id2, npts;
604
605 for (e = 0;
606 e < m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
607 ++e)
608 {
609 npts = m_fields[0]
610 ->GetBndCondExpansions()[bcRegion]
611 ->GetExp(e)
612 ->GetTotPoints();
613 id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
614 m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt +
615 e));
616
617 Vmath::Vcopy(npts, &Fwd[id2], 1, &Bwd[id2], 1);
618 }
619
620 cnt += m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
621 }
622}
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetExpSize()
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References Nektar::SolverUtils::EquationSystem::GetExpSize(), Nektar::SolverUtils::EquationSystem::m_fields, and Vmath::Vcopy().

Referenced by UpdateBasefieldFwdBwd().

◆ DoOdeProjection()

void Nektar::AcousticSystem::DoOdeProjection ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
protected

Compute the projection and call the method for imposing the boundary conditions in case of discontinuous projection.

Definition at line 205 of file AcousticSystem.cpp.

208{
209 int nvariables = inarray.size();
210 int nq = m_fields[0]->GetNpoints();
211
212 // deep copy
213 if (inarray != outarray)
214 {
215 for (int i = 0; i < nvariables; ++i)
216 {
217 Vmath::Vcopy(nq, inarray[i], 1, outarray[i], 1);
218 }
219 }
220
222
223 SetBoundaryConditions(outarray, time);
224}
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
Apply the Boundary Conditions to the AcousticSystem equations.

References Nektar::SolverUtils::EquationSystem::m_fields, SetBoundaryConditions(), UpdateBasefieldFwdBwd(), and Vmath::Vcopy().

Referenced by Nektar::APE::v_InitObject(), and Nektar::LEE::v_InitObject().

◆ DoOdeRhs()

void Nektar::AcousticSystem::DoOdeRhs ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
protected

Compute the right-hand side.

Definition at line 176 of file AcousticSystem.cpp.

179{
180 int nVariables = inarray.size();
181 int nq = GetTotPoints();
182
183 // WeakDG does not use advVel, so we only provide a dummy array
184 Array<OneD, Array<OneD, NekDouble>> advVel(m_spacedim);
185 m_advection->Advect(nVariables, m_fields, advVel, inarray, outarray, time);
186
187 // Negate the LHS terms
188 for (int i = 0; i < nVariables; ++i)
189 {
190 Vmath::Neg(nq, outarray[i], 1);
191 }
192
193 v_AddLinTerm(inarray, outarray);
194
195 for (auto &x : m_forcing)
196 {
197 x->Apply(m_fields, inarray, outarray, m_time);
198 }
199}
SolverUtils::AdvectionSharedPtr m_advection
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
virtual void v_AddLinTerm(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)=0
int m_spacedim
Spatial dimension (>= expansion dim).
NekDouble m_time
Current time of simulation.
SOLVER_UTILS_EXPORT int GetTotPoints()
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.hpp:292

References Nektar::SolverUtils::EquationSystem::GetTotPoints(), m_advection, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, Nektar::SolverUtils::EquationSystem::m_spacedim, Nektar::SolverUtils::EquationSystem::m_time, Vmath::Neg(), and v_AddLinTerm().

Referenced by Nektar::APE::v_InitObject(), and Nektar::LEE::v_InitObject().

◆ GetBasefieldFwdBwd()

const Array< OneD, const Array< OneD, NekDouble > > & Nektar::AcousticSystem::GetBasefieldFwdBwd ( )
inlineprotected

Definition at line 127 of file AcousticSystem.h.

128 {
129 return m_bfFwdBwd;
130 }
Array< OneD, Array< OneD, NekDouble > > m_bfFwdBwd

References m_bfFwdBwd.

Referenced by SetBoundaryConditions(), Nektar::APE::v_InitObject(), and Nektar::LEE::v_InitObject().

◆ GetCFLEstimate()

NekDouble Nektar::AcousticSystem::GetCFLEstimate ( )
private

◆ GetNormals()

const Array< OneD, const Array< OneD, NekDouble > > & Nektar::AcousticSystem::GetNormals ( )
inlineprotected

Definition at line 117 of file AcousticSystem.h.

118 {
119 return m_traceNormals;
120 }
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.

References Nektar::SolverUtils::EquationSystem::m_traceNormals.

Referenced by Nektar::APE::v_InitObject(), and Nektar::LEE::v_InitObject().

◆ GetVecLocs()

const Array< OneD, const Array< OneD, NekDouble > > & Nektar::AcousticSystem::GetVecLocs ( )
inlineprotected

Definition at line 122 of file AcousticSystem.h.

123 {
124 return m_vecLocs;
125 }
Array< OneD, Array< OneD, NekDouble > > m_vecLocs

References m_vecLocs.

Referenced by Nektar::APE::v_InitObject(), and Nektar::LEE::v_InitObject().

◆ SetBoundaryConditions()

void Nektar::AcousticSystem::SetBoundaryConditions ( Array< OneD, Array< OneD, NekDouble > > &  physarray,
NekDouble  time 
)
private

Apply the Boundary Conditions to the AcousticSystem equations.

Definition at line 229 of file AcousticSystem.cpp.

231{
232 std::string varName;
233 int nvariables = m_fields.size();
234 int cnt = 0;
235 int nTracePts = GetTraceTotPoints();
236
237 // Extract trace for boundaries. Needs to be done on all processors to avoid
238 // deadlock.
239 Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
240 for (int i = 0; i < nvariables; ++i)
241 {
242 Fwd[i] = Array<OneD, NekDouble>(nTracePts);
243 m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
244 }
245 Array<OneD, Array<OneD, NekDouble>> bfFwd = GetBasefieldFwdBwd();
246
247 // loop over Boundary Regions
248 for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
249 {
250 std::string userDefStr =
251 m_fields[0]->GetBndConditions()[n]->GetUserDefined();
252
253 if (!userDefStr.empty())
254 {
255 // Wall Boundary Condition
256 if (boost::iequals(userDefStr, "Wall"))
257 {
258 WallBC(n, cnt, Fwd, inarray);
259 }
260 else if (boost::iequals(userDefStr, "WhiteNoise"))
261 {
262 WhiteNoiseBC(n, cnt, Fwd, bfFwd, inarray);
263 }
264 else if (boost::iequals(userDefStr, "RiemannInvariantBC"))
265 {
266 v_RiemannInvariantBC(n, cnt, Fwd, bfFwd, inarray);
267 }
268 else if (boost::iequals(userDefStr, "TimeDependent"))
269 {
270 for (int i = 0; i < nvariables; ++i)
271 {
272 varName = m_session->GetVariable(i);
273 m_fields[i]->EvaluateBoundaryConditions(time, varName);
274 }
275 }
276 else
277 {
278 std::string errmsg = "Unrecognised boundary condition: ";
279 errmsg += userDefStr;
280 ASSERTL0(false, errmsg.c_str());
281 }
282 }
283 else
284 {
285 for (int i = 0; i < nvariables; ++i)
286 {
287 varName = m_session->GetVariable(i);
288 m_fields[i]->EvaluateBoundaryConditions(time, varName);
289 }
290 }
291
292 cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
293 }
294}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
virtual void v_RiemannInvariantBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &BfFwd, Array< OneD, Array< OneD, NekDouble > > &physarray)=0
void WallBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary conditions for the AcousticSystem equations.
void WhiteNoiseBC(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &BfFwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary conditions for the AcousticSystem equations.
const Array< OneD, const Array< OneD, NekDouble > > & GetBasefieldFwdBwd()
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()

References ASSERTL0, GetBasefieldFwdBwd(), Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_session, v_RiemannInvariantBC(), WallBC(), and WhiteNoiseBC().

Referenced by DoOdeProjection().

◆ UpdateBasefieldFwdBwd()

void Nektar::AcousticSystem::UpdateBasefieldFwdBwd ( )
private

Definition at line 583 of file AcousticSystem.cpp.

584{
585 for (int i = 0; i < m_bfNames.size(); i++)
586 {
587 int j = m_bfNames.size() + i;
588 m_fields[0]->GetFwdBwdTracePhys(m_bf[i], m_bfFwdBwd[i], m_bfFwdBwd[j]);
590 }
591}
std::vector< std::string > m_bfNames
void CopyBoundaryTrace(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
Array< OneD, Array< OneD, NekDouble > > m_bf

References CopyBoundaryTrace(), m_bf, m_bfFwdBwd, m_bfNames, and Nektar::SolverUtils::EquationSystem::m_fields.

Referenced by DoOdeProjection().

◆ v_AddLinTerm()

virtual void Nektar::AcousticSystem::v_AddLinTerm ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
protectedpure virtual

Implemented in Nektar::APE, and Nektar::LEE.

Referenced by DoOdeRhs().

◆ v_ExtraFldOutput()

void Nektar::AcousticSystem::v_ExtraFldOutput ( std::vector< Array< OneD, NekDouble > > &  fieldcoeffs,
std::vector< std::string > &  variables 
)
overrideprotectedvirtual

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 556 of file AcousticSystem.cpp.

559{
560 for (int i = 0; i < m_bfNames.size(); i++)
561 {
562 variables.push_back(m_bfNames[i]);
563 Array<OneD, NekDouble> tmpC(GetNcoeffs());
564 m_fields[0]->FwdTrans(m_bf[i], tmpC);
565 fieldcoeffs.push_back(tmpC);
566 }
567
568 int f = 0;
569 for (auto &x : m_forcing)
570 {
571 for (int i = 0; i < x->GetForces().size(); ++i)
572 {
573 variables.push_back("F_" + std::to_string(f) + "_" +
574 m_session->GetVariable(i));
575 Array<OneD, NekDouble> tmpC(GetNcoeffs());
576 m_fields[0]->FwdTrans(x->GetForces()[i], tmpC);
577 fieldcoeffs.push_back(tmpC);
578 }
579 f++;
580 }
581}
SOLVER_UTILS_EXPORT int GetNcoeffs()

References Nektar::SolverUtils::EquationSystem::GetNcoeffs(), m_bf, m_bfNames, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, and Nektar::SolverUtils::EquationSystem::m_session.

◆ v_GetFluxVector()

virtual void Nektar::AcousticSystem::v_GetFluxVector ( const Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  flux 
)
protectedpure virtual

Implemented in Nektar::APE, and Nektar::LEE.

◆ v_GetMaxStdVelocity()

Array< OneD, NekDouble > Nektar::AcousticSystem::v_GetMaxStdVelocity ( const NekDouble  SpeedSoundFactor)
overrideprotectedvirtual

Compute the advection velocity in the standard space for each element of the expansion.

Returns
Standard velocity field.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Definition at line 464 of file AcousticSystem.cpp.

466{
467 int nElm = m_fields[0]->GetExpSize();
468
469 Array<OneD, NekDouble> stdV(nElm, 0.0);
470
471 Array<OneD, Array<OneD, NekDouble>> stdVelocity(m_spacedim);
472 Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
474
475 int cnt = 0;
476
477 for (int el = 0; el < nElm; ++el)
478 {
479 ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
480
481 // Possible bug: not multiply by jacobian??
482 const SpatialDomains::GeomFactorsSharedPtr metricInfo =
483 m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo();
484 const Array<TwoD, const NekDouble> &gmat =
485 m_fields[0]
486 ->GetExp(el)
487 ->GetGeom()
488 ->GetMetricInfo()
489 ->GetDerivFactors(ptsKeys);
490
491 int nq = m_fields[0]->GetExp(el)->GetTotPoints();
492
493 for (int i = 0; i < m_spacedim; ++i)
494 {
495 stdVelocity[i] = Array<OneD, NekDouble>(nq, 0.0);
496
497 velocity[i] = Array<OneD, NekDouble>(nq, 0.0);
498 for (int j = 0; j < nq; ++j)
499 {
500 // The total advection velocity is v+c, so we need to scale c by
501 // adding it before we do the transformation.
502 NekDouble c = sqrt(m_bf[0][cnt + j]);
503 velocity[i][j] = m_bf[i + 2][cnt + j] + c;
504 }
505 }
506
507 // scale the velocity components
508 if (metricInfo->GetGtype() == SpatialDomains::eDeformed)
509 {
510 // d xi/ dx = gmat = 1/J * d x/d xi
511 for (int i = 0; i < m_spacedim; ++i)
512 {
513 Vmath::Vmul(nq, gmat[i], 1, velocity[0], 1, stdVelocity[i], 1);
514 for (int j = 1; j < m_spacedim; ++j)
515 {
516 Vmath::Vvtvp(nq, gmat[m_spacedim * j + i], 1, velocity[j],
517 1, stdVelocity[i], 1, stdVelocity[i], 1);
518 }
519 }
520 }
521 else
522 {
523 for (int i = 0; i < m_spacedim; ++i)
524 {
525 Vmath::Smul(nq, gmat[i][0], velocity[0], 1, stdVelocity[i], 1);
526 for (int j = 1; j < m_spacedim; ++j)
527 {
528 Vmath::Svtvp(nq, gmat[m_spacedim * j + i][0], velocity[j],
529 1, stdVelocity[i], 1, stdVelocity[i], 1);
530 }
531 }
532 }
533
534 // compute the max absolute velocity of the element
535 for (int i = 0; i < nq; ++i)
536 {
537 NekDouble pntVelocity = 0.0;
538 for (int j = 0; j < m_spacedim; ++j)
539 {
540 pntVelocity += stdVelocity[j][i] * stdVelocity[j][i];
541 }
542 pntVelocity = sqrt(pntVelocity);
543
544 if (pntVelocity > stdV[el])
545 {
546 stdV[el] = pntVelocity;
547 }
548 }
549
550 cnt += nq;
551 }
552
553 return stdV;
554}
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:231
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:60
@ eDeformed
Geometry is curved or has non-constant factors.
double NekDouble
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.hpp:72
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
Definition: Vmath.hpp:396
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.hpp:366
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.hpp:100
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:285

References Nektar::SpatialDomains::eDeformed, m_bf, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_spacedim, Vmath::Smul(), tinysimd::sqrt(), Vmath::Svtvp(), Vmath::Vmul(), and Vmath::Vvtvp().

◆ v_InitObject()

void Nektar::AcousticSystem::v_InitObject ( bool  DeclareFields = true)
overrideprotectedvirtual

Initialization object for the AcousticSystem class.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Reimplemented in Nektar::APE, and Nektar::LEE.

Definition at line 65 of file AcousticSystem.cpp.

66{
67 AdvectionSystem::v_InitObject(DeclareFields);
68
71 "Only Projection=DisContinuous supported by the AcousticSystem class.");
72
73 m_bfNames.push_back("c0sq");
74 m_bfNames.push_back("rho0");
75 m_bfNames.push_back("u0");
76 m_bfNames.push_back("v0");
77 m_bfNames.push_back("w0");
78
79 // Resize the advection velocities vector to dimension of the problem
80 m_bfNames.resize(m_spacedim + 2);
81
83 m_fields, m_fields.size());
84
85 // Do not forwards transform initial condition
86 m_homoInitialFwd = false;
87
88 // Set up locations of velocity and base velocity vectors.
89 m_vecLocs = Array<OneD, Array<OneD, NekDouble>>(1);
90 m_vecLocs[0] = Array<OneD, NekDouble>(m_spacedim);
91 for (int i = 0; i < m_spacedim; ++i)
92 {
93 // u', v', w'
94 m_vecLocs[0][i] = m_iu + i;
95 }
96
97 if (m_session->DefinesElement("Nektar/Coupling"))
98 {
99 TiXmlElement *vCoupling = m_session->GetElement("Nektar/Coupling");
100
101 ASSERTL0(vCoupling->Attribute("TYPE"),
102 "Missing TYPE attribute in Coupling");
103 std::string vType = vCoupling->Attribute("TYPE");
104 ASSERTL0(!vType.empty(),
105 "TYPE attribute must be non-empty in Coupling");
106
107 m_coupling = GetCouplingFactory().CreateInstance(vType, m_fields[0]);
108 }
109
111 m_whiteNoiseBC_p = 0.0;
112}
SolverUtils::CouplingSharedPtr m_coupling
NekDouble m_whiteNoiseBC_lastUpdate
SOLVER_UTILS_EXPORT void v_InitObject(bool DeclareField=true) override
Initialisation object for EquationSystem.
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
Definition: Forcing.cpp:76
bool m_homoInitialFwd
Flag to determine if simulation should start in homogeneous forward transformed state.
CouplingFactory & GetCouplingFactory()
Declaration of the Coupling factory singleton.
Definition: Coupling.cpp:40

References ASSERTL0, Nektar::MultiRegions::eDiscontinuous, Nektar::SolverUtils::GetCouplingFactory(), Nektar::SolverUtils::Forcing::Load(), m_bfNames, m_coupling, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, Nektar::SolverUtils::UnsteadySystem::m_homoInitialFwd, m_iu, Nektar::SolverUtils::EquationSystem::m_projectionType, Nektar::SolverUtils::EquationSystem::m_session, Nektar::SolverUtils::EquationSystem::m_spacedim, m_vecLocs, m_whiteNoiseBC_lastUpdate, m_whiteNoiseBC_p, and Nektar::SolverUtils::AdvectionSystem::v_InitObject().

Referenced by Nektar::APE::v_InitObject(), and Nektar::LEE::v_InitObject().

◆ v_Output()

void Nektar::AcousticSystem::v_Output ( void  )
overrideprotectedvirtual

Write the field data to file. The file is named according to the session name with the extension .fld appended.

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 163 of file AcousticSystem.cpp.

164{
165 if (m_coupling)
166 {
167 m_coupling->Finalize();
168 }
169
171}
virtual SOLVER_UTILS_EXPORT void v_Output(void)

References m_coupling, and Nektar::SolverUtils::EquationSystem::v_Output().

◆ v_PreIntegrate()

bool Nektar::AcousticSystem::v_PreIntegrate ( int  step)
overrideprotectedvirtual

v_PreIntegrate

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 117 of file AcousticSystem.cpp.

118{
119 GetFunction("Baseflow", m_fields[0], true)
120 ->Evaluate(m_bfNames, m_bf, m_time);
121
122 if (m_coupling)
123 {
124 int numForceFields = 0;
125 for (auto &x : m_forcing)
126 {
127 numForceFields += x->GetForces().size();
128 }
129 std::vector<std::string> varNames;
130 Array<OneD, Array<OneD, NekDouble>> phys(
131 m_fields.size() + m_bfNames.size() + numForceFields);
132 for (int i = 0; i < m_fields.size(); ++i)
133 {
134 varNames.push_back(m_session->GetVariable(i));
135 phys[i] = m_fields[i]->UpdatePhys();
136 }
137 for (int i = 0; i < m_bfNames.size(); ++i)
138 {
139 varNames.push_back(m_bfNames[i]);
140 phys[m_fields.size() + i] = m_bf[i];
141 }
142
143 int f = 0;
144 for (auto &x : m_forcing)
145 {
146 for (int i = 0; i < x->GetForces().size(); ++i)
147 {
148 phys[m_fields.size() + m_bfNames.size() + f + i] =
149 x->GetForces()[i];
150 varNames.push_back("F_" + std::to_string(f) + "_" +
151 m_session->GetVariable(i));
152 }
153 f++;
154 }
155
156 m_coupling->Send(step, m_time, phys, varNames);
157 m_coupling->Receive(step, m_time, phys, varNames);
158 }
159
161}
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
Get a SessionFunction by name.
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate(int step)

References Nektar::SolverUtils::EquationSystem::GetFunction(), m_bf, m_bfNames, m_coupling, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, Nektar::SolverUtils::EquationSystem::m_session, Nektar::SolverUtils::EquationSystem::m_time, and Nektar::SolverUtils::UnsteadySystem::v_PreIntegrate().

◆ v_RiemannInvariantBC()

virtual void Nektar::AcousticSystem::v_RiemannInvariantBC ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble > > &  Fwd,
Array< OneD, Array< OneD, NekDouble > > &  BfFwd,
Array< OneD, Array< OneD, NekDouble > > &  physarray 
)
protectedpure virtual

Implemented in Nektar::APE, and Nektar::LEE.

Referenced by SetBoundaryConditions().

◆ WallBC()

void Nektar::AcousticSystem::WallBC ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble > > &  Fwd,
Array< OneD, Array< OneD, NekDouble > > &  physarray 
)
private

Wall boundary conditions for the AcousticSystem equations.

Definition at line 299 of file AcousticSystem.cpp.

302{
303 int nVariables = physarray.size();
304
305 const Array<OneD, const int> &traceBndMap = m_fields[0]->GetTraceBndMap();
306
307 // Adjust the physical values of the trace to take
308 // user defined boundaries into account
309 int id1, id2, nBCEdgePts;
310 int eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
311
312 for (int e = 0; e < eMax; ++e)
313 {
314 nBCEdgePts = m_fields[0]
315 ->GetBndCondExpansions()[bcRegion]
316 ->GetExp(e)
317 ->GetTotPoints();
318 id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e);
319 id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt + e]);
320
321 // For 2D/3D, define: v* = v - 2(v.n)n
322 Array<OneD, NekDouble> tmp(nBCEdgePts, 0.0);
323
324 // Calculate (v.n)
325 for (int i = 0; i < m_spacedim; ++i)
326 {
327 Vmath::Vvtvp(nBCEdgePts, &Fwd[m_iu + i][id2], 1,
328 &m_traceNormals[i][id2], 1, &tmp[0], 1, &tmp[0], 1);
329 }
330
331 // Calculate 2.0(v.n)
332 Vmath::Smul(nBCEdgePts, -2.0, &tmp[0], 1, &tmp[0], 1);
333
334 // Calculate v* = v - 2.0(v.n)n
335 for (int i = 0; i < m_spacedim; ++i)
336 {
337 Vmath::Vvtvp(nBCEdgePts, &tmp[0], 1, &m_traceNormals[i][id2], 1,
338 &Fwd[m_iu + i][id2], 1, &Fwd[m_iu + i][id2], 1);
339 }
340
341 // Copy boundary adjusted values into the boundary expansion
342 for (int i = 0; i < nVariables; ++i)
343 {
344 Vmath::Vcopy(nBCEdgePts, &Fwd[i][id2], 1,
345 &(m_fields[i]
346 ->GetBndCondExpansions()[bcRegion]
347 ->UpdatePhys())[id1],
348 1);
349 }
350 }
351}

References Nektar::SolverUtils::EquationSystem::m_fields, m_iu, Nektar::SolverUtils::EquationSystem::m_spacedim, Nektar::SolverUtils::EquationSystem::m_traceNormals, Vmath::Smul(), Vmath::Vcopy(), and Vmath::Vvtvp().

Referenced by SetBoundaryConditions().

◆ WhiteNoiseBC()

void Nektar::AcousticSystem::WhiteNoiseBC ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble > > &  Fwd,
Array< OneD, Array< OneD, NekDouble > > &  BfFwd,
Array< OneD, Array< OneD, NekDouble > > &  physarray 
)
private

Wall boundary conditions for the AcousticSystem equations.

Definition at line 356 of file AcousticSystem.cpp.

361{
362 int id1, id2, nBCEdgePts;
363 int nVariables = physarray.size();
364
365 const Array<OneD, const int> &traceBndMap = m_fields[0]->GetTraceBndMap();
366
367 if (m_rng.count(bcRegion) == 0)
368 {
369 m_rng[bcRegion] = boost::mt19937(bcRegion);
370 }
371
372 ASSERTL0(
373 m_fields[0]->GetBndConditions()[bcRegion]->GetBoundaryConditionType() ==
375 "WhiteNoise BCs must be Dirichlet type BCs");
376
377 LibUtilities::Equation cond =
378 std::static_pointer_cast<SpatialDomains::DirichletBoundaryCondition>(
379 m_fields[0]->GetBndConditions()[bcRegion])
380 ->m_dirichletCondition;
381 NekDouble sigma = cond.Evaluate();
382
384 "sigma must be greater than zero");
385
386 // random velocity perturbation
388 {
390
391 boost::normal_distribution<> dist(0, sigma);
392 m_whiteNoiseBC_p = dist(m_rng[bcRegion]);
393 }
394
395 int eMax = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
396 for (int e = 0; e < eMax; ++e)
397 {
398 nBCEdgePts = m_fields[0]
399 ->GetBndCondExpansions()[bcRegion]
400 ->GetExp(e)
401 ->GetTotPoints();
402 id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e);
403 id2 = m_fields[0]->GetTrace()->GetPhys_Offset(traceBndMap[cnt + e]);
404
405 Array<OneD, Array<OneD, NekDouble>> tmp(nVariables);
406 for (int i = 0; i < nVariables; ++i)
407 {
408 tmp[i] = Array<OneD, NekDouble>(nBCEdgePts, 0.0);
409 }
410
411 // pressure perturbation
412 Vmath::Fill(nBCEdgePts, m_whiteNoiseBC_p, &tmp[m_ip][0], 1);
413
414 if (m_conservative)
415 {
416 for (int i = 0; i < nBCEdgePts; ++i)
417 {
418 // density perturbation
419 tmp[m_irho][i] = m_whiteNoiseBC_p *
420 BfFwd[m_spacedim + 2][id2 + i] /
421 BfFwd[0][id2 + i];
422
423 // velocity perturbation
424 NekDouble ru = m_whiteNoiseBC_p / sqrt(BfFwd[0][id2 + i]);
425 for (int j = 0; j < m_spacedim; ++j)
426 {
427 tmp[m_iu + j][i] = -1.0 * ru * m_traceNormals[j][id2 + i];
428 }
429 }
430 }
431 else
432 {
433 for (int i = 0; i < nBCEdgePts; ++i)
434 {
435 // velocity perturbation
437 (sqrt(BfFwd[0][id2 + i]) * BfFwd[1][id2 + i]);
438
439 for (int j = 0; j < m_spacedim; ++j)
440 {
441 tmp[m_iu + j][i] = -1.0 * u * m_traceNormals[j][id2 + i];
442 }
443 }
444 }
445
446 // Copy boundary adjusted values into the boundary expansion
447 for (int i = 0; i < nVariables; ++i)
448 {
449 Vmath::Vcopy(nBCEdgePts, &tmp[i][0], 1,
450 &(m_fields[i]
451 ->GetBndCondExpansions()[bcRegion]
452 ->UpdatePhys())[id1],
453 1);
454 }
455 }
456}
std::map< int, boost::mt19937 > m_rng
static const NekDouble kNekZeroTol
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.hpp:54

References ASSERTL0, Nektar::SpatialDomains::eDirichlet, Nektar::LibUtilities::Equation::Evaluate(), Vmath::Fill(), Nektar::NekConstants::kNekZeroTol, m_conservative, Nektar::SolverUtils::EquationSystem::m_fields, m_ip, m_irho, m_iu, m_rng, Nektar::SolverUtils::EquationSystem::m_spacedim, Nektar::SolverUtils::EquationSystem::m_time, Nektar::SolverUtils::EquationSystem::m_traceNormals, m_whiteNoiseBC_lastUpdate, m_whiteNoiseBC_p, tinysimd::sqrt(), and Vmath::Vcopy().

Referenced by SetBoundaryConditions().

Friends And Related Function Documentation

◆ MemoryManager< AcousticSystem >

friend class MemoryManager< AcousticSystem >
friend

Definition at line 1 of file AcousticSystem.h.

Member Data Documentation

◆ m_advection

SolverUtils::AdvectionSharedPtr Nektar::AcousticSystem::m_advection
protected

Definition at line 70 of file AcousticSystem.h.

Referenced by DoOdeRhs(), Nektar::APE::v_InitObject(), and Nektar::LEE::v_InitObject().

◆ m_bf

Array<OneD, Array<OneD, NekDouble> > Nektar::AcousticSystem::m_bf
protected

◆ m_bfFwdBwd

Array<OneD, Array<OneD, NekDouble> > Nektar::AcousticSystem::m_bfFwdBwd
protected

◆ m_bfNames

std::vector<std::string> Nektar::AcousticSystem::m_bfNames
protected

◆ m_conservative

bool Nektar::AcousticSystem::m_conservative
protected

we are dealing with a conservative formualtion

Definition at line 68 of file AcousticSystem.h.

Referenced by Nektar::APE::APE(), Nektar::LEE::LEE(), and WhiteNoiseBC().

◆ m_coupling

SolverUtils::CouplingSharedPtr Nektar::AcousticSystem::m_coupling
protected

Definition at line 69 of file AcousticSystem.h.

Referenced by v_InitObject(), v_Output(), and v_PreIntegrate().

◆ m_forcing

std::vector<SolverUtils::ForcingSharedPtr> Nektar::AcousticSystem::m_forcing
protected

Definition at line 71 of file AcousticSystem.h.

Referenced by DoOdeRhs(), v_ExtraFldOutput(), v_InitObject(), and v_PreIntegrate().

◆ m_ip

int Nektar::AcousticSystem::m_ip
protected

◆ m_irho

int Nektar::AcousticSystem::m_irho
protected

◆ m_iu

int Nektar::AcousticSystem::m_iu
protected

◆ m_riemannSolver

SolverUtils::RiemannSolverSharedPtr Nektar::AcousticSystem::m_riemannSolver
protected

Definition at line 72 of file AcousticSystem.h.

Referenced by Nektar::APE::v_InitObject(), and Nektar::LEE::v_InitObject().

◆ m_rng

std::map<int, boost::mt19937> Nektar::AcousticSystem::m_rng
private

Definition at line 133 of file AcousticSystem.h.

Referenced by WhiteNoiseBC().

◆ m_vecLocs

Array<OneD, Array<OneD, NekDouble> > Nektar::AcousticSystem::m_vecLocs
protected

Definition at line 74 of file AcousticSystem.h.

Referenced by GetVecLocs(), and v_InitObject().

◆ m_whiteNoiseBC_lastUpdate

NekDouble Nektar::AcousticSystem::m_whiteNoiseBC_lastUpdate
private

Definition at line 134 of file AcousticSystem.h.

Referenced by v_InitObject(), and WhiteNoiseBC().

◆ m_whiteNoiseBC_p

NekDouble Nektar::AcousticSystem::m_whiteNoiseBC_p
private

Definition at line 135 of file AcousticSystem.h.

Referenced by v_InitObject(), and WhiteNoiseBC().