Commit 034d6460 authored by Daniele de Grazia's avatar Daniele de Grazia
Browse files

Cleaning up.

parent dbe24481
......@@ -181,7 +181,7 @@ namespace Nektar
Array<OneD,MultiRegions::ExpListSharedPtr> m_bndCondExpansions;
Array<OneD, MultiRegions::ExpListSharedPtr> m_trace;
Array<OneD, MultiRegions::ExpListSharedPtr> m_trace;
/**
* \brief An array which contains the information about
......@@ -217,11 +217,13 @@ namespace Nektar
/// Set up all DG member variables and maps
MULTI_REGIONS_EXPORT void SetUpDG();
/// @todo Fix in another way considering all the planes
virtual ExpListSharedPtr &v_GetTrace()
{
return m_planes[0]->GetTrace();
}
/// @todo Fix in another way considering all the planes
virtual AssemblyMapDGSharedPtr &v_GetTraceMap()
{
return m_planes[0]->GetTraceMap();
......
......@@ -894,11 +894,6 @@ namespace Nektar
return v_GetPlane(n);
}
int GetNumPlanes()
{
return v_GetNumPlanes();
}
protected:
boost::shared_ptr<DNekMat> GenGlobalMatrixFull(
const GlobalLinSysKey &mkey,
......@@ -921,11 +916,6 @@ namespace Nektar
/// \f$=Q_{\mathrm{tot}}=\sum_{e=1}^{{N_{\mathrm{el}}}}N^{e}_Q\f$
int m_npoints;
virtual int v_GetNumPlanes()
{
return 1;
}
/**
* \brief Concatenation of all local expansion coefficients.
*
......
......@@ -69,6 +69,5 @@ namespace Nektar
{
v_FluxVec(fluxvector);
}
}
}
......@@ -103,13 +103,12 @@ namespace Nektar
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)=0;
virtual void v_FluxVec(
virtual void v_FluxVec(
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &fluxvector)
{
};
AdvectionFluxVecCB m_fluxVector;
RiemannSolverSharedPtr m_riemann;
};
......
......@@ -80,31 +80,8 @@ namespace Nektar
}
}
/*
for (j = 0; j < nPointsTot; ++j)
{
cout << "inarray" << " "<< j << " "<< inarray[1][j]<< " " << endl;
}
cin >> num;
*/
m_fluxVector(inarray, m_fluxvector);
/*
for (j = 0; j < nPointsTot; ++j)
{
cout << "fluxvector0" << " "<< j << " "<< m_fluxvector[0][1][j]<< " " << endl;
}
cin >> num;
for (j = 0; j < nPointsTot; ++j)
{
cout << "fluxvector1" << " "<< j << " "<< m_fluxvector[0][0][j]<< " " << endl;
}
*/
// Get the advection part (without numerical flux)
for(i = 0; i < nConvectiveFields; ++i)
{
......@@ -131,29 +108,8 @@ namespace Nektar
fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
}
/*
for (j = 0; j < nTracePointsTot; ++j)
{
cout << "Fwd" << " "<< j << " "<< Fwd[0][j]<< " " << endl;
}
cin >> num;
for (j = 0; j < nTracePointsTot; ++j)
{
cout << "Bwd" << " "<< j << " "<< Bwd[0][j]<< " " << endl;
}
cin >> num;
*/
m_riemann->Solve(Fwd, Bwd, numflux);
/*
for (j = 0; j < nTracePointsTot; ++j)
{
cout << "numflux" << " "<< j << " "<< numflux[0][j]<< " " << endl;
}
cin >> num;
*/
// Evaulate <\phi, \hat{F}\cdot n> - OutField[i]
for(i = 0; i < nConvectiveFields; ++i)
{
......@@ -163,14 +119,6 @@ namespace Nektar
fields[i]->BwdTrans (tmp[i], outarray[i]);
}
/*
for (j = 0; j < nPointsTot; ++j)
{
cout << "outarrayAdv" << " "<< j << " "<< outarray[spaceDim + 1][j]<< " " << endl;
}
cin >> num;
*/
}
}
}
}//end of namespace SolverUtils
}//end of namespace Nektar
......@@ -68,7 +68,6 @@ namespace Nektar
fluxvector = m_fluxvector;
};
Array<OneD, Array<OneD, NekDouble> > m_traceNormals;
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > m_fluxvector;
......
......@@ -122,13 +122,12 @@ namespace Nektar
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray)=0;
virtual void v_FluxVec(
virtual void v_FluxVec(
Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &fluxvector)
{
};
DiffusionFluxVecCB m_fluxVector;
DiffusionFluxVecCBNS m_fluxVectorNS;
RiemannSolverSharedPtr m_riemann;
......
......@@ -42,14 +42,27 @@ namespace Nektar
namespace SolverUtils
{
std::string DiffusionLDG3DHomogeneous1D ::type = GetDiffusionFactory().
RegisterCreatorFunction("LDG3DHomogeneous1D", DiffusionLDG3DHomogeneous1D ::create);
RegisterCreatorFunction(
"LDG3DHomogeneous1D", DiffusionLDG3DHomogeneous1D ::create);
/**
* @brief DiffusionLDG3DHomogeneous1D uses the 2D WeakDG approach
* to compute the diffusion term looping on the planes in the z
* direction and adding the flux in z direction at the end.
*/
DiffusionLDG3DHomogeneous1D ::DiffusionLDG3DHomogeneous1D ()
{
string diffName = "LDG";
m_planeDiff = GetDiffusionFactory().CreateInstance(diffName, diffName);
}
/**
* @brief Initiliase DiffusionLDG3DHomogeneous1D objects and store
* them before starting the time-stepping.
*
* @param pSession Pointer to session reader.
* @param pFields Pointer to fields.
*/
void DiffusionLDG3DHomogeneous1D ::v_InitObject(
LibUtilities::SessionReaderSharedPtr pSession,
Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
......@@ -67,6 +80,11 @@ namespace Nektar
m_planeDiff->InitObject(pSession, pFields_plane0);
}
/**
* @brief Calculate WeakDG Diffusion for the linear problems
* using an LDG interface flux and the the flux in the third direction.
*
*/
void DiffusionLDG3DHomogeneous1D ::v_Diffuse(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
......@@ -119,7 +137,6 @@ namespace Nektar
inarray_plane[i],
outarray_plane[i]);
for (j = 0; j < nConvectiveFields; j ++)
{
Vmath::Vcopy(nPointsTot_plane,
......@@ -128,23 +145,21 @@ namespace Nektar
}
}
Array<OneD, Array<OneD, NekDouble> >
fce(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> >
fce_homo(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> >
outarray_z(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > flux(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > flux_homo(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > outarray_z(nConvectiveFields);
NekDouble beta;
int Homolen = fields[0]->GetHomoLen();
// Transform forcing function in half-physical space
for (j = 0; j < nConvectiveFields; j++)
{
fce[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
fce_homo[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
flux[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
flux_homo[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
outarray_z[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
fields[0]->HomogeneousFwdTrans(inarray[j], fce[j]);
// Transform flux in Fourier space
fields[0]->HomogeneousFwdTrans(inarray[j], flux[j]);
}
m_transpositionLDG = fields[0]->GetTransposition();
......@@ -155,17 +170,18 @@ namespace Nektar
for (j = 0; j < nConvectiveFields; j++)
{
// Derivative in Fourier space
Vmath::Smul(nPointsTot_plane,
beta*beta ,
&fce[j][0] + i*nPointsTot_plane, 1,
&fce_homo[j][0] + i*nPointsTot_plane, 1);
&flux[j][0] + i*nPointsTot_plane, 1,
&flux_homo[j][0] + i*nPointsTot_plane, 1);
}
}
for (j = 0; j < nConvectiveFields; ++j)
{
fields[0]->HomogeneousBwdTrans(fce_homo[j], outarray_z[j]);
// Transform back in physical space
fields[0]->HomogeneousBwdTrans(flux_homo[j], outarray_z[j]);
Vmath::Vsub(nPointsTot,
outarray[j], 1,
......@@ -173,5 +189,5 @@ namespace Nektar
outarray[j], 1);
}
}
}
}
}// close namespace SolverUtils
}// close namespace nektar++
......@@ -602,6 +602,5 @@ namespace Nektar
}
}
}
}//end of namespace SolverUtils
}//end of namespace Nektar
......@@ -42,14 +42,32 @@ namespace Nektar
namespace SolverUtils
{
std::string DiffusionLDGNS3DHomogeneous1D ::type = GetDiffusionFactory().
RegisterCreatorFunction("LDGNS3DHomogeneous1D", DiffusionLDGNS3DHomogeneous1D ::create);
RegisterCreatorFunction("LDGNS3DHomogeneous1D",
DiffusionLDGNS3DHomogeneous1D ::create);
/**
* @brief DiffusionLDGNS3DHomogeneous1D uses the 2D WeakDG approach
* to compute the diffusion term looping on the planes in the z
* direction and adding the flux in z direction at the end.
*/
DiffusionLDGNS3DHomogeneous1D ::DiffusionLDGNS3DHomogeneous1D ()
{
string diffName = "LDGNS";
m_planeDiff = GetDiffusionFactory().CreateInstance(diffName, diffName);
m_planeDiff = GetDiffusionFactory().CreateInstance(
diffName, diffName);
}
/**
* @brief Initiliase DiffusionLDGNS3DHomogeneous1D objects and store them
* before starting the time-stepping.
*
* This routine calls the virtual functions #v_SetupMetrics,
* #v_SetupCFunctions and #v_SetupInterpolationMatrices to
* initialise the objects needed by DiffusionLFR.
*
* @param pSession Pointer to session reader.
* @param pFields Pointer to fields.
*/
void DiffusionLDGNS3DHomogeneous1D ::v_InitObject(
LibUtilities::SessionReaderSharedPtr pSession,
Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
......@@ -67,6 +85,13 @@ namespace Nektar
m_planeDiff->InitObject(pSession, pFields_plane0);
}
/**
* @brief Calculate WeakDG Diffusion for the Navier-Stokes (NS) equations
* using an LDG interface flux and the the flux in the third direction.
*
* The equations that need a diffusion operator are those related
* with the velocities and with the energy.
*/
void DiffusionLDGNS3DHomogeneous1D ::v_Diffuse(
const int nConvectiveFields,
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
......@@ -146,13 +171,11 @@ namespace Nektar
}
}
m_planeDiff->Diffuse(nConvectiveFields,
fields_plane[i],
inarray_plane[i],
outarray_plane[i]);
for (j = 0; j < nConvectiveFields; j ++)
{
Vmath::Vcopy(nPointsTot_plane,
......@@ -170,16 +193,23 @@ namespace Nektar
}
}
Array<OneD, Array<OneD, NekDouble> >
fce(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> >
fce_homo(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> >
outarray_z(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > flux(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > flux_homo(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > outarray_z(nConvectiveFields);
NekDouble beta;
int Homolen = fields[0]->GetHomoLen();
for (j = 0; j < nConvectiveFields; j++)
{
flux[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
flux_homo[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
outarray_z[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
// Transform flux in Fourier space
fields[0]->HomogeneousFwdTrans(fluxvector[j], flux[j]);
}
m_transpositionLDGNS = fields[0]->GetTransposition();
for (i = 0; i < num_planes; ++i)
......@@ -188,24 +218,18 @@ namespace Nektar
for (j = 0; j < nConvectiveFields; j++)
{
fce[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
fce_homo[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
outarray_z[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
// Transform forcing function in half-physical space
fields[0]->HomogeneousFwdTrans(fluxvector[j],
fce[j]);
// Derivative in Fourier space
Vmath::Smul(nPointsTot_plane,
beta*beta ,
&fce[j][0] + i*nPointsTot_plane, 1,
&fce_homo[j][0] + i*nPointsTot_plane, 1);
&flux[j][0] + i*nPointsTot_plane, 1,
&flux_homo[j][0] + i*nPointsTot_plane, 1);
}
}
for (j = 0; j < nConvectiveFields; ++j)
{
fields[0]->HomogeneousBwdTrans(fce_homo[j], outarray_z[j]);
// Transform back in physical space
fields[0]->HomogeneousBwdTrans(flux_homo[j], outarray_z[j]);
Vmath::Vsub(nPointsTot,
outarray[j], 1,
......@@ -213,5 +237,5 @@ namespace Nektar
outarray[j], 1);
}
}
}
}
}//end of namespace SolverUtils
}//end of namespace Nektar}
......@@ -78,14 +78,17 @@ namespace Nektar
"LFRcinf3DHomogeneous1D", DiffusionLFR3DHomogeneous1D::create)};
/**
* @brief DiffusionLFR uses the Flux Reconstruction (FR) approach to
* compute the diffusion term. The implementation is only for segments,
* quadrilaterals and hexahedra at the moment.
* @brief DiffusionLFR3DHomogeneous1D uses the 2D Flux Reconstruction (FR)
* approach to compute the diffusion term looping on the planes in the z
* direction and adding the flux in z direction at the end.
* The implementation is only for segments, quadrilaterals and hexahedra
* at the moment.
*
* \todo Extension to triangles, tetrahedra and other shapes.
* (Long term objective)
*/
DiffusionLFR3DHomogeneous1D::DiffusionLFR3DHomogeneous1D(std::string diffType):m_diffType(diffType)
DiffusionLFR3DHomogeneous1D::DiffusionLFR3DHomogeneous1D
(std::string diffType):m_diffType(diffType)
{
string diffName;
......@@ -114,8 +117,8 @@ namespace Nektar
}
/**
* @brief Initiliase DiffusionLFR objects and store them before starting
* the time-stepping.
* @brief Initiliase DiffusionLFRDiffusionLFR3DHomogeneous1D objects
* and store them before starting the time-stepping.
*
* This routine calls the virtual functions #v_SetupMetrics,
* #v_SetupCFunctions and #v_SetupInterpolationMatrices to
......@@ -143,7 +146,7 @@ namespace Nektar
/**
* @brief Calculate FR Diffusion for the linear problems
* using an LDG interface flux.
* using an LDG interface flux and the the flux in the third direction.
*
*/
void DiffusionLFR3DHomogeneous1D::v_Diffuse(
......@@ -193,13 +196,11 @@ namespace Nektar
&inarray_plane[i][j][0], 1);
}
m_planeDiff->Diffuse(nConvectiveFields,
fields_plane[i],
inarray_plane[i],
outarray_plane[i]);
for (j = 0; j < nConvectiveFields; j ++)
{
Vmath::Vcopy(nPointsTot_plane,
......@@ -208,23 +209,21 @@ namespace Nektar
}
}
Array<OneD, Array<OneD, NekDouble> >
fce(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> >
fce_homo(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> >
outarray_z(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > flux(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > flux_homo(nConvectiveFields);
Array<OneD, Array<OneD, NekDouble> > outarray_z(nConvectiveFields);
NekDouble beta;
int Homolen = fields[0]->GetHomoLen();
// Transform forcing function in half-physical space
for (j = 0; j < nConvectiveFields; j++)
{
fce[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
fce_homo[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
flux[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
flux_homo[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
outarray_z[j] = Array<OneD, NekDouble>(nPointsTot, 0.0);
fields[0]->HomogeneousFwdTrans(inarray[j], fce[j]);
// Transform flux in Fourier space
fields[0]->HomogeneousFwdTrans(inarray[j], flux[j]);
}
m_transpositionLDG = fields[0]->GetTransposition();
......@@ -235,17 +234,18 @@ namespace Nektar
for (j = 0; j < nConvectiveFields; j++)
{
// Derivative in Fourier space
Vmath::Smul(nPointsTot_plane,
beta*beta ,
&fce[j][0] + i*nPointsTot_plane, 1,
&fce_homo[j][0] + i*nPointsTot_plane, 1);
&flux[j][0] + i*nPointsTot_plane, 1,
&flux_homo[j][0] + i*nPointsTot_plane, 1);
}
}
for (j = 0; j < nConvectiveFields; ++j)
{
fields[0]->HomogeneousBwdTrans(fce_homo[j], outarray_z[j]);
// Transform back in physical space
fields[0]->HomogeneousBwdTrans(flux_homo[j], outarray_z[j]);
Vmath::Vsub(nPointsTot,
outarray[j], 1,
......@@ -253,5 +253,5 @@ namespace Nektar
outarray[j], 1);
}
}
}
}
}//end of namespace SolverUtils
}//end of namespace Nektar
......@@ -67,25 +67,28 @@ namespace Nektar
{
std::string DiffusionLFRNS3DHomogeneous1D::type[] = {
GetDiffusionFactory().RegisterCreatorFunction(
"LFRDGNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create),
"LFRDGNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create),
GetDiffusionFactory().RegisterCreatorFunction(
"LFRSDNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create),
"LFRSDNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create),
GetDiffusionFactory().RegisterCreatorFunction(
"LFRHUNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create),
"LFRHUNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create),
GetDiffusionFactory().RegisterCreatorFunction(
"LFRcminNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create),
"LFRcminNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create),
GetDiffusionFactory().RegisterCreatorFunction(
"LFRcinfNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create)};
"LFRcinfNS3DHomogeneous1D", DiffusionLFRNS3DHomogeneous1D::create)};
/**
* @brief DiffusionLFRNS uses the Flux Reconstruction (FR) approach to
* compute the diffusion term. The implementation is only for segments,
* @brief DiffusionLFRNS3DHomogeneous1D uses the 2D Flux Reconstruction (FR)
* approach to compute the diffusion term looping on the planes in the z
* direction and adding the flux in z direction at the end.
* The implementation is only for segments,
* quadrilaterals and hexahedra at the moment.
*
* \todo Extension to triangles, tetrahedra and other shapes.
* (Long term objective)
*/
DiffusionLFRNS3DHomogeneous1D::DiffusionLFRNS3DHomogeneous1D(std::string diffType):m_diffType(diffType)
DiffusionLFRNS3DHomogeneous1D::DiffusionLFRNS3DHomogeneous1D
(std::string diffType):m_diffType(diffType)
{
string diffName;
......@@ -114,8 +117,8 @@ namespace Nektar
}
/**
* @brief Initiliase DiffusionLFRNS objects and store them before starting
* the time-stepping.
* @brief Initiliase DiffusionLFRNS3DHomogeneous1D objects and store them
* before starting the time-stepping.
*
* This routine calls the virtual functions #v_SetupMetrics,
* #v_SetupCFunctions and #v_SetupInterpolationMatrices to
......@@ -142,9 +145,11 @@ namespace Nektar
}
/**
* @brief Calculate FR Diffusion for the linear problems
* using an LDG interface flux.
* @brief Calculate FR Diffusion for the Navier-Stokes (NS) equations
* using an LDG interface flux and the the flux in the third direction.