Nektar++
FileSolution.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File FileSolution.cpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: load discrete check-point files and interpolate them into a
32// continuous field
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#include <algorithm>
37#include <fstream>
38#include <iomanip>
39#include <iostream>
40#include <sstream>
41
42#include <boost/algorithm/string.hpp>
43#include <boost/format.hpp>
44
45#include <tinyxml.h>
46
52
56
61
62using namespace std;
63
64namespace Nektar::SolverUtils
65{
66/**
67 * Constructor. Creates ...
68 *
69 * \param
70 * \param
71 */
74 "FileSolution", FileSolution::create,
75 "review a solution from check point files.");
76
79 : UnsteadySystem(pSession, pGraph), AdvectionSystem(pSession, pGraph)
80{
82}
83
84/**
85 * @brief Initialisation object for the unsteady linear advection equation.
86 */
87void FileSolution::v_InitObject(bool DeclareField)
88{
89 // Call to the initialisation object of UnsteadySystem
91
92 // If explicit it computes RHS and PROJECTION for the time integration
96
97 // load solution
98 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
99 {
100 if (m_session->GetFunctionType("Solution", m_session->GetVariable(i)) ==
102 {
103 m_variableFile.insert(m_session->GetVariable(i));
104 }
105 else if (m_session->GetFunctionType("Solution",
106 m_session->GetVariable(i)) ==
108 {
109 m_solutionFunction[m_session->GetVariable(i)] =
110 m_session->GetFunction("Solution", m_session->GetVariable(i));
111 }
112 else
113 {
114 ASSERTL0(false, "solution not defined for variable " +
115 m_session->GetVariable(i));
116 }
117 }
118
119 if (m_variableFile.size())
120 {
121 std::map<std::string, int> series; // start, skip, slices, order
122 int tmp;
123 if (m_session->DefinesParameter("N_slices"))
124 {
125 m_session->LoadParameter("N_slices", tmp, 1);
126 series["slices"] = tmp;
127 }
128 if (m_session->DefinesParameter("N_start"))
129 {
130 m_session->LoadParameter("N_start", tmp, 0);
131 series["start"] = tmp;
132 }
133 if (m_session->DefinesParameter("N_skip"))
134 {
135 m_session->LoadParameter("N_skip", tmp, 1);
136 series["skip"] = tmp;
137 }
138 if (m_session->DefinesParameter("BaseFlow_interporder"))
139 {
140 m_session->LoadParameter("BaseFlow_interporder", tmp, 1);
141 series["order"] = tmp;
142 }
143 if (m_session->DefinesParameter("Is_periodic"))
144 {
145 m_session->LoadParameter("Is_periodic", tmp, 1);
146 series["isperiodic"] = tmp;
147 }
148
149 std::map<std::string, NekDouble> times;
150 NekDouble dtmp;
151 if (m_session->DefinesParameter("time_start"))
152 {
153 m_session->LoadParameter("time_start", dtmp, 0.);
154 times["start"] = dtmp;
155 }
156 if (m_session->DefinesParameter("period"))
157 {
158 m_session->LoadParameter("period", dtmp, 1.);
159 times["period"] = dtmp;
160 }
161 m_solutionFile->InitObject("Solution", m_session, m_fields,
162 m_variableFile, series, times);
163 }
164
165 if (m_solutionFunction.size())
166 {
168 int nq = m_fields[0]->GetNpoints();
172 m_fields[0]->GetCoords(m_coord[0], m_coord[1], m_coord[2]);
173 }
174}
175
176/**
177 * @brief Unsteady linear advection equation destructor.
178 */
180{
181}
182
184 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &inarray,
185 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &outarray,
186 [[maybe_unused]] NekDouble time, [[maybe_unused]] NekDouble lambda)
187{
188}
189
190/**
191 * @brief Compute the right-hand side for the linear advection equation.
192 *
193 * @param inarray Given fields.
194 * @param outarray Calculated solution.
195 * @param time Time.
196 */
198 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &inarray,
200 [[maybe_unused]] const NekDouble time)
201{
202 int nSolutionPts = GetNpoints();
203 for (size_t i = 0; i < outarray.size(); ++i)
204 {
205 Vmath::Zero(nSolutionPts, outarray[i], 1);
206 }
207}
208
209/**
210 * @brief Compute the projection for the linear advection equation.
211 *
212 * @param inarray Given fields.
213 * @param outarray Calculated solution.
214 * @param time Time.
215 */
217 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &inarray,
218 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &outarray,
219 [[maybe_unused]] const NekDouble time)
220{
221}
222
223bool FileSolution::v_PostIntegrate([[maybe_unused]] int step)
224{
226 return false;
227}
228
229void FileSolution::v_DoInitialise(bool dumpInitialConditions)
230{
231 m_time = m_solutionFile->GetStartTime();
234 if (dumpInitialConditions && m_checksteps && m_nchk == 0)
235 {
237 }
238 ++m_nchk;
239}
240
242{
243 for (int i = 0; i < m_fields.size(); ++i)
244 {
245 std::string var = m_session->GetVariable(i);
246 if (m_solutionFunction.count(var))
247 {
248 m_solutionFunction[var]->Evaluate(m_coord[0], m_coord[1],
249 m_coord[2], time,
250 m_fields[i]->UpdatePhys());
251 m_fields[i]->SetPhysState(true);
252 bool wavespace = m_fields[i]->GetWaveSpace();
253 m_fields[i]->SetWaveSpace(false);
254 m_fields[i]->FwdTransBndConstrained(m_fields[i]->GetPhys(),
255 m_fields[i]->UpdateCoeffs());
256 m_fields[i]->SetWaveSpace(wavespace);
257 }
258 else if (m_variableFile.count(var))
259 {
260 m_solutionFile->InterpolateField(var, m_fields[i]->UpdateCoeffs(),
261 time);
262 m_fields[i]->SetPhysState(true);
263 m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
264 m_fields[i]->UpdatePhys());
265 }
266 else
267 {
268 ASSERTL0(false, "solution not defined for variable " + var);
269 }
270 }
271}
272
274{
275 return false;
276}
277
279 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &physfield,
280 [[maybe_unused]] Array<OneD, NekDouble> &pressure)
281{
282}
283
285 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
286 Array<OneD, NekDouble> &density)
287{
288 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
289 {
290 if (m_session->GetVariable(i) == "rho")
291 {
292 int npoints = m_fields[i]->GetNpoints();
293 Vmath::Vcopy(npoints, physfield[i], 1, density, 1);
294 }
295 }
296 Vmath::Fill(m_fields[0]->GetNpoints(), 1., density, 1);
297}
298
300{
301 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
302 {
303 if (m_session->GetVariable(i) == "rho")
304 {
305 return false;
306 }
307 }
308 return true;
309}
310
312 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
314{
315 int npoints = m_fields[0]->GetNpoints();
316 if (boost::iequals(m_session->GetVariable(0), "u"))
317 {
318 // IncNavierStokesSolver
319 for (int i = 0; i < velocity.size(); ++i)
320 {
321 Vmath::Vcopy(npoints, physfield[i], 1, velocity[i], 1);
322 }
323 }
324 else if (boost::iequals(m_session->GetVariable(0), "rho") &&
325 boost::iequals(m_session->GetVariable(1), "rhou"))
326 {
327 // CompressibleFlowSolver
328 for (int i = 0; i < velocity.size(); ++i)
329 {
330 Vmath::Vdiv(npoints, physfield[i], 1, physfield[0], 1, velocity[i],
331 1);
332 }
333 }
334 else
335 {
336 // Unknown
337 ASSERTL0(false, "Could not identify velocity for ProcessVorticity");
338 }
339}
340
342 const std::string functionName,
345 std::set<std::string> &variables, std::map<std::string, int> &series,
346 std::map<std::string, NekDouble> &times)
347{
348 m_session = pSession;
349 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
350 {
351 std::string var = m_session->GetVariable(i);
352 if (variables.count(var))
353 {
354 ASSERTL0(m_session->DefinesFunction(functionName, var) &&
355 (m_session->GetFunctionType(functionName, var) ==
357 functionName + "(" + var + ") is not defined as a file.");
358 m_variableMap[var] = i;
359 }
360 }
361
362 if (series.count("start"))
363 {
364 m_start = series["start"];
365 }
366 else
367 {
368 m_start = 0;
369 }
370
371 if (series.count("skip"))
372 {
373 m_skip = series["skip"];
374 }
375 else
376 {
377 m_skip = 1;
378 }
379
380 if (series.count("slices"))
381 {
382 m_slices = series["slices"];
383 }
384 else
385 {
386 m_slices = 1;
387 }
388
389 if (series.count("order"))
390 {
391 m_interporder = series["order"];
392 }
393 else
394 {
395 m_interporder = 0;
396 }
397
398 if (series.count("isperiodic"))
399 {
400 m_isperiodic = series["isperiodic"];
401 }
402 else
403 {
404 m_isperiodic = 1;
405 }
406
407 bool timefromfile = false;
408 if (times.count("period"))
409 {
410 m_period = times["period"];
411 }
412 else if (m_slices > 1)
413 {
414 timefromfile = true;
415 }
416 if (times.count("start"))
417 {
418 m_timeStart = times["start"];
419 }
420 else
421 {
422 m_timeStart = 0.;
423 }
424
425 if (m_session->GetComm()->GetRank() == 0)
426 {
427 cout << "baseflow info : interpolation order " << m_interporder
428 << ", period " << m_period << ", periodicity ";
429 if (m_isperiodic)
430 {
431 cout << "yes\n";
432 }
433 else
434 {
435 cout << "no\n";
436 }
437 cout << "baseflow info : files from " << m_start << " to "
438 << (m_start + (m_slices - 1) * m_skip) << " (skip " << m_skip
439 << ") with " << (m_slices - (m_interporder > 1))
440 << " time intervals" << endl;
441 }
442
443 string file = m_session->GetFunctionFilename("Solution", 0);
444 DFT(file, pFields, timefromfile);
445}
446
448{
449}
450
452{
453}
454
455/**
456 * Import field from infile and load into \a m_fields. This routine will
457 * also perform a \a BwdTrans to ensure data is in both the physical and
458 * coefficient storage.
459 * @param pInFile Filename to read.
460 * @param pFields Array of expansion lists
461 */
463 std::string pInfile,
465 int pSlice, std::map<std::string, NekDouble> &params)
466{
467 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
468 std::vector<std::vector<NekDouble>> FieldData;
469
470 int numexp = pFields[0]->GetExpSize();
471 Array<OneD, int> ElementGIDs(numexp);
472
473 // Define list of global element ids
474 for (int i = 0; i < numexp; ++i)
475 {
476 ElementGIDs[i] = pFields[0]->GetExp(i)->GetGeom()->GetGlobalID();
477 }
478
479 // Get Homogeneous
482 fld->Import(pInfile, FieldDef, FieldData,
484
485 int nFileVar = FieldDef[0]->m_fields.size();
486 for (int j = 0; j < nFileVar; ++j)
487 {
488 std::string var = FieldDef[0]->m_fields[j];
489 if (!m_variableMap.count(var))
490 {
491 continue;
492 }
493 int ncoeffs = pFields[m_variableMap[var]]->GetNcoeffs();
494 Array<OneD, NekDouble> tmp_coeff(ncoeffs, 0.);
495 for (int i = 0; i < FieldDef.size(); ++i)
496 {
497 pFields[m_variableMap[var]]->ExtractDataToCoeffs(
498 FieldDef[i], FieldData[i], FieldDef[i]->m_fields[j], tmp_coeff);
499 }
500 Vmath::Vcopy(ncoeffs, &tmp_coeff[0], 1,
501 &m_interp[m_variableMap[var]][pSlice * ncoeffs], 1);
502 }
503
504 LibUtilities::FieldMetaDataMap fieldMetaDataMap;
505 fld->ImportFieldMetaData(pInfile, fieldMetaDataMap);
506 // check to see if time defined
507 if (fieldMetaDataMap != LibUtilities::NullFieldMetaDataMap)
508 {
509 auto iter = fieldMetaDataMap.find("Time");
510 if (iter != fieldMetaDataMap.end())
511 {
512 params["time"] = std::stod(iter->second);
513 }
514 }
515}
516
517void FileFieldInterpolator::InterpolateField(const std::string variable,
518 Array<OneD, NekDouble> &outarray,
519 const NekDouble time)
520{
521 if (!m_variableMap.count(variable))
522 {
523 return;
524 }
525 InterpolateField(m_variableMap[variable], outarray, time);
526}
527
529 Array<OneD, NekDouble> &outarray,
530 NekDouble time)
531{
532 // doesnot have this variable
533 if (!m_interp.count(v))
534 {
535 return;
536 }
537 // one slice, steady solution
538 int npoints = m_interp[v].size() / m_slices;
539 if (m_slices == 1)
540 {
541 Vmath::Vcopy(npoints, &m_interp[v][0], 1, &outarray[0], 1);
542 return;
543 }
544 // unsteady solution
545 time -= m_timeStart;
546 if (m_isperiodic && time > m_period)
547 {
548 time = fmod(time, m_period);
549 if (time < 0.)
550 {
551 time += m_period;
552 }
553 }
554 if (m_interporder < 1)
555 {
556 NekDouble BetaT = 2 * M_PI * fmod(time, m_period) / m_period;
557 NekDouble phase;
558 Array<OneD, NekDouble> auxiliary(npoints);
559
560 Vmath::Vcopy(npoints, &m_interp[v][0], 1, &outarray[0], 1);
561 Vmath::Svtvp(npoints, cos(0.5 * m_slices * BetaT),
562 &m_interp[v][npoints], 1, &outarray[0], 1, &outarray[0],
563 1);
564
565 for (int i = 2; i < m_slices; i += 2)
566 {
567 phase = (i >> 1) * BetaT;
568
569 Vmath::Svtvp(npoints, cos(phase), &m_interp[v][i * npoints], 1,
570 &outarray[0], 1, &outarray[0], 1);
571 Vmath::Svtvp(npoints, -sin(phase), &m_interp[v][(i + 1) * npoints],
572 1, &outarray[0], 1, &outarray[0], 1);
573 }
574 }
575 else
576 {
577 NekDouble x = time;
578 x = x / m_period * (m_slices - 1);
579 int ix = x;
580 if (ix < 0)
581 {
582 ix = 0;
583 }
584 if (ix > m_slices - 2)
585 {
586 ix = m_slices - 2;
587 }
588 int padleft = max(0, m_interporder / 2 - 1);
589 if (padleft > ix)
590 {
591 padleft = ix;
592 }
593 int padright = m_interporder - 1 - padleft;
594 if (padright > m_slices - 1 - ix)
595 {
596 padright = m_slices - 1 - ix;
597 }
598 padleft = m_interporder - 1 - padright;
600 for (int i = 0; i < m_interporder; ++i)
601 {
602 for (int j = 0; j < m_interporder; ++j)
603 {
604 if (i != j)
605 {
606 coeff[i] *= (x - ix + padleft - (NekDouble)j) /
607 ((NekDouble)i - (NekDouble)j);
608 }
609 }
610 }
611 Vmath::Zero(npoints, &outarray[0], 1);
612 for (int i = ix - padleft; i < ix + padright + 1; ++i)
613 {
614 Vmath::Svtvp(npoints, coeff[i - ix + padleft],
615 &m_interp[v][i * npoints], 1, &outarray[0], 1,
616 &outarray[0], 1);
617 }
618 }
619}
620
622{
623 DNekMatSharedPtr loc_mat;
624 DNekBlkMatSharedPtr BlkMatrix;
625
626 Array<OneD, unsigned int> nrows(nexp);
627 Array<OneD, unsigned int> ncols(nexp);
628
629 nrows = Array<OneD, unsigned int>(nexp, m_slices);
630 ncols = Array<OneD, unsigned int>(nexp, m_slices);
631
632 MatrixStorage blkmatStorage = eDIAGONAL;
633 BlkMatrix = MemoryManager<DNekBlkMat>::AllocateSharedPtr(nrows, ncols,
634 blkmatStorage);
635
639 StdRegions::StdSegExp StdSeg(BK);
640
642 StdSeg.DetShapeType(), StdSeg);
643
644 loc_mat = StdSeg.GetStdMatrix(matkey);
645
646 // set up array of block matrices.
647 for (int i = 0; i < nexp; ++i)
648 {
649 BlkMatrix->SetBlock(i, i, loc_mat);
650 }
651
652 return BlkMatrix;
653}
654
655// Discrete Fourier Transform for Floquet analysis
657 const string file,
659 const bool timefromfile)
660{
661 for (auto it : m_variableMap)
662 {
663 int ncoeffs = pFields[it.second]->GetNcoeffs();
664 m_interp[it.second] = Array<OneD, NekDouble>(ncoeffs * m_slices, 0.0);
665 }
666
667 // Import the slides into auxiliary vector
668 // The base flow should be stored in the form "filename_%d.ext"
669 // A subdirectory can also be included, such as "dir/filename_%d.ext"
670 size_t found = file.find("%d");
671 std::map<std::string, NekDouble> params;
672 if (found != string::npos)
673 {
674 ASSERTL0(file.find("%d", found + 1) == string::npos,
675 "There are more than one '%d'.");
676 int nstart = m_start;
677 std::vector<NekDouble> times;
678 for (int i = 0; i < m_slices; ++i)
679 {
680 int filen = nstart + i * m_skip;
681 auto fmt = boost::format(file) % filen;
682 ImportFldBase(fmt.str(), pFields, i, params);
683 if (m_session->GetComm()->GetRank() == 0)
684 {
685 cout << "read base flow file " << fmt.str() << endl;
686 }
687 if (timefromfile && params.count("time"))
688 {
689 times.push_back(params["time"]);
690 }
691 }
692 if (timefromfile && times.size() == m_slices && m_slices > 1)
693 {
694 m_timeStart = times[0];
695 if (m_interporder < 1)
696 {
697 m_period = m_slices * (times[m_slices - 1] - times[0]) /
698 (m_slices - 1.);
699 }
700 else
701 {
702 m_period = times[m_slices - 1] - times[0];
703 }
704 }
705 }
706 else if (m_slices == 1)
707 {
708 ImportFldBase(file.c_str(), pFields, 0, params);
709 }
710 else
711 {
712 ASSERTL0(
713 false,
714 "Since N_slices is specified, the filename provided for function "
715 "'BaseFlow' must include exactly one instance of the format "
716 "specifier '%d', to index the time-slices.");
717 }
718
719 if (!m_isperiodic || m_slices == 1)
720 {
721 return;
722 }
723
724 // Discrete Fourier Transform of the fields
725 for (auto it : m_interp)
726 {
727 int npoints = pFields[it.first]->GetNcoeffs();
728#ifdef NEKTAR_USING_FFTW
729
730 // Discrete Fourier Transform using FFTW
731 Array<OneD, NekDouble> fft_in(npoints * m_slices);
732 Array<OneD, NekDouble> fft_out(npoints * m_slices);
733
736
737 // Shuffle the data
738 for (int j = 0; j < m_slices; ++j)
739 {
740 Vmath::Vcopy(npoints, &(it.second)[j * npoints], 1, &(fft_in[j]),
741 m_slices);
742 }
743
745 m_slices);
746
747 // FFT Transform
748 for (int i = 0; i < npoints; i++)
749 {
750 m_FFT->FFTFwdTrans(m_tmpIN = fft_in + i * m_slices,
751 m_tmpOUT = fft_out + i * m_slices);
752 }
753
754 // Reshuffle data
755 for (int s = 0; s < m_slices; ++s)
756 {
757 Vmath::Vcopy(npoints, &fft_out[s], m_slices,
758 &(it.second)[s * npoints], 1);
759 }
760
761 Vmath::Zero(fft_in.size(), &fft_in[0], 1);
762 Vmath::Zero(fft_out.size(), &fft_out[0], 1);
763#else
764 // Discrete Fourier Transform using MVM
765 DNekBlkMatSharedPtr blkmat;
766 blkmat = GetFloquetBlockMatrix(npoints);
767
768 int nrows = blkmat->GetRows();
769 int ncols = blkmat->GetColumns();
770
771 Array<OneD, NekDouble> sortedinarray(ncols);
772 Array<OneD, NekDouble> sortedoutarray(nrows);
773
774 // Shuffle the data
775 for (int j = 0; j < m_slices; ++j)
776 {
777 Vmath::Vcopy(npoints, &(it.second)[j * npoints], 1,
778 &(sortedinarray[j]), m_slices);
779 }
780
781 // Create NekVectors from the given data arrays
782 NekVector<NekDouble> in(ncols, sortedinarray, eWrapper);
783 NekVector<NekDouble> out(nrows, sortedoutarray, eWrapper);
784
785 // Perform matrix-vector multiply.
786 out = (*blkmat) * in;
787
788 // Reshuffle data
789 for (int s = 0; s < m_slices; ++s)
790 {
791 Vmath::Vcopy(npoints, &sortedoutarray[s], m_slices,
792 &(it.second)[s * npoints], 1);
793 }
794
795 for (int r = 0; r < sortedinarray.size(); ++r)
796 {
797 sortedinarray[0] = 0;
798 sortedoutarray[0] = 0;
799 }
800
801#endif
802 }
803}
804
806{
807 return m_timeStart;
808}
809} // namespace Nektar::SolverUtils
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
Describes the specification for a Basis.
Definition: Basis.h:45
static std::shared_ptr< FieldIO > CreateForFile(const LibUtilities::SessionReaderSharedPtr session, const std::string &filename)
Construct a FieldIO object for a given input filename.
Definition: FieldIO.cpp:224
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Defines a specification for a set of points.
Definition: Points.h:50
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
A base class for PDEs which include an advection component.
SOLVER_UTILS_EXPORT void v_InitObject(bool DeclareField=true) override
Initialisation object for EquationSystem.
NekDouble m_time
Current time of simulation.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure(void)
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetNpoints()
int m_nchk
Number of checkpoints written so far.
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
int m_checksteps
Number of steps between checkpoints.
LibUtilities::SessionReaderSharedPtr m_session
Definition: FileSolution.h:72
std::map< std::string, int > m_variableMap
variables
Definition: FileSolution.h:85
void ImportFldBase(std::string pInfile, const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, int slice, std::map< std::string, NekDouble > &params)
Import Base flow.
std::map< int, Array< OneD, NekDouble > > m_interp
interpolation vector
Definition: FileSolution.h:83
void InterpolateField(const std::string variable, Array< OneD, NekDouble > &outarray, NekDouble time)
void DFT(const std::string file, const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const bool timefromfile)
void InitObject(const std::string functionName, LibUtilities::SessionReaderSharedPtr pSession, const Array< OneD, const MultiRegions::ExpListSharedPtr > pFields, std::set< std::string > &variables, std::map< std::string, int > &series, std::map< std::string, NekDouble > &time)
DNekBlkMatSharedPtr GetFloquetBlockMatrix(int nexp)
void v_GetDensity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density) override
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
Definition: FileSolution.h:115
FileFieldInterpolatorSharedPtr m_solutionFile
Definition: FileSolution.h:178
void UpdateField(NekDouble time)
Array< OneD, Array< OneD, NekDouble > > m_coord
Definition: FileSolution.h:180
std::set< std::string > m_variableFile
Definition: FileSolution.h:179
void DoImplicitSolve(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, NekDouble time, NekDouble lambda)
bool v_PostIntegrate(int step) override
void v_DoInitialise(bool dumpInitialConditions) override
Sets up initial conditions.
FileSolution(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Session reader.
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the projection.
std::map< std::string, LibUtilities::EquationSharedPtr > m_solutionFunction
Definition: FileSolution.h:181
void v_GetVelocity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity) override
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the RHS.
void v_InitObject(bool DeclareField=true) override
Initialise the object.
static std::string className
Name of class.
Definition: FileSolution.h:125
~FileSolution() override
Destructor.
Base class for unsteady solvers.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
DNekMatSharedPtr GetStdMatrix(const StdMatrixKey &mkey)
Definition: StdExpansion.h:603
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:367
Class representing a segment element in reference space All interface of this class sits in StdExpans...
Definition: StdSegExp.h:45
NektarFFTFactory & GetNektarFFTFactory()
Definition: NektarFFT.cpp:65
std::shared_ptr< FieldIO > FieldIOSharedPtr
Definition: FieldIO.h:322
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:50
std::shared_ptr< SessionReader > SessionReaderSharedPtr
static FieldMetaDataMap NullFieldMetaDataMap
Definition: FieldIO.h:51
@ eFourierEvenlySpaced
1D Evenly-spaced points using Fourier Fit
Definition: PointsType.h:74
@ eFourier
Fourier Expansion .
Definition: BasisType.h:55
EquationSystemFactory & GetEquationSystemFactory()
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Svtvp (scalar times vector plus vector): z = alpha*x + y.
Definition: Vmath.hpp:396
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 Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.hpp:273
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.hpp:54
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825
STL namespace.