Commit 88080de7 authored by Chris Cantwell's avatar Chris Cantwell

Fixed minor formatting issues and put back Aliasing utility.

parent 91daf310
......@@ -78,7 +78,7 @@ namespace Nektar
const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
const Array<OneD, Array<OneD, NekDouble> > &advVel,
const Array<OneD, Array<OneD, NekDouble> > &inarray,
Array<OneD, Array<OneD, NekDouble> > &outarray,
Array<OneD, Array<OneD, NekDouble> > &outarray,
const NekDouble &time)
{
int nDim = fields[0]->GetCoordim(0);
......
/*
* AdvectionSystem.cpp
*
* Created on: 28 May 2014
* Author: cc
*/
///////////////////////////////////////////////////////////////////////////////
//
// File: AdvectionSystem.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Base class for advection-based equation systems.
//
///////////////////////////////////////////////////////////////////////////////
#include <SolverUtils/AdvectionSystem.h>
......
This diff is collapsed.
......@@ -297,7 +297,6 @@ void AdjointAdvection::v_Advect(
//Evaluation of the base flow for periodic cases
//(it requires fld files)
if(m_slices>1)
{
if (m_session->GetFunctionType("BaseFlow", 0)
......@@ -317,34 +316,34 @@ void AdjointAdvection::v_Advect(
//Evaluate the Adjoint advection term
switch(ndim)
{
// 1D
case 1:
fields[0]->PhysDeriv(inarray[n],grad0);
fields[0]->PhysDeriv(m_baseflow[0],grad_base_u0);
//Evaluate U du'/dx
Vmath::Vmul(nPointsTot,grad0,1,m_baseflow[0],1,outarray[n],1);
//Evaluate U du'/dx+ u' dU/dx
Vmath::Vvtvp(nPointsTot,grad_base_u0,1,advVel[0],1,outarray[n],1,outarray[n],1);
break;
//2D
case 2:
grad1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_u1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_v1 = Array<OneD, NekDouble> (nPointsTot);
fields[0]->PhysDeriv(inarray[n],grad0,grad1);
//Derivates of the base flow
fields[0]-> PhysDeriv(m_baseflow[0], grad_base_u0, grad_base_u1);
fields[0]-> PhysDeriv(m_baseflow[1], grad_base_v0, grad_base_v1);
//Since the components of the velocity are passed one by one, it is necessary to distinguish which
//term is consider
switch (n)
{
//x-equation
// 1D
case 1:
fields[0]->PhysDeriv(inarray[n],grad0);
fields[0]->PhysDeriv(m_baseflow[0],grad_base_u0);
//Evaluate U du'/dx
Vmath::Vmul(nPointsTot,grad0,1,m_baseflow[0],1,outarray[n],1);
//Evaluate U du'/dx+ u' dU/dx
Vmath::Vvtvp(nPointsTot,grad_base_u0,1,advVel[0],1,outarray[n],1,outarray[n],1);
break;
//2D
case 2:
grad1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_u1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_v1 = Array<OneD, NekDouble> (nPointsTot);
fields[0]->PhysDeriv(inarray[n],grad0,grad1);
//Derivates of the base flow
fields[0]-> PhysDeriv(m_baseflow[0], grad_base_u0, grad_base_u1);
fields[0]-> PhysDeriv(m_baseflow[1], grad_base_v0, grad_base_v1);
//Since the components of the velocity are passed one by one, it is necessary to distinguish which
//term is consider
switch (n)
{
//x-equation
case 0:
// Evaluate U du'/dx
Vmath::Vmul (nPointsTot,grad0,1,m_baseflow[0],1,outarray[n],1);
......@@ -358,7 +357,7 @@ void AdjointAdvection::v_Advect(
Vmath::Vvtvp(nPointsTot,grad_base_v0,1,advVel[1],1,outarray[n],1,outarray[n],1);
break;
//y-equation
//y-equation
case 1:
// Evaluate U dv'/dx
Vmath::Vmul (nPointsTot,grad0,1,m_baseflow[0],1,outarray[n],1);
......@@ -372,43 +371,43 @@ void AdjointAdvection::v_Advect(
Vmath::Vvtvp(nPointsTot,grad_base_v1,1,advVel[1],1,outarray[n],1,outarray[n],1);
break;
}
break;
break;
//3D
case 3:
//3D
case 3:
grad1 = Array<OneD, NekDouble> (nPointsTot);
grad2 = Array<OneD, NekDouble> (nPointsTot);
grad_base_u1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_v1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_w1 = Array<OneD, NekDouble> (nPointsTot);
grad1 = Array<OneD, NekDouble> (nPointsTot);
grad2 = Array<OneD, NekDouble> (nPointsTot);
grad_base_u1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_v1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_w1 = Array<OneD, NekDouble> (nPointsTot);
grad_base_u2 = Array<OneD, NekDouble> (nPointsTot);
grad_base_v2 = Array<OneD, NekDouble> (nPointsTot);
grad_base_w2 = Array<OneD, NekDouble> (nPointsTot);
grad_base_u2 = Array<OneD, NekDouble> (nPointsTot);
grad_base_v2 = Array<OneD, NekDouble> (nPointsTot);
grad_base_w2 = Array<OneD, NekDouble> (nPointsTot);
fields[0]->PhysDeriv(m_baseflow[0], grad_base_u0, grad_base_u1,grad_base_u2);
fields[0]->PhysDeriv(m_baseflow[1], grad_base_v0, grad_base_v1,grad_base_v2);
fields[0]->PhysDeriv(m_baseflow[2], grad_base_w0, grad_base_w1, grad_base_w2);
fields[0]->PhysDeriv(m_baseflow[0], grad_base_u0, grad_base_u1,grad_base_u2);
fields[0]->PhysDeriv(m_baseflow[1], grad_base_v0, grad_base_v1,grad_base_v2);
fields[0]->PhysDeriv(m_baseflow[2], grad_base_w0, grad_base_w1, grad_base_w2);
//HalfMode has W(x,y,t)=0
if(m_HalfMode || m_SingleMode)
//HalfMode has W(x,y,t)=0
if(m_HalfMode || m_SingleMode)
{
for(int i=0; i<grad_base_u2.num_elements();++i)
{
for(int i=0; i<grad_base_u2.num_elements();++i)
{
grad_base_u2[i]=0;
grad_base_v2[i]=0;
grad_base_w2[i]=0;
grad_base_u2[i]=0;
grad_base_v2[i]=0;
grad_base_w2[i]=0;
}
}
}
fields[0]->PhysDeriv(inarray[n], grad0, grad1, grad2);
switch (n)
{
//x-equation
//x-equation
case 0:
//Evaluate U du'/dx
Vmath::Vmul (nPointsTot,grad0,1,m_baseflow[0],1,outarray[n],1);
......@@ -425,7 +424,7 @@ void AdjointAdvection::v_Advect(
//Evaluate -(U du'/dx+ V du'/dy+W du'/dz)+u'dU/dx+ v' dV/dx+ w' dW/dz
Vmath::Vvtvp(nPointsTot,grad_base_w0,1,advVel[2],1,outarray[n],1,outarray[n],1);
break;
//y-equation
//y-equation
case 1:
//Evaluate U dv'/dx
Vmath::Vmul (nPointsTot,grad0,1,m_baseflow[0],1,outarray[n],1);
......@@ -443,7 +442,7 @@ void AdjointAdvection::v_Advect(
Vmath::Vvtvp(nPointsTot,grad_base_w1,1,advVel[2],1,outarray[n],1,outarray[n],1);
break;
//z-equation
//z-equation
case 2:
//Evaluate U dw'/dx
Vmath::Vmul (nPointsTot,grad0,1,m_baseflow[0],1,outarray[n],1);
......@@ -461,11 +460,9 @@ void AdjointAdvection::v_Advect(
Vmath::Vvtvp(nPointsTot,grad_base_w2,1,advVel[2],1,outarray[n],1,outarray[n],1);
break;
}
break;
default:
ASSERTL0(false,"dimension unknown");
break;
default:
ASSERTL0(false,"dimension unknown");
}
Vmath::Neg(nqtot,outarray[n],1);
......
......@@ -57,6 +57,11 @@ public:
static std::string className;
static std::string className2;
void SetSpecHPDealiasing(bool value)
{
m_specHP_dealiasing = value;
}
protected:
NavierStokesAdvection();
......
......@@ -36,7 +36,6 @@
#ifndef NEKTAR_SOLVERS_NOADVECTION_H
#define NEKTAR_SOLVERS_NOADVECTION_H
///#include <IncNavierStokesSolver/AdvectionTerms/AdvectionTerm.h>
#include <SolverUtils/Advection/Advection.h>
namespace Nektar
......
......@@ -357,8 +357,8 @@ namespace Nektar
Deriv = Array<OneD, NekDouble> (nqtot*VelDim);
}
m_advObject->Advect(m_nConvectiveFields,m_fields,
velocity,inarray,outarray,m_time);
m_advObject->Advect(m_nConvectiveFields, m_fields,
velocity, inarray, outarray, m_time);
}
/**
......
......@@ -119,12 +119,6 @@ namespace Nektar
Array<OneD, Array<OneD, NekDouble> > &physfield,
Array<OneD, Array<OneD, NekDouble> > &numflux);
// AdvectionTermSharedPtr GetAdvObject(void)
// {
// return m_advObject;
// }
int GetNConvectiveFields(void)
{
return m_nConvectiveFields;
......
......@@ -42,7 +42,6 @@
#include <MultiRegions/ExpList.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/TimeIntegration/TimeIntegrationWrapper.h>
///#include <IncNavierStokesSolver/AdvectionTerms/AdvectionTerm.h>
#include <SolverUtils/AdvectionSystem.h>
#include <IncNavierStokesSolver/EquationSystems/Extrapolate.h>
......
......@@ -42,7 +42,6 @@
#include <MultiRegions/ExpList.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/TimeIntegration/TimeIntegrationWrapper.h>
///#include <IncNavierStokesSolver/AdvectionTerms/AdvectionTerm.h>
#include <SolverUtils/AdvectionSystem.h>
#include <IncNavierStokesSolver/EquationSystems/Extrapolate.h>
......
......@@ -5,6 +5,7 @@
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <IncNavierStokesSolver/EquationSystems/IncNavierStokes.h>
#include <IncNavierStokesSolver/AdvectionTerms/NavierStokesAdvection.h>
using namespace Nektar;
using namespace Nektar::SolverUtils;
......@@ -53,17 +54,26 @@ int main(int argc, char *argv[])
NonLinearDealiased[i] = Array<OneD, NekDouble> (nphys);
}
boost::shared_ptr<NavierStokesAdvection> A
= boost::dynamic_pointer_cast<NavierStokesAdvection>(IncNav->GetAdvObject());
if (!A)
{
cout << "Must use non-linear Navier-Stokes advection" << endl;
exit(-1);
}
// calculate non-linear terms without dealiasing
IncNav->GetAdvObject()->SetSpecHPDealiasing(false);
IncNav->GetAdvObject()->DoAdvection(fields,nConvectiveFields,
IncNav->GetVelocity(), VelFields,
A->SetSpecHPDealiasing(false);
A->Advect(nConvectiveFields, fields,
VelFields, VelFields,
NonLinear, 0.0);
// calculate non-linear terms with dealiasing
IncNav->GetAdvObject()->SetSpecHPDealiasing(true);
IncNav->GetAdvObject()->DoAdvection(fields,nConvectiveFields,
IncNav->GetVelocity(), VelFields,
A->SetSpecHPDealiasing(true);
A->Advect(nConvectiveFields, fields,
VelFields, VelFields,
NonLinearDealiased, 0.0);
// Evaulate Difference and put into fields;
......
......@@ -6,10 +6,10 @@ SET(CFLStepSources CFLStep.cpp
../EquationSystems/Extrapolate.cpp
../EquationSystems/StandardExtrapolate.cpp
../EquationSystems/SubSteppingExtrapolate.cpp
#../AdvectionTerms/AdjointAdvection.cpp
#../AdvectionTerms/LinearisedAdvection.cpp
../AdvectionTerms/AdjointAdvection.cpp
../AdvectionTerms/LinearisedAdvection.cpp
../AdvectionTerms/NavierStokesAdvection.cpp
#../AdvectionTerms/SkewSymmetricAdvection.cpp
../AdvectionTerms/SkewSymmetricAdvection.cpp
../AdvectionTerms/NoAdvection.cpp
)
......@@ -23,12 +23,12 @@ SET(AliasingSources Aliasing.cpp
../EquationSystems/Extrapolate.cpp
../EquationSystems/StandardExtrapolate.cpp
../EquationSystems/SubSteppingExtrapolate.cpp
#../AdvectionTerms/AdjointAdvection.cpp
#../AdvectionTerms/LinearisedAdvection.cpp
../AdvectionTerms/AdjointAdvection.cpp
../AdvectionTerms/LinearisedAdvection.cpp
../AdvectionTerms/NavierStokesAdvection.cpp
#../AdvectionTerms/SkewSymmetricAdvection.cpp
../AdvectionTerms/SkewSymmetricAdvection.cpp
../AdvectionTerms/NoAdvection.cpp
)
#ADD_SOLVER_EXECUTABLE(Aliasing solvers ${AliasingSources})
ADD_SOLVER_EXECUTABLE(Aliasing solvers ${AliasingSources})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment