Nektar++
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TestRobin< TData > Class Template Reference

#include <TestRobin.hpp>

Inheritance diagram for TestRobin< TData >:
[legend]

Public Member Functions

 TestRobin ()=default
 
void SetTestCase ()
 
void RunTestCase ()
 
void ExpectedSolution ()
 
- Public Member Functions inherited from TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >
 TestOp ()=default
 
virtual ~TestOp ()
 
void Configure (void)
 
void Configure3DH1 (const unsigned int nhomo=1)
 
void Configure3DH2 (const unsigned int nhomoY=1, const unsigned int nhomoZ=1)
 
void SetSession (void)
 
void SetExpList (void)
 
void SetExpList3DH1 (const unsigned int nhomo=1)
 
void SetExpList3DH2 (const unsigned int nhomoY=1, const unsigned int nhomoZ=1)
 
virtual void SetFixture (const unsigned int nhomo)
 
virtual bool Compare (TData tol)
 Compare this field to another field, with absolute tolerance tol. The two must have the same blocks and components; their interleave widths may differ.
 

Additional Inherited Members

- Static Public Member Functions inherited from TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >
static void MixInterleaveWidths (TField &field)
 Put the blocks of field at alternating interleave widths, the execution space's vector width on even blocks and 1 on odd ones, reshaping the data in place: a field whose blocks differ in width, for an operator that must read any mix, such as the trace flux, which addresses each trace at the width of the element block it lies in. On Serial every width is 1 and nothing changes.
 
- Protected Attributes inherited from TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >
std::string meshName
 
Field< TData, stateIn > * fixt_in
 
Field< TData, stateOut > * fixt_out
 
Field< TData, stateIn > * fixt_out_2
 
Field< TData, stateOut > * fixt_expected
 
std::shared_ptr< MultiRegions::ExpList > fixt_explist
 
LibUtilities::SessionReaderSharedPtr session
 

Detailed Description

template<typename TData>
class TestRobin< TData >

Definition at line 44 of file TestRobin.hpp.

Constructor & Destructor Documentation

◆ TestRobin()

template<typename TData >
TestRobin< TData >::TestRobin ( )
default

Member Function Documentation

◆ ExpectedSolution()

template<typename TData >
void TestRobin< TData >::ExpectedSolution ( )
inline

Definition at line 76 of file TestRobin.hpp.

77 {
78 // Get variables
79 auto variables = this->fixt_explist->GetSession()->GetVariables();
80 unsigned int nvars = variables.size();
81
82 // Get number of components
83 unsigned int ncomp = this->fixt_in->GetNumComponents();
84 unsigned int ncoeffs = this->fixt_explist->GetNcoeffs();
85 Array<OneD, double> outcoeffs(ncomp * ncoeffs, 0.0);
86
87 ASSERTL0(nvars == ncomp,
88 "Number of components and number fields in "
89 "session file must be equal. Instead they are Ncomp = " +
90 std::to_string(ncomp) + " and Nfields = " +
91 std::to_string(nvars) + ", respectively.")
92
93 auto incoeffs = this->fixt_in->template ToArray<double>();
94
95 // Impose Robin BCs for each component
96 double time = 0.0;
97 Array<OneD, double> tmpIn;
98 Array<OneD, double> tmpOut;
99 for (unsigned int nc = 0; nc < ncomp; ++nc)
100 {
101 // Setup dedicated explist for each variable to evaluate correct BCs
102 MultiRegions::ContField bcfield(this->fixt_explist->GetSession(),
103 this->fixt_explist->GetGraph(),
104 variables[nc], true, false,
106
107 // Fill boundary expansions and impose
108 bcfield.EvaluateBoundaryConditions(time);
109 // TODO impose (local/elemental) robin mass matrix
110 bcfield.ImposeRobinConditions(tmpOut = outcoeffs + nc * ncoeffs);
111 }
112 this->fixt_expected->template CopyArray<NektarSpaces::HostSpace>(
113 outcoeffs);
114 }
#define ASSERTL0(condition, msg)
unsigned int GetNumComponents() const
Gets the number of components for a vector field.
This class is the abstraction of a global continuous two- dimensional spectral/hp element expansion w...
Definition ContField.h:60

References ASSERTL0, Nektar::Collections::eNoCollection, Nektar::MultiRegions::ExpList::EvaluateBoundaryConditions(), TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_expected, TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_explist, TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_in, Nektar::LibUtilities::Field< TData, TState >::GetNumComponents(), and Nektar::MultiRegions::ExpList::ImposeRobinConditions().

Referenced by TestRobin< TData >::SetTestCase().

◆ RunTestCase()

template<typename TData >
void TestRobin< TData >::RunTestCase ( )
inline

Definition at line 61 of file TestRobin.hpp.

62 {
63 std::string execStr = Operator<TData>::GetOpExecSpace(this->session);
64
65 if (execStr == "AVX")
66 {
68 NektarSpaces::GetVectorWidth<TData>(execStr));
69 }
70
72 this->session->GetVariables());
73 op->Apply(*this->fixt_in, *this->fixt_out);
74 }
void SetInterleaveWidth(const unsigned int &interleaveWidth)
static std::string GetOpExecSpace(std::shared_ptr< LibUtilities::SessionReader > session, const bool warn=true)
Return the execution space name ("opExecSpace") for an operator.
Definition Operator.hpp:190
static std::shared_ptr< RobBndCondOp< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="")

References Nektar::MultiRegions::RobBndCondOp< TData >::Create(), TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_explist, TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_in, TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_out, Nektar::MultiRegions::Operator< TData >::GetOpExecSpace(), TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::session, and Nektar::LibUtilities::Field< TData, TState >::SetInterleaveWidth().

◆ SetTestCase()

template<typename TData >
void TestRobin< TData >::SetTestCase ( )
inline

Definition at line 50 of file TestRobin.hpp.

51 {
52 // Set initial conditions.
53 this->fixt_in->template Initialize<NektarSpaces::HostSpace>(1.0);
54 this->fixt_out->template Initialize<NektarSpaces::HostSpace>(0.0);
55 this->fixt_expected->template Initialize<NektarSpaces::HostSpace>(0.0);
56
57 // Compute expected solution.
59 }
void ExpectedSolution()
Definition TestRobin.hpp:76

References TestRobin< TData >::ExpectedSolution(), TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_expected, TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_in, and TestOp< TData, FieldState::Coeff, FieldState::Coeff, MultiRegions::ContField >::fixt_out.