Commit ed2b0f10 authored by Douglas Serson's avatar Douglas Serson

Move time dependent bc to new framework

parent 3563e71d
///////////////////////////////////////////////////////////////////////////////
//
// File: TimeDependentBC.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: Time dependent boundary condition
//
///////////////////////////////////////////////////////////////////////////////
#include "TimeDependentBC.h"
using namespace std;
namespace Nektar
{
std::string TimeDependentBC::className = GetCFSBndCondFactory().
RegisterCreatorFunction("TimeDependent",
TimeDependentBC::create,
"Time dependent boundary condition.");
TimeDependentBC::TimeDependentBC(const LibUtilities::SessionReaderSharedPtr& pSession,
const Array<OneD, MultiRegions::ExpListSharedPtr>& pFields,
const Array<OneD, Array<OneD, NekDouble> >& pTraceNormals,
const int pSpaceDim,
const int bcRegion)
: CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion)
{
}
void TimeDependentBC::v_Apply(
int bcRegion,
int cnt,
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &physarray,
const NekDouble &time)
{
int nvariables = physarray.num_elements();
std::string varName;
for (int i = 0; i < nvariables; ++i)
{
varName = m_session->GetVariable(i);
m_fields[i]->EvaluateBoundaryConditions(time, varName);
}
}
}
///////////////////////////////////////////////////////////////////////////////
//
// File: TimeDependentBC.h
//
// 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: Time dependent boundary condition
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_BNDCOND_TIMEDEPENDENTBC
#define NEKTAR_SOLVERS_COMPRESSIBLEFLOWSOLVER_BNDCOND_TIMEDEPENDENTBC
#include "CFSBndCond.h"
namespace Nektar
{
/**
* @brief Time dependent boundary condition
*/
class TimeDependentBC : public CFSBndCond
{
public:
friend class MemoryManager<TimeDependentBC>;
/// Creates an instance of this class
static CFSBndCondSharedPtr create(
const LibUtilities::SessionReaderSharedPtr& pSession,
const Array<OneD, MultiRegions::ExpListSharedPtr>& pFields,
const Array<OneD, Array<OneD, NekDouble> >& pTraceNormals,
const int pSpaceDim, const int bcRegion)
{
CFSBndCondSharedPtr p = MemoryManager<TimeDependentBC>::
AllocateSharedPtr(pSession, pFields,
pTraceNormals, pSpaceDim, bcRegion);
return p;
}
///Name of the class
static std::string className;
protected:
virtual void v_Apply(
int bcRegion,
int cnt,
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &physarray,
const NekDouble &time);
private:
TimeDependentBC(const LibUtilities::SessionReaderSharedPtr& pSession,
const Array<OneD, MultiRegions::ExpListSharedPtr>& pFields,
const Array<OneD, Array<OneD, NekDouble> >& pTraceNormals,
const int pSpaceDim,
const int bcRegion);
virtual ~TimeDependentBC(void){};
};
}
#endif
......@@ -12,6 +12,7 @@ IF( NEKTAR_SOLVER_COMPRESSIBLE_FLOW )
./BoundaryConditions/PressureOutflowNonReflectiveBC.cpp
./BoundaryConditions/RiemannInvariantBC.cpp
./BoundaryConditions/SymmetryBC.cpp
./BoundaryConditions/TimeDependentBC.cpp
./BoundaryConditions/WallBC.cpp
./BoundaryConditions/WallViscousBC.cpp
./CompressibleFlowSolver.cpp
......
......@@ -307,26 +307,12 @@ namespace Nektar
Array<OneD, Array<OneD, NekDouble> > &Fwd,
Array<OneD, Array<OneD, NekDouble> > &inarray)
{
std::string varName;
int nvariables = m_fields.num_elements();
if(!userDefStr.empty())
{
if(boost::iequals(userDefStr,"TimeDependent"))
{
for (int i = 0; i < nvariables; ++i)
{
varName = m_session->GetVariable(i);
m_fields[i]->EvaluateBoundaryConditions(time, varName);
}
}
else
{
CFSBndCondSharedPtr bndCond;
bndCond = GetCFSBndCondFactory().CreateInstance(userDefStr,
m_session, m_fields, m_traceNormals, m_spacedim, n);
bndCond->Apply(n, cnt, Fwd, inarray, time);
}
CFSBndCondSharedPtr bndCond;
bndCond = GetCFSBndCondFactory().CreateInstance(userDefStr,
m_session, m_fields, m_traceNormals, m_spacedim, n);
bndCond->Apply(n, cnt, Fwd, inarray, time);
}
}
......
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