Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Nektar::ArtificialDiffusion Class Referenceabstract

Encapsulates the artificial diffusion used in shock capture. More...

#include <ArtificialDiffusion.h>

Inheritance diagram for Nektar::ArtificialDiffusion:
Inheritance graph
[legend]
Collaboration diagram for Nektar::ArtificialDiffusion:
Collaboration graph
[legend]

Public Member Functions

virtual ~ArtificialDiffusion ()
 
void DoArtificialDiffusion (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 Apply the artificial diffusion. More...
 
void GetArtificialViscosity (const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &mu)
 Calculate the artificial viscosity. More...
 

Protected Member Functions

 ArtificialDiffusion (const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int spacedim)
 Constructor. More...
 
virtual void v_DoArtificialDiffusion (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
virtual void v_GetArtificialViscosity (const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &mu)=0
 

Protected Attributes

LibUtilities::SessionReaderSharedPtr m_session
 Session reader. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_fields
 Array of fields. More...
 
VariableConverterSharedPtr m_varConv
 Auxiliary object to convert variables. More...
 
SolverUtils::DiffusionSharedPtr m_diffusion
 LDG Diffusion operator. More...
 
NekDouble m_FacL
 Parameters. More...
 
NekDouble m_FacH
 
NekDouble m_hFactor
 
NekDouble m_C1
 
NekDouble m_C2
 
NekDouble m_mu0
 
NekDouble m_Skappa
 
NekDouble m_Kappa
 

Detailed Description

Encapsulates the artificial diffusion used in shock capture.

Definition at line 69 of file ArtificialDiffusion.h.

Constructor & Destructor Documentation

virtual Nektar::ArtificialDiffusion::~ArtificialDiffusion ( )
inlinevirtual

Definition at line 72 of file ArtificialDiffusion.h.

72 {}
Nektar::ArtificialDiffusion::ArtificialDiffusion ( const LibUtilities::SessionReaderSharedPtr pSession,
const Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
const int  spacedim 
)
protected

Constructor.

Definition at line 52 of file ArtificialDiffusion.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), GetArtificialViscosity(), Nektar::SolverUtils::GetDiffusionFactory(), m_C1, m_C2, m_diffusion, m_FacH, m_FacL, m_fields, m_hFactor, m_Kappa, m_mu0, m_session, m_Skappa, and m_varConv.

56  : m_session(pSession),
57  m_fields(pFields)
58 {
59  m_session->LoadParameter ("FL", m_FacL, 0.0);
60  m_session->LoadParameter ("FH", m_FacH, 0.0);
61  m_session->LoadParameter ("hFactor", m_hFactor, 1.0);
62  m_session->LoadParameter ("C1", m_C1, 3.0);
63  m_session->LoadParameter ("C2", m_C2, 5.0);
64  m_session->LoadParameter ("mu0", m_mu0, 1.0);
65  m_session->LoadParameter ("Skappa", m_Skappa, -2.048);
66  m_session->LoadParameter ("Kappa", m_Kappa, 0.0);
67 
68  // Create auxiliary object to convert variables
70  m_session, spacedim);
71 
73  .CreateInstance("LDG", "LDG");
74  m_diffusion->SetArtificialDiffusionVector(
76  m_diffusion->InitObject (m_session, m_fields);
77 }
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
DiffusionFactory & GetDiffusionFactory()
Definition: Diffusion.cpp:42
SolverUtils::DiffusionSharedPtr m_diffusion
LDG Diffusion operator.
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
NekDouble m_FacL
Parameters.
void GetArtificialViscosity(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &mu)
Calculate the artificial viscosity.
VariableConverterSharedPtr m_varConv
Auxiliary object to convert variables.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.

Member Function Documentation

void Nektar::ArtificialDiffusion::DoArtificialDiffusion ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)

Apply the artificial diffusion.

Definition at line 82 of file ArtificialDiffusion.cpp.

References v_DoArtificialDiffusion().

85 {
86  v_DoArtificialDiffusion(inarray, outarray);
87 }
virtual void v_DoArtificialDiffusion(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
void Nektar::ArtificialDiffusion::GetArtificialViscosity ( const Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  mu 
)

Calculate the artificial viscosity.

Definition at line 121 of file ArtificialDiffusion.cpp.

References v_GetArtificialViscosity().

Referenced by ArtificialDiffusion().

124 {
125  v_GetArtificialViscosity(physfield, mu);
126 }
virtual void v_GetArtificialViscosity(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &mu)=0
void Nektar::ArtificialDiffusion::v_DoArtificialDiffusion ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
protectedvirtual

Reimplemented in Nektar::SmoothShockCapture.

Definition at line 92 of file ArtificialDiffusion.cpp.

References m_diffusion, m_fields, and Vmath::Vadd().

Referenced by DoArtificialDiffusion().

95 {
96  int i;
97  int nvariables = inarray.num_elements();
98  int npoints = m_fields[0]->GetNpoints();
99 
100  Array<OneD, Array<OneD, NekDouble> > outarrayDiff(nvariables);
101 
102  for (i = 0; i < nvariables; ++i)
103  {
104  outarrayDiff[i] = Array<OneD, NekDouble>(npoints, 0.0);
105  }
106 
107  m_diffusion->Diffuse(nvariables, m_fields, inarray, outarrayDiff);
108 
109  for (i = 0; i < nvariables; ++i)
110  {
111  Vmath::Vadd(npoints,
112  outarray[i], 1,
113  outarrayDiff[i], 1,
114  outarray[i], 1);
115  }
116 }
SolverUtils::DiffusionSharedPtr m_diffusion
LDG Diffusion operator.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:299
virtual void Nektar::ArtificialDiffusion::v_GetArtificialViscosity ( const Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  mu 
)
protectedpure virtual

Member Data Documentation

NekDouble Nektar::ArtificialDiffusion::m_C1
protected
NekDouble Nektar::ArtificialDiffusion::m_C2
protected
SolverUtils::DiffusionSharedPtr Nektar::ArtificialDiffusion::m_diffusion
protected
NekDouble Nektar::ArtificialDiffusion::m_FacH
protected
NekDouble Nektar::ArtificialDiffusion::m_FacL
protected
Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::ArtificialDiffusion::m_fields
protected
NekDouble Nektar::ArtificialDiffusion::m_hFactor
protected
NekDouble Nektar::ArtificialDiffusion::m_Kappa
protected
NekDouble Nektar::ArtificialDiffusion::m_mu0
protected
LibUtilities::SessionReaderSharedPtr Nektar::ArtificialDiffusion::m_session
protected

Session reader.

Definition at line 86 of file ArtificialDiffusion.h.

Referenced by ArtificialDiffusion().

NekDouble Nektar::ArtificialDiffusion::m_Skappa
protected
VariableConverterSharedPtr Nektar::ArtificialDiffusion::m_varConv
protected