Commit 46c6ef68 authored by Spencer Sherwin's avatar Spencer Sherwin
Browse files

Updates to fix Time Dependent boundary conditions in Fourier code and add check in 1D and 3D fields

parent 0bfd2a2f
......@@ -1093,53 +1093,57 @@ namespace Nektar
for(i = 0; i < m_bndCondExpansions.num_elements(); ++i)
{
m_bndCondExpansions[i]->GetCoords(x0,x1,x2);
if(x2_in != NekConstants::kNekUnsetDouble && x3_in != NekConstants::kNekUnsetDouble)
if(time == 0.0 || m_bndConditions[i]->GetUserDefined() ==
SpatialDomains::eTimeDependent)
{
x1 = x2_in;
x2 = x3_in;
}
if(m_bndConditions[i]->GetBoundaryConditionType()
m_bndCondExpansions[i]->GetCoords(x0,x1,x2);
if(x2_in != NekConstants::kNekUnsetDouble && x3_in != NekConstants::kNekUnsetDouble)
{
x1 = x2_in;
x2 = x3_in;
}
if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eDirichlet)
{
m_bndCondExpansions[i]->SetCoeff(
(boost::static_pointer_cast<SpatialDomains
::DirichletBoundaryCondition>(m_bndConditions[i])
->m_dirichletCondition).Evaluate(x0,x1,x2,time));
}
else if((m_bndConditions[i]->GetBoundaryConditionType() == SpatialDomains::eJunction)||
(m_bndConditions[i]->GetBoundaryConditionType() == SpatialDomains::eBifurcation)||
(m_bndConditions[i]->GetBoundaryConditionType() == SpatialDomains::eMerging))
{
//Do not update this conditions as they will be by the domain-linking Riemann solvers
}
else if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eNeumann)
{
m_bndCondExpansions[i]->SetCoeff(
(boost::static_pointer_cast<SpatialDomains
::NeumannBoundaryCondition>(m_bndConditions[i])
->m_neumannCondition).Evaluate(x0,x1,x2,time));
}
else if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eRobin)
{
m_bndCondExpansions[i]->SetCoeff(
(boost::static_pointer_cast<SpatialDomains
::RobinBoundaryCondition>(m_bndConditions[i])
->m_robinFunction).Evaluate(x0,x1,x2,time));
m_bndCondExpansions[i]->SetPhys(
(boost::static_pointer_cast<SpatialDomains
::RobinBoundaryCondition>(m_bndConditions[i])
{
m_bndCondExpansions[i]->SetCoeff(
(boost::static_pointer_cast<SpatialDomains
::DirichletBoundaryCondition>(m_bndConditions[i])
->m_dirichletCondition).Evaluate(x0,x1,x2,time));
}
else if((m_bndConditions[i]->GetBoundaryConditionType() == SpatialDomains::eJunction)||
(m_bndConditions[i]->GetBoundaryConditionType() == SpatialDomains::eBifurcation)||
(m_bndConditions[i]->GetBoundaryConditionType() == SpatialDomains::eMerging))
{
//Do not update this conditions as they will be by the domain-linking Riemann solvers
}
else if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eNeumann)
{
m_bndCondExpansions[i]->SetCoeff(
(boost::static_pointer_cast<SpatialDomains
::NeumannBoundaryCondition>(m_bndConditions[i])
->m_neumannCondition).Evaluate(x0,x1,x2,time));
}
else if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eRobin)
{
m_bndCondExpansions[i]->SetCoeff(
(boost::static_pointer_cast<SpatialDomains
::RobinBoundaryCondition>(m_bndConditions[i])
->m_robinFunction).Evaluate(x0,x1,x2,time));
m_bndCondExpansions[i]->SetPhys(
(boost::static_pointer_cast<SpatialDomains
::RobinBoundaryCondition>(m_bndConditions[i])
->m_robinPrimitiveCoeff).Evaluate(x0,x1,x2,time));
}
else
{
ASSERTL0(false,"This type of BC not implemented yet");
}
else
{
ASSERTL0(false,"This type of BC not implemented yet");
}
}
}
}
......
......@@ -1547,6 +1547,10 @@ namespace Nektar
* should be evaluated.
* @param bndCondExpansions List of boundary conditions.
* @param bndConditions Information about the boundary conditions.
*
* This will only be undertaken for time dependent
* boundary conditions unless time == 0.0 which is the
* case when the method is called from the constructor.
*/
void DisContField2D::v_EvaluateBoundaryConditions(const NekDouble time,
const NekDouble x2_in,
......
......@@ -1357,64 +1357,68 @@ namespace Nektar
for(i = 0; i < nbnd; ++i)
{
locExpList = m_bndCondExpansions[i];
npoints = locExpList->GetNpoints();
Array<OneD,NekDouble> x0(npoints,0.0);
Array<OneD,NekDouble> x1(npoints,0.0);
Array<OneD,NekDouble> x2(npoints,0.0);
locExpList->GetCoords(x0,x1,x2);
if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eDirichlet)
if(time == 0.0 || m_bndConditions[i]->GetUserDefined() ==
SpatialDomains::eTimeDependent)
{
locExpList = m_bndCondExpansions[i];
npoints = locExpList->GetNpoints();
Array<OneD,NekDouble> x0(npoints,0.0);
Array<OneD,NekDouble> x1(npoints,0.0);
Array<OneD,NekDouble> x2(npoints,0.0);
locExpList->GetCoords(x0,x1,x2);
if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eDirichlet)
{
LibUtilities::Equation condition = boost::static_pointer_cast<
SpatialDomains::DirichletBoundaryCondition >(m_bndConditions[i])->m_dirichletCondition;
SpatialDomains::DirichletBoundaryCondition >(m_bndConditions[i])->m_dirichletCondition;
condition.Evaluate(x0,x1,x2,time,locExpList->UpdatePhys());
locExpList->FwdTrans_BndConstrained(locExpList->GetPhys(),
locExpList->UpdateCoeffs());
}
else if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eNeumann)
{
LibUtilities::Equation condition = boost::static_pointer_cast<
SpatialDomains::NeumannBoundaryCondition
>(m_bndConditions[i])->m_neumannCondition;
condition.Evaluate(x0,x1,x2,time,locExpList->UpdatePhys());
locExpList->IProductWRTBase(locExpList->GetPhys(),
locExpList->UpdateCoeffs());
}
else if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eNeumann)
{
LibUtilities::Equation condition = boost::static_pointer_cast<
SpatialDomains::NeumannBoundaryCondition
>(m_bndConditions[i])->m_neumannCondition;
condition.Evaluate(x0,x1,x2,time,locExpList->UpdatePhys());
locExpList->IProductWRTBase(locExpList->GetPhys(),
locExpList->UpdateCoeffs());
}
else if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eRobin)
{
LibUtilities::Equation condition = boost::static_pointer_cast<
SpatialDomains::RobinBoundaryCondition
>(m_bndConditions[i])->m_robinFunction;
LibUtilities::Equation coeff =
boost::static_pointer_cast<
SpatialDomains::RobinBoundaryCondition
>(m_bndConditions[i])->m_robinPrimitiveCoeff;
condition.Evaluate(x0,x1,x2,time,locExpList->UpdatePhys());
locExpList->IProductWRTBase(locExpList->GetPhys(),
locExpList->UpdateCoeffs());
// put primitive coefficient into the physical space
// storage
coeff.Evaluate(x0,x1,x2,time,
locExpList->UpdatePhys());
}
else
{
ASSERTL0(false,"This type of BC not implemented yet");
}
else if(m_bndConditions[i]->GetBoundaryConditionType()
== SpatialDomains::eRobin)
{
LibUtilities::Equation condition = boost::static_pointer_cast<
SpatialDomains::RobinBoundaryCondition
>(m_bndConditions[i])->m_robinFunction;
LibUtilities::Equation coeff =
boost::static_pointer_cast<
SpatialDomains::RobinBoundaryCondition
>(m_bndConditions[i])->m_robinPrimitiveCoeff;
condition.Evaluate(x0,x1,x2,time,locExpList->UpdatePhys());
locExpList->IProductWRTBase(locExpList->GetPhys(),
locExpList->UpdateCoeffs());
// put primitive coefficient into the physical space
// storage
coeff.Evaluate(x0,x1,x2,time,
locExpList->UpdatePhys());
}
else
{
ASSERTL0(false,"This type of BC not implemented yet");
}
}
}
}
......
......@@ -204,9 +204,16 @@ namespace Nektar
}
// Fourier transform coefficient space boundary values
// This will only be undertaken for time dependent
// boundary conditions unless time == 0.0 which is the
// case when the method is called from the constructor.
for(n = 0; n < m_bndCondExpansions.num_elements(); ++n)
{
m_bndCondExpansions[n]->HomogeneousFwdTrans(m_bndCondExpansions[n]->GetCoeffs(),m_bndCondExpansions[n]->UpdateCoeffs());
if(time == 0.0 || m_bndConditions[n]->GetUserDefined() ==
SpatialDomains::eTimeDependent)
{
m_bndCondExpansions[n]->HomogeneousFwdTrans(m_bndCondExpansions[n]->GetCoeffs(),m_bndCondExpansions[n]->UpdateCoeffs());
}
}
}
......
......@@ -179,22 +179,26 @@ namespace Nektar
{
int n,m;
const Array<OneD, const NekDouble> y = m_homogeneousBasis_y->GetZ();
const Array<OneD, const NekDouble> y = m_homogeneousBasis_y->GetZ();
const Array<OneD, const NekDouble> z = m_homogeneousBasis_z->GetZ();
for(n = 0; n < m_nz; ++n)
{
for(m = 0; m < m_ny; ++m)
{
m_lines[m+(n*m_ny)]->EvaluateBoundaryConditions(time,0.5*m_lhom_y*(1.0+y[m]),0.5*m_lhom_z*(1.0+z[n]));
}
for(m = 0; m < m_ny; ++m)
{
m_lines[m+(n*m_ny)]->EvaluateBoundaryConditions(time,0.5*m_lhom_y*(1.0+y[m]),0.5*m_lhom_z*(1.0+z[n]));
}
}
// Fourier transform coefficient space boundary values
for(n = 0; n < m_bndCondExpansions.num_elements(); ++n)
{
m_bndCondExpansions[n]->HomogeneousFwdTrans(m_bndCondExpansions[n]->GetCoeffs(),m_bndCondExpansions[n]->UpdateCoeffs());
if(time == 0.0 || m_bndConditions[n]->GetUserDefined() ==
SpatialDomains::eTimeDependent)
{
m_bndCondExpansions[n]->HomogeneousFwdTrans(m_bndCondExpansions[n]->GetCoeffs(),m_bndCondExpansions[n]->UpdateCoeffs());
}
}
}
......
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