Nektar++
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Nektar::MappingExtrapolate Class Reference

#include <MappingExtrapolate.h>

Inheritance diagram for Nektar::MappingExtrapolate:
[legend]

Static Public Member Functions

static ExtrapolateSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, MultiRegions::ExpListSharedPtr &pPressure, const Array< OneD, int > &pVel, const SolverUtils::AdvectionSharedPtr &advObject)
 Creates an instance of this class. More...
 
- Static Public Member Functions inherited from Nektar::StandardExtrapolate
static ExtrapolateSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, MultiRegions::ExpListSharedPtr &pPressure, const Array< OneD, int > &pVel, const SolverUtils::AdvectionSharedPtr &advObject)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of class. More...
 
- Static Public Attributes inherited from Nektar::StandardExtrapolate
static std::string className
 Name of class. More...
 

Protected Member Functions

 MappingExtrapolate (const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
 
 ~MappingExtrapolate () override=default
 
void v_CorrectPressureBCs (const Array< OneD, NekDouble > &pressure) override
 
void v_CalcNeumannPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis) override
 
- Protected Member Functions inherited from Nektar::StandardExtrapolate
 StandardExtrapolate (const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
 
 ~StandardExtrapolate () override=default
 
void v_EvaluatePressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis) override
 
void v_SubSteppingTimeIntegration (const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme) override
 
void v_SubStepSaveFields (int nstep) override
 
void v_SubStepSetPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_DT, NekDouble kinvis) override
 
void v_SubStepAdvance (int nstep, NekDouble time) override
 
void v_MountHOPBCs (int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection) override
 
void v_AccelerationBDF (Array< OneD, Array< OneD, NekDouble > > &array) override
 
- Protected Member Functions inherited from Nektar::Extrapolate
virtual void v_EvaluatePressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)=0
 
virtual void v_SubSteppingTimeIntegration (const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)=0
 
virtual void v_SubStepSaveFields (int nstep)=0
 
virtual void v_SubStepSetPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_DT, NekDouble kinvis)=0
 
virtual void v_SubStepAdvance (int nstep, NekDouble time)=0
 
virtual void v_MountHOPBCs (int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)=0
 
virtual std::string v_GetSubStepName (void)
 
virtual void v_AccelerationBDF (Array< OneD, Array< OneD, NekDouble > > &array)
 
virtual void v_CalcNeumannPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
 
virtual void v_CorrectPressureBCs (const Array< OneD, NekDouble > &pressure)
 
virtual void v_AddNormVelOnOBC (const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
 
void CalcOutflowBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
 
void RollOver (Array< OneD, Array< OneD, NekDouble > > &input)
 

Protected Attributes

GlobalMapping::MappingSharedPtr m_mapping
 
Array< OneD, NekDoublem_bcCorrection
 
bool m_implicitPressure
 
bool m_implicitViscous
 
NekDouble m_pressureRelaxation
 
- Protected Attributes inherited from Nektar::Extrapolate
LibUtilities::SessionReaderSharedPtr m_session
 
LibUtilities::CommSharedPtr m_comm
 
Array< OneD, HBCTypem_hbcType
 Array of type of high order BCs for splitting shemes. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Velocity fields. More...
 
MultiRegions::ExpListSharedPtr m_pressure
 Pointer to field holding pressure field. More...
 
Array< OneD, int > m_velocity
 int which identifies which components of m_fields contains the velocity (u,v,w); More...
 
SolverUtils::AdvectionSharedPtr m_advObject
 
std::vector< SolverUtils::ForcingSharedPtrm_forcing
 
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
 
int m_curl_dim
 Curl-curl dimensionality. More...
 
int m_bnd_dim
 bounday dimensionality More...
 
Array< OneD, const SpatialDomains::BoundaryConditionShPtrm_PBndConds
 pressure boundary conditions container More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_PBndExp
 pressure boundary conditions expansion container More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_bndElmtExps
 Boundary expansions on each domain boundary. More...
 
int m_pressureCalls
 number of times the high-order pressure BCs have been called More...
 
int m_numHBCDof
 
int m_HBCnumber
 
int m_intSteps
 Maximum points used in pressure BC evaluation. More...
 
NekDouble m_timestep
 
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
 Storage for current and previous levels of high order pressure boundary conditions. More...
 
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
 Storage for current and previous levels of the inner product of normal velocity. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 
HighOrderOutflowSharedPtr m_houtflow
 

Friends

class MemoryManager< MappingExtrapolate >
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::Extrapolate
 Extrapolate (const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
 
virtual ~Extrapolate ()=default
 
void SubSteppingTimeIntegration (const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
 
void SubStepSaveFields (const int nstep)
 
void SubStepSetPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, const NekDouble Aii_DT, NekDouble kinvis)
 
void SubStepAdvance (const int nstep, NekDouble time)
 
void MountHOPBCs (int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
 
void EvaluatePressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
 
void AddNormVelOnOBC (const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
 
void CorrectPressureBCs (const Array< OneD, NekDouble > &pressure)
 
void CalcNeumannPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
 
std::string GetSubStepName (void)
 
void SetForcing (const std::vector< SolverUtils::ForcingSharedPtr > &forcing)
 
void GenerateHOPBCMap (const LibUtilities::SessionReaderSharedPtr &pSsession)
 
void UpdateRobinPrimCoeff (void)
 
void AddDuDt (void)
 
void AddVelBC (void)
 
void ExtrapolatePressureHBCs (void)
 
void CopyPressureHBCsToPbndExp (void)
 
Array< OneD, NekDoubleGetMaxStdVelocity (const Array< OneD, Array< OneD, NekDouble > > inarray)
 
void IProductNormVelocityOnHBC (const Array< OneD, const Array< OneD, NekDouble > > &Vel, Array< OneD, NekDouble > &IprodVn)
 
void IProductNormVelocityBCOnHBC (Array< OneD, NekDouble > &IprodVn)
 
void ExtrapolateArray (Array< OneD, Array< OneD, NekDouble > > &array)
 
void EvaluateBDFArray (Array< OneD, Array< OneD, NekDouble > > &array)
 
void ExtrapolateArray (Array< OneD, Array< OneD, NekDouble > > &oldarrays, Array< OneD, NekDouble > &newarray, Array< OneD, NekDouble > &outarray)
 
void AddPressureToOutflowBCs (NekDouble kinvis)
 
void GenerateBndElmtExpansion (void)
 
- Static Protected Attributes inherited from Nektar::StandardExtrapolate
static NekDouble DuDt_Coeffs [3][4]
 
- Static Protected Attributes inherited from Nektar::Extrapolate
static NekDouble StifflyStable_Betaq_Coeffs [3][3]
 
static NekDouble StifflyStable_Alpha_Coeffs [3][3]
 
static NekDouble StifflyStable_Gamma0_Coeffs [3] = {1.0, 1.5, 11.0 / 6.0}
 

Detailed Description

Definition at line 51 of file MappingExtrapolate.h.

Constructor & Destructor Documentation

◆ MappingExtrapolate()

Nektar::MappingExtrapolate::MappingExtrapolate ( const LibUtilities::SessionReaderSharedPtr  pSession,
Array< OneD, MultiRegions::ExpListSharedPtr pFields,
MultiRegions::ExpListSharedPtr  pPressure,
const Array< OneD, int >  pVel,
const SolverUtils::AdvectionSharedPtr  advObject 
)
protected

Definition at line 46 of file MappingExtrapolate.cpp.

51 : StandardExtrapolate(pSession, pFields, pPressure, pVel, advObject)
52{
54
55 // Load solve parameters related to the mapping
56 // Flags determining if pressure/viscous terms should be treated implicitly
57 m_session->MatchSolverInfo("MappingImplicitPressure", "True",
58 m_implicitPressure, false);
59 m_session->MatchSolverInfo("MappingImplicitViscous", "True",
60 m_implicitViscous, false);
61
62 // Relaxation parameter for pressure system
63 m_session->LoadParameter("MappingPressureRelaxation", m_pressureRelaxation,
64 1.0);
65}
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:231
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:223
static GLOBAL_MAPPING_EXPORT MappingSharedPtr Load(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Return a pointer to the mapping, creating it on first call.
Definition: Mapping.cpp:264
GlobalMapping::MappingSharedPtr m_mapping
StandardExtrapolate(const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)

References Nektar::GlobalMapping::Mapping::Load(), Nektar::Extrapolate::m_fields, m_implicitPressure, m_implicitViscous, m_mapping, m_pressureRelaxation, and Nektar::Extrapolate::m_session.

◆ ~MappingExtrapolate()

Nektar::MappingExtrapolate::~MappingExtrapolate ( )
overrideprotecteddefault

Member Function Documentation

◆ create()

static ExtrapolateSharedPtr Nektar::MappingExtrapolate::create ( const LibUtilities::SessionReaderSharedPtr pSession,
Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
MultiRegions::ExpListSharedPtr pPressure,
const Array< OneD, int > &  pVel,
const SolverUtils::AdvectionSharedPtr advObject 
)
inlinestatic

Creates an instance of this class.

Definition at line 57 of file MappingExtrapolate.h.

62 {
65 pSession, pFields, pPressure, pVel, advObject);
66 return p;
67 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:60

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.

◆ v_CalcNeumannPressureBCs()

void Nektar::MappingExtrapolate::v_CalcNeumannPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  fields,
const Array< OneD, const Array< OneD, NekDouble > > &  N,
NekDouble  kinvis 
)
overrideprotectedvirtual

Unified routine for calculation high-oder terms

Reimplemented from Nektar::Extrapolate.

Definition at line 201 of file MappingExtrapolate.cpp.

204{
205 if (m_mapping->HasConstantJacobian() && !m_implicitViscous)
206 {
207 Extrapolate::v_CalcNeumannPressureBCs(fields, N, kinvis);
208 }
209 else
210 {
211 size_t physTot = m_fields[0]->GetTotPoints();
212 size_t nvel = m_fields.size() - 1;
213 size_t i, n, cnt;
214
215 Array<OneD, NekDouble> Pvals;
216 Array<OneD, NekDouble> Uvals;
217
218 Array<OneD, Array<OneD, NekDouble>> Velocity(m_bnd_dim);
219 Array<OneD, Array<OneD, NekDouble>> Advection(m_bnd_dim);
220 // Get transformation Jacobian
221 Array<OneD, NekDouble> Jac(physTot, 0.0);
222 m_mapping->GetJacobian(Jac);
223 // Declare variables
224 Array<OneD, Array<OneD, NekDouble>> BndValues(m_bnd_dim);
225 Array<OneD, Array<OneD, NekDouble>> Q(m_bnd_dim);
226 Array<OneD, Array<OneD, NekDouble>> Q_field(nvel);
227 Array<OneD, Array<OneD, NekDouble>> fields_new(nvel);
228 Array<OneD, Array<OneD, NekDouble>> N_new(m_bnd_dim);
229 // Temporary variables
230 Array<OneD, NekDouble> tmp(physTot, 0.0);
231 Array<OneD, NekDouble> tmp2(physTot, 0.0);
232 for (int i = 0; i < m_bnd_dim; i++)
233 {
234 N_new[i] = Array<OneD, NekDouble>(physTot, 0.0);
235 }
236 for (i = 0; i < nvel; i++)
237 {
238 Q_field[i] = Array<OneD, NekDouble>(physTot, 0.0);
239 fields_new[i] = Array<OneD, NekDouble>(physTot, 0.0);
240 }
241
242 // Multiply convective terms by Jacobian
243 for (int i = 0; i < m_bnd_dim; i++)
244 {
245 if (m_fields[0]->GetWaveSpace())
246 {
247 m_fields[0]->HomogeneousBwdTrans(physTot, N[i], N_new[i]);
248 }
249 else
250 {
251 Vmath::Vcopy(physTot, N[i], 1, N_new[i], 1);
252 }
253 Vmath::Vmul(physTot, Jac, 1, N_new[i], 1, N_new[i], 1);
254 if (m_fields[0]->GetWaveSpace())
255 {
256 m_fields[0]->HomogeneousFwdTrans(physTot, N_new[i], N_new[i]);
257 }
258 }
259
260 // Get velocity in physical space
261 for (i = 0; i < nvel; i++)
262 {
263 if (m_fields[0]->GetWaveSpace())
264 {
265 m_fields[0]->HomogeneousBwdTrans(physTot, fields[i],
266 fields_new[i]);
267 }
268 else
269 {
270 Vmath::Vcopy(physTot, fields[i], 1, fields_new[i], 1);
271 }
272 }
273
274 // Calculate appropriate form of the CurlCurl operator
275 m_mapping->CurlCurlField(fields_new, Q_field, m_implicitViscous);
276
277 // If viscous terms are treated explicitly,
278 // add grad(U/J \dot grad J) to CurlCurl
280 {
281 m_mapping->DotGradJacobian(fields_new, tmp);
282 Vmath::Vdiv(physTot, tmp, 1, Jac, 1, tmp, 1);
283
284 bool wavespace = m_fields[0]->GetWaveSpace();
285 m_fields[0]->SetWaveSpace(false);
286 for (int i = 0; i < m_bnd_dim; i++)
287 {
288 m_fields[0]->PhysDeriv(MultiRegions::DirCartesianMap[i], tmp,
289 tmp2);
290 Vmath::Vadd(physTot, Q_field[i], 1, tmp2, 1, Q_field[i], 1);
291 }
292 m_fields[0]->SetWaveSpace(wavespace);
293 }
294
295 // Multiply by Jacobian and convert to wavespace (if necessary)
296 for (int i = 0; i < m_bnd_dim; i++)
297 {
298 Vmath::Vmul(physTot, Jac, 1, fields_new[i], 1, fields_new[i], 1);
299 Vmath::Vmul(physTot, Jac, 1, Q_field[i], 1, Q_field[i], 1);
300 if (m_fields[0]->GetWaveSpace())
301 {
302 m_fields[0]->HomogeneousFwdTrans(physTot, fields_new[i],
303 fields_new[i]);
304 m_fields[0]->HomogeneousFwdTrans(physTot, Q_field[i],
305 Q_field[i]);
306 }
307 }
308
310 for (n = cnt = 0; n < m_PBndConds.size(); ++n)
311 {
312 // High order boundary condition;
313 if (boost::iequals(m_PBndConds[n]->GetUserDefined(), "H"))
314 {
315 m_fields[0]->GetBndElmtExpansion(n, BndElmtExp);
316 size_t nq = BndElmtExp->GetTotPoints();
317
318 // Obtaining fields on BndElmtExp
319 for (int i = 0; i < m_bnd_dim; i++)
320 {
321 m_fields[0]->ExtractPhysToBndElmt(n, fields_new[i],
322 Velocity[i]);
323 m_fields[0]->ExtractPhysToBndElmt(n, N_new[i],
324 Advection[i]);
325 m_fields[0]->ExtractPhysToBndElmt(n, Q_field[i], Q[i]);
326 }
327
328 // Mounting advection component into the high-order condition
329 for (int i = 0; i < m_bnd_dim; i++)
330 {
331 MountHOPBCs(nq, kinvis, Q[i], Advection[i]);
332 }
333
334 Pvals = (m_pressureHBCs[m_intSteps - 1]) + cnt;
335 Uvals = (m_iprodnormvel[m_intSteps]) + cnt;
336
337 // Getting values on the edge and filling the pressure boundary
338 // expansion and the acceleration term. Multiplication by the
339 // normal is required
340 for (int i = 0; i < m_bnd_dim; i++)
341 {
342 m_fields[0]->ExtractElmtToBndPhys(n, Q[i], BndValues[i]);
343 }
344 m_PBndExp[n]->NormVectorIProductWRTBase(BndValues, Pvals);
345
346 for (int i = 0; i < m_bnd_dim; i++)
347 {
348 m_fields[0]->ExtractElmtToBndPhys(n, Velocity[i],
349 BndValues[i]);
350 }
351 m_PBndExp[n]->NormVectorIProductWRTBase(BndValues, Uvals);
352
353 // Get offset for next terms
354 cnt += m_PBndExp[n]->GetNcoeffs();
355 }
356 }
357 }
358 // If pressure terms are treated implicitly, we need to multiply
359 // by the relaxation parameter, and zero the correction term
361 {
364 m_pressureHBCs[m_intSteps - 1], 1);
365 }
366 m_bcCorrection = Array<OneD, NekDouble>(m_numHBCDof, 0.0);
367}
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:277
int m_bnd_dim
bounday dimensionality
Definition: Extrapolate.h:250
virtual void v_CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
Storage for current and previous levels of the inner product of normal velocity.
Definition: Extrapolate.h:281
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:271
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:256
void MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
Definition: Extrapolate.h:107
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > m_PBndConds
pressure boundary conditions container
Definition: Extrapolate.h:253
Array< OneD, NekDouble > m_bcCorrection
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:87
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.hpp:72
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.hpp:180
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.hpp:100
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.hpp:126
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References Nektar::MultiRegions::DirCartesianMap, m_bcCorrection, Nektar::Extrapolate::m_bnd_dim, Nektar::Extrapolate::m_fields, m_implicitPressure, m_implicitViscous, Nektar::Extrapolate::m_intSteps, Nektar::Extrapolate::m_iprodnormvel, m_mapping, Nektar::Extrapolate::m_numHBCDof, Nektar::Extrapolate::m_PBndConds, Nektar::Extrapolate::m_PBndExp, Nektar::Extrapolate::m_pressureHBCs, m_pressureRelaxation, Nektar::Extrapolate::MountHOPBCs(), Vmath::Smul(), Nektar::Extrapolate::v_CalcNeumannPressureBCs(), Vmath::Vadd(), Vmath::Vcopy(), Vmath::Vdiv(), and Vmath::Vmul().

◆ v_CorrectPressureBCs()

void Nektar::MappingExtrapolate::v_CorrectPressureBCs ( const Array< OneD, NekDouble > &  pressure)
overrideprotectedvirtual

Reimplemented from Nektar::Extrapolate.

Definition at line 70 of file MappingExtrapolate.cpp.

72{
73 if (m_HBCnumber > 0)
74 {
75 size_t cnt, n;
76 size_t physTot = m_fields[0]->GetTotPoints();
77 size_t nvel = m_fields.size() - 1;
78
79 Array<OneD, NekDouble> Vals;
80 // Remove previous correction
81 for (cnt = n = 0; n < m_PBndConds.size(); ++n)
82 {
83 if (m_PBndConds[n]->GetUserDefined() == "H")
84 {
85 size_t nq = m_PBndExp[n]->GetNcoeffs();
86 Vmath::Vsub(nq, &(m_PBndExp[n]->GetCoeffs()[0]), 1,
87 &(m_bcCorrection[cnt]), 1,
88 &(m_PBndExp[n]->UpdateCoeffs()[0]), 1);
89 cnt += nq;
90 }
91 }
92
93 // Calculate new correction
94 Array<OneD, NekDouble> Jac(physTot, 0.0);
95 m_mapping->GetJacobian(Jac);
96
97 Array<OneD, Array<OneD, NekDouble>> correction(nvel);
98 Array<OneD, Array<OneD, NekDouble>> gradP(nvel);
99 Array<OneD, Array<OneD, NekDouble>> wk(nvel);
100 Array<OneD, Array<OneD, NekDouble>> wk2(nvel);
101 for (size_t i = 0; i < nvel; i++)
102 {
103 wk[i] = Array<OneD, NekDouble>(physTot, 0.0);
104 gradP[i] = Array<OneD, NekDouble>(physTot, 0.0);
105 correction[i] = Array<OneD, NekDouble>(physTot, 0.0);
106 }
107
108 // Calculate G(p)
109 for (size_t i = 0; i < nvel; ++i)
110 {
112 gradP[i]);
113 if (m_fields[0]->GetWaveSpace())
114 {
115 m_fields[0]->HomogeneousBwdTrans(physTot, gradP[i], wk[i]);
116 }
117 else
118 {
119 Vmath::Vcopy(physTot, gradP[i], 1, wk[i], 1);
120 }
121 }
122 m_mapping->RaiseIndex(wk, correction); // G(p)
123
124 // alpha*J*(G(p))
125 if (!m_mapping->HasConstantJacobian())
126 {
127 for (size_t i = 0; i < nvel; ++i)
128 {
129 Vmath::Vmul(physTot, correction[i], 1, Jac, 1, correction[i],
130 1);
131 }
132 }
133 for (size_t i = 0; i < nvel; ++i)
134 {
135 Vmath::Smul(physTot, m_pressureRelaxation, correction[i], 1,
136 correction[i], 1);
137 }
138
139 if (m_pressure->GetWaveSpace())
140 {
141 for (size_t i = 0; i < nvel; ++i)
142 {
143 m_pressure->HomogeneousFwdTrans(physTot, correction[i],
144 correction[i]);
145 }
146 }
147 // p_i - alpha*J*div(G(p))
148 for (size_t i = 0; i < nvel; ++i)
149 {
150 Vmath::Vsub(physTot, gradP[i], 1, correction[i], 1, correction[i],
151 1);
152 }
153
154 // Get value at boundary and calculate Inner product
155 Array<OneD, Array<OneD, NekDouble>> correctionElmt(m_bnd_dim);
156 Array<OneD, Array<OneD, NekDouble>> BndValues(m_bnd_dim);
158 for (n = cnt = 0; n < m_PBndConds.size(); ++n)
159 {
160 // High order boundary condition;
161 if (boost::iequals(m_PBndConds[n]->GetUserDefined(), "H"))
162 {
163 m_fields[0]->GetBndElmtExpansion(n, BndElmtExp);
164
165 // Obtaining fields on BndElmtExp
166 for (int i = 0; i < m_bnd_dim; i++)
167 {
168 m_fields[0]->ExtractPhysToBndElmt(n, correction[i],
169 correctionElmt[i]);
170 }
171
172 Vals = m_bcCorrection + cnt;
173 // Getting values on the edge and filling the correction
174 for (int i = 0; i < m_bnd_dim; i++)
175 {
176 m_fields[0]->ExtractElmtToBndPhys(n, correctionElmt[i],
177 BndValues[i]);
178 }
179 m_PBndExp[n]->NormVectorIProductWRTBase(BndValues, Vals);
180
181 // Get offset for next terms
182 cnt += m_PBndExp[n]->GetNcoeffs();
183 }
184 }
185
186 // Apply new correction
187 for (size_t cnt = n = 0; n < m_PBndConds.size(); ++n)
188 {
189 if (m_PBndConds[n]->GetUserDefined() == "H")
190 {
191 size_t nq = m_PBndExp[n]->GetNcoeffs();
192 Vmath::Vadd(nq, &(m_PBndExp[n]->GetCoeffs()[0]), 1,
193 &(m_bcCorrection[cnt]), 1,
194 &(m_PBndExp[n]->UpdateCoeffs()[0]), 1);
195 cnt += nq;
196 }
197 }
198 }
199}
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Definition: Extrapolate.h:234
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.hpp:220

References Nektar::MultiRegions::DirCartesianMap, m_bcCorrection, Nektar::Extrapolate::m_bnd_dim, Nektar::Extrapolate::m_fields, Nektar::Extrapolate::m_HBCnumber, m_mapping, Nektar::Extrapolate::m_PBndConds, Nektar::Extrapolate::m_PBndExp, Nektar::Extrapolate::m_pressure, m_pressureRelaxation, CG_Iterations::pressure, Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), Vmath::Vmul(), and Vmath::Vsub().

Friends And Related Function Documentation

◆ MemoryManager< MappingExtrapolate >

friend class MemoryManager< MappingExtrapolate >
friend

Definition at line 49 of file MappingExtrapolate.h.

Member Data Documentation

◆ className

std::string Nektar::MappingExtrapolate::className
static
Initial value:
=
"Mapping", MappingExtrapolate::create, "Mapping")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static ExtrapolateSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, MultiRegions::ExpListSharedPtr &pPressure, const Array< OneD, int > &pVel, const SolverUtils::AdvectionSharedPtr &advObject)
Creates an instance of this class.
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:47

Name of class.

Registers the class with the Factory.

Definition at line 70 of file MappingExtrapolate.h.

◆ m_bcCorrection

Array<OneD, NekDouble> Nektar::MappingExtrapolate::m_bcCorrection
protected

Definition at line 76 of file MappingExtrapolate.h.

Referenced by v_CalcNeumannPressureBCs(), and v_CorrectPressureBCs().

◆ m_implicitPressure

bool Nektar::MappingExtrapolate::m_implicitPressure
protected

Definition at line 80 of file MappingExtrapolate.h.

Referenced by MappingExtrapolate(), and v_CalcNeumannPressureBCs().

◆ m_implicitViscous

bool Nektar::MappingExtrapolate::m_implicitViscous
protected

Definition at line 81 of file MappingExtrapolate.h.

Referenced by MappingExtrapolate(), and v_CalcNeumannPressureBCs().

◆ m_mapping

GlobalMapping::MappingSharedPtr Nektar::MappingExtrapolate::m_mapping
protected

◆ m_pressureRelaxation

NekDouble Nektar::MappingExtrapolate::m_pressureRelaxation
protected