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
62namespace Nektar::SolverUtils
63{
64/**
65 * Constructor. Creates ...
66 *
67 * \param
68 * \param
69 */
70std::string FileSolution::className =
72 "FileSolution", FileSolution::create,
73 "review a solution from check point files.");
74
77 : UnsteadySystem(pSession, pGraph), AdvectionSystem(pSession, pGraph)
78{
80}
81
82/**
83 * @brief Initialisation object for the unsteady linear advection equation.
84 */
85void FileSolution::v_InitObject(bool DeclareField)
86{
87 // Call to the initialisation object of UnsteadySystem
89
90 // If explicit it computes RHS and PROJECTION for the time integration
94
95 // load solution
96 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
97 {
98 if (m_session->GetFunctionType("Solution", m_session->GetVariable(i)) ==
100 {
101 m_variableFile.insert(m_session->GetVariable(i));
102 }
103 else if (m_session->GetFunctionType("Solution",
104 m_session->GetVariable(i)) ==
106 {
107 m_solutionFunction[m_session->GetVariable(i)] =
108 m_session->GetFunction("Solution", m_session->GetVariable(i));
109 }
110 else
111 {
112 ASSERTL0(false, "solution not defined for variable " +
113 m_session->GetVariable(i));
114 }
115 }
116
117 if (m_variableFile.size())
118 {
119 std::map<std::string, int> series; // start, skip, slices, order
120 int tmp;
121 if (m_session->DefinesParameter("N_slices"))
122 {
123 m_session->LoadParameter("N_slices", tmp, 1);
124 series["slices"] = tmp;
125 }
126 if (m_session->DefinesParameter("N_start"))
127 {
128 m_session->LoadParameter("N_start", tmp, 0);
129 series["start"] = tmp;
130 }
131 if (m_session->DefinesParameter("N_skip"))
132 {
133 m_session->LoadParameter("N_skip", tmp, 1);
134 series["skip"] = tmp;
135 }
136 if (m_session->DefinesParameter("BaseFlow_interporder"))
137 {
138 m_session->LoadParameter("BaseFlow_interporder", tmp, 1);
139 series["order"] = tmp;
140 }
141 if (m_session->DefinesParameter("Is_periodic"))
142 {
143 m_session->LoadParameter("Is_periodic", tmp, 1);
144 series["isperiodic"] = tmp;
145 }
146
147 std::map<std::string, NekDouble> times;
148 NekDouble dtmp;
149 if (m_session->DefinesParameter("time_start"))
150 {
151 m_session->LoadParameter("time_start", dtmp, 0.);
152 times["start"] = dtmp;
153 }
154 if (m_session->DefinesParameter("period"))
155 {
156 m_session->LoadParameter("period", dtmp, 1.);
157 times["period"] = dtmp;
158 }
159 m_solutionFile->InitObject("Solution", m_session, m_fields,
160 m_variableFile, series, times);
161 }
162
163 if (m_solutionFunction.size())
164 {
166 int nq = m_fields[0]->GetNpoints();
170 m_fields[0]->GetCoords(m_coord[0], m_coord[1], m_coord[2]);
171 }
172}
173
175 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &inarray,
176 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &outarray,
177 [[maybe_unused]] NekDouble time, [[maybe_unused]] NekDouble lambda)
178{
179}
180
181/**
182 * @brief Compute the right-hand side for the linear advection equation.
183 *
184 * @param inarray Given fields.
185 * @param outarray Calculated solution.
186 * @param time Time.
187 */
189 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &inarray,
191 [[maybe_unused]] const NekDouble time)
192{
193 int nSolutionPts = GetNpoints();
194 for (size_t i = 0; i < outarray.size(); ++i)
195 {
196 Vmath::Zero(nSolutionPts, outarray[i], 1);
197 }
198}
199
200/**
201 * @brief Compute the projection for the linear advection equation.
202 *
203 * @param inarray Given fields.
204 * @param outarray Calculated solution.
205 * @param time Time.
206 */
208 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &inarray,
209 [[maybe_unused]] Array<OneD, Array<OneD, NekDouble>> &outarray,
210 [[maybe_unused]] const NekDouble time)
211{
212}
213
214bool FileSolution::v_PostIntegrate([[maybe_unused]] int step)
215{
217 return false;
218}
219
220void FileSolution::v_DoInitialise(bool dumpInitialConditions)
221{
222 m_time = m_solutionFile->GetStartTime();
225 if (dumpInitialConditions && m_checksteps && m_nchk == 0)
226 {
228 }
229 ++m_nchk;
230}
231
233{
234 for (int i = 0; i < m_fields.size(); ++i)
235 {
236 std::string var = m_session->GetVariable(i);
237 if (m_solutionFunction.count(var))
238 {
239 m_solutionFunction[var]->Evaluate(m_coord[0], m_coord[1],
240 m_coord[2], time,
241 m_fields[i]->UpdatePhys());
242 m_fields[i]->SetPhysState(true);
243 bool wavespace = m_fields[i]->GetWaveSpace();
244 m_fields[i]->SetWaveSpace(false);
245 m_fields[i]->FwdTransBndConstrained(m_fields[i]->GetPhys(),
246 m_fields[i]->UpdateCoeffs());
247 m_fields[i]->SetWaveSpace(wavespace);
248 }
249 else if (m_variableFile.count(var))
250 {
251 m_solutionFile->InterpolateField(var, m_fields[i]->UpdateCoeffs(),
252 time);
253 m_fields[i]->SetPhysState(true);
254 m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
255 m_fields[i]->UpdatePhys());
256 }
257 else
258 {
259 ASSERTL0(false, "solution not defined for variable " + var);
260 }
261 }
262}
263
265{
266 return false;
267}
268
270 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &physfield,
271 [[maybe_unused]] Array<OneD, NekDouble> &pressure)
272{
273}
274
276 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
277 Array<OneD, NekDouble> &density)
278{
279 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
280 {
281 if (m_session->GetVariable(i) == "rho")
282 {
283 int npoints = m_fields[i]->GetNpoints();
284 Vmath::Vcopy(npoints, physfield[i], 1, density, 1);
285 }
286 }
287 Vmath::Fill(m_fields[0]->GetNpoints(), 1., density, 1);
288}
289
291{
292 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
293 {
294 if (m_session->GetVariable(i) == "rho")
295 {
296 return false;
297 }
298 }
299 return true;
300}
301
303 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
305{
306 int npoints = m_fields[0]->GetNpoints();
307 if (boost::iequals(m_session->GetVariable(0), "u"))
308 {
309 // IncNavierStokesSolver
310 for (int i = 0; i < velocity.size(); ++i)
311 {
312 Vmath::Vcopy(npoints, physfield[i], 1, velocity[i], 1);
313 }
314 }
315 else if (boost::iequals(m_session->GetVariable(0), "rho") &&
316 boost::iequals(m_session->GetVariable(1), "rhou"))
317 {
318 // CompressibleFlowSolver
319 for (int i = 0; i < velocity.size(); ++i)
320 {
321 Vmath::Vdiv(npoints, physfield[i], 1, physfield[0], 1, velocity[i],
322 1);
323 }
324 }
325 else
326 {
327 // Unknown
328 ASSERTL0(false, "Could not identify velocity for ProcessVorticity");
329 }
330}
331
333 const std::string functionName,
336 std::set<std::string> &variables, std::map<std::string, int> &series,
337 std::map<std::string, NekDouble> &times)
338{
339 m_session = pSession;
340 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
341 {
342 std::string var = m_session->GetVariable(i);
343 if (variables.count(var))
344 {
345 ASSERTL0(m_session->DefinesFunction(functionName, var) &&
346 (m_session->GetFunctionType(functionName, var) ==
348 functionName + "(" + var + ") is not defined as a file.");
349 m_variableMap[var] = i;
350 }
351 }
352
353 if (series.count("start"))
354 {
355 m_start = series["start"];
356 }
357 else
358 {
359 m_start = 0;
360 }
361
362 if (series.count("skip"))
363 {
364 m_skip = series["skip"];
365 }
366 else
367 {
368 m_skip = 1;
369 }
370
371 if (series.count("slices"))
372 {
373 m_slices = series["slices"];
374 }
375 else
376 {
377 m_slices = 1;
378 }
379
380 if (series.count("order"))
381 {
382 m_interporder = series["order"];
383 }
384 else
385 {
386 m_interporder = 0;
387 }
388
389 if (series.count("isperiodic"))
390 {
391 m_isperiodic = series["isperiodic"];
392 }
393 else
394 {
395 m_isperiodic = 1;
396 }
397
398 bool timefromfile = false;
399 if (times.count("period"))
400 {
401 m_period = times["period"];
402 }
403 else if (m_slices > 1)
404 {
405 timefromfile = true;
406 }
407 if (times.count("start"))
408 {
409 m_timeStart = times["start"];
410 }
411 else
412 {
413 m_timeStart = 0.;
414 }
415
416 if (m_session->GetComm()->GetRank() == 0)
417 {
418 std::cout << "baseflow info : interpolation order " << m_interporder
419 << ", period " << m_period << ", periodicity ";
420 if (m_isperiodic)
421 {
422 std::cout << "yes\n";
423 }
424 else
425 {
426 std::cout << "no\n";
427 }
428 std::cout << "baseflow info : files from " << m_start << " to "
429 << (m_start + (m_slices - 1) * m_skip) << " (skip " << m_skip
430 << ") with " << (m_slices - (m_interporder > 1))
431 << " time intervals" << std::endl;
432 }
433
434 std::string file = m_session->GetFunctionFilename("Solution", 0);
435 DFT(file, pFields, timefromfile);
436}
437
438/**
439 * Import field from infile and load into \a m_fields. This routine will
440 * also perform a \a BwdTrans to ensure data is in both the physical and
441 * coefficient storage.
442 * @param pInFile Filename to read.
443 * @param pFields Array of expansion lists
444 */
446 std::string pInfile,
448 int pSlice, std::map<std::string, NekDouble> &params)
449{
450 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
451 std::vector<std::vector<NekDouble>> FieldData;
452
453 int numexp = pFields[0]->GetExpSize();
454 Array<OneD, int> ElementGIDs(numexp);
455
456 // Define list of global element ids
457 for (int i = 0; i < numexp; ++i)
458 {
459 ElementGIDs[i] = pFields[0]->GetExp(i)->GetGeom()->GetGlobalID();
460 }
461
462 // Get Homogeneous
465 fld->Import(pInfile, FieldDef, FieldData,
467
468 int nFileVar = FieldDef[0]->m_fields.size();
469 for (int j = 0; j < nFileVar; ++j)
470 {
471 std::string var = FieldDef[0]->m_fields[j];
472 if (!m_variableMap.count(var))
473 {
474 continue;
475 }
476 int ncoeffs = pFields[m_variableMap[var]]->GetNcoeffs();
477 Array<OneD, NekDouble> tmp_coeff(ncoeffs, 0.);
478 for (int i = 0; i < FieldDef.size(); ++i)
479 {
480 pFields[m_variableMap[var]]->ExtractDataToCoeffs(
481 FieldDef[i], FieldData[i], FieldDef[i]->m_fields[j], tmp_coeff);
482 }
483 Vmath::Vcopy(ncoeffs, &tmp_coeff[0], 1,
484 &m_interp[m_variableMap[var]][pSlice * ncoeffs], 1);
485 }
486
487 LibUtilities::FieldMetaDataMap fieldMetaDataMap;
488 fld->ImportFieldMetaData(pInfile, fieldMetaDataMap);
489 // check to see if time defined
490 if (fieldMetaDataMap != LibUtilities::NullFieldMetaDataMap)
491 {
492 auto iter = fieldMetaDataMap.find("Time");
493 if (iter != fieldMetaDataMap.end())
494 {
495 params["time"] = std::stod(iter->second);
496 }
497 }
498}
499
500void FileFieldInterpolator::InterpolateField(const std::string variable,
501 Array<OneD, NekDouble> &outarray,
502 const NekDouble time)
503{
504 if (!m_variableMap.count(variable))
505 {
506 return;
507 }
508 InterpolateField(m_variableMap[variable], outarray, time);
509}
510
512 Array<OneD, NekDouble> &outarray,
513 NekDouble time)
514{
515 // doesnot have this variable
516 if (!m_interp.count(v))
517 {
518 return;
519 }
520 // one slice, steady solution
521 int npoints = m_interp[v].size() / m_slices;
522 if (m_slices == 1)
523 {
524 Vmath::Vcopy(npoints, &m_interp[v][0], 1, &outarray[0], 1);
525 return;
526 }
527 // unsteady solution
528 time -= m_timeStart;
529 if (m_isperiodic && time > m_period)
530 {
531 time = fmod(time, m_period);
532 if (time < 0.)
533 {
534 time += m_period;
535 }
536 }
537 if (m_interporder < 1)
538 {
539 NekDouble BetaT = 2 * M_PI * fmod(time, m_period) / m_period;
540 NekDouble phase;
541 Array<OneD, NekDouble> auxiliary(npoints);
542
543 Vmath::Vcopy(npoints, &m_interp[v][0], 1, &outarray[0], 1);
544 Vmath::Svtvp(npoints, cos(0.5 * m_slices * BetaT),
545 &m_interp[v][npoints], 1, &outarray[0], 1, &outarray[0],
546 1);
547
548 for (int i = 2; i < m_slices; i += 2)
549 {
550 phase = (i >> 1) * BetaT;
551
552 Vmath::Svtvp(npoints, cos(phase), &m_interp[v][i * npoints], 1,
553 &outarray[0], 1, &outarray[0], 1);
554 Vmath::Svtvp(npoints, -sin(phase), &m_interp[v][(i + 1) * npoints],
555 1, &outarray[0], 1, &outarray[0], 1);
556 }
557 }
558 else
559 {
560 NekDouble x = time;
561 x = x / m_period * (m_slices - 1);
562 int ix = x;
563 if (ix < 0)
564 {
565 ix = 0;
566 }
567 if (ix > m_slices - 2)
568 {
569 ix = m_slices - 2;
570 }
571 int padleft = std::max(0, m_interporder / 2 - 1);
572 if (padleft > ix)
573 {
574 padleft = ix;
575 }
576 int padright = m_interporder - 1 - padleft;
577 if (padright > m_slices - 1 - ix)
578 {
579 padright = m_slices - 1 - ix;
580 }
581 padleft = m_interporder - 1 - padright;
583 for (int i = 0; i < m_interporder; ++i)
584 {
585 for (int j = 0; j < m_interporder; ++j)
586 {
587 if (i != j)
588 {
589 coeff[i] *= (x - ix + padleft - (NekDouble)j) /
590 ((NekDouble)i - (NekDouble)j);
591 }
592 }
593 }
594 Vmath::Zero(npoints, &outarray[0], 1);
595 for (int i = ix - padleft; i < ix + padright + 1; ++i)
596 {
597 Vmath::Svtvp(npoints, coeff[i - ix + padleft],
598 &m_interp[v][i * npoints], 1, &outarray[0], 1,
599 &outarray[0], 1);
600 }
601 }
602}
603
605{
606 DNekMatSharedPtr loc_mat;
607 DNekBlkMatSharedPtr BlkMatrix;
608
609 Array<OneD, unsigned int> nrows(nexp);
610 Array<OneD, unsigned int> ncols(nexp);
611
612 nrows = Array<OneD, unsigned int>(nexp, m_slices);
613 ncols = Array<OneD, unsigned int>(nexp, m_slices);
614
615 MatrixStorage blkmatStorage = eDIAGONAL;
616 BlkMatrix = MemoryManager<DNekBlkMat>::AllocateSharedPtr(nrows, ncols,
617 blkmatStorage);
618
622 StdRegions::StdSegExp StdSeg(BK);
623
625 StdSeg.DetShapeType(), StdSeg);
626
627 loc_mat = StdSeg.GetStdMatrix(matkey);
628
629 // set up array of block matrices.
630 for (int i = 0; i < nexp; ++i)
631 {
632 BlkMatrix->SetBlock(i, i, loc_mat);
633 }
634
635 return BlkMatrix;
636}
637
638// Discrete Fourier Transform for Floquet analysis
640 const std::string file,
642 const bool timefromfile)
643{
644 for (auto it : m_variableMap)
645 {
646 int ncoeffs = pFields[it.second]->GetNcoeffs();
647 m_interp[it.second] = Array<OneD, NekDouble>(ncoeffs * m_slices, 0.0);
648 }
649
650 // Import the slides into auxiliary vector
651 // The base flow should be stored in the form "filename_%d.ext"
652 // A subdirectory can also be included, such as "dir/filename_%d.ext"
653 size_t found = file.find("%d");
654 std::map<std::string, NekDouble> params;
655 if (found != std::string::npos)
656 {
657 ASSERTL0(file.find("%d", found + 1) == std::string::npos,
658 "There are more than one '%d'.");
659 int nstart = m_start;
660 std::vector<NekDouble> times;
661 for (int i = 0; i < m_slices; ++i)
662 {
663 int filen = nstart + i * m_skip;
664 auto fmt = boost::format(file) % filen;
665 ImportFldBase(fmt.str(), pFields, i, params);
666 if (m_session->GetComm()->GetRank() == 0)
667 {
668 std::cout << "read base flow file " << fmt.str() << std::endl;
669 }
670 if (timefromfile && params.count("time"))
671 {
672 times.push_back(params["time"]);
673 }
674 }
675 if (timefromfile && times.size() == m_slices && m_slices > 1)
676 {
677 m_timeStart = times[0];
678 if (m_interporder < 1)
679 {
680 m_period = m_slices * (times[m_slices - 1] - times[0]) /
681 (m_slices - 1.);
682 }
683 else
684 {
685 m_period = times[m_slices - 1] - times[0];
686 }
687 }
688 }
689 else if (m_slices == 1)
690 {
691 ImportFldBase(file.c_str(), pFields, 0, params);
692 }
693 else
694 {
695 ASSERTL0(
696 false,
697 "Since N_slices is specified, the filename provided for function "
698 "'BaseFlow' must include exactly one instance of the format "
699 "specifier '%d', to index the time-slices.");
700 }
701
702 if (!m_isperiodic || m_slices == 1)
703 {
704 return;
705 }
706
707 // Discrete Fourier Transform of the fields
708 for (auto it : m_interp)
709 {
710 int npoints = pFields[it.first]->GetNcoeffs();
711#ifdef NEKTAR_USING_FFTW
712
713 // Discrete Fourier Transform using FFTW
714 Array<OneD, NekDouble> fft_in(npoints * m_slices);
715 Array<OneD, NekDouble> fft_out(npoints * m_slices);
716
719
720 // Shuffle the data
721 for (int j = 0; j < m_slices; ++j)
722 {
723 Vmath::Vcopy(npoints, &(it.second)[j * npoints], 1, &(fft_in[j]),
724 m_slices);
725 }
726
728 m_slices);
729
730 // FFT Transform
731 for (int i = 0; i < npoints; i++)
732 {
733 m_FFT->FFTFwdTrans(m_tmpIN = fft_in + i * m_slices,
734 m_tmpOUT = fft_out + i * m_slices);
735 }
736
737 // Reshuffle data
738 for (int s = 0; s < m_slices; ++s)
739 {
740 Vmath::Vcopy(npoints, &fft_out[s], m_slices,
741 &(it.second)[s * npoints], 1);
742 }
743
744 Vmath::Zero(fft_in.size(), &fft_in[0], 1);
745 Vmath::Zero(fft_out.size(), &fft_out[0], 1);
746#else
747 // Discrete Fourier Transform using MVM
748 DNekBlkMatSharedPtr blkmat;
749 blkmat = GetFloquetBlockMatrix(npoints);
750
751 int nrows = blkmat->GetRows();
752 int ncols = blkmat->GetColumns();
753
754 Array<OneD, NekDouble> sortedinarray(ncols);
755 Array<OneD, NekDouble> sortedoutarray(nrows);
756
757 // Shuffle the data
758 for (int j = 0; j < m_slices; ++j)
759 {
760 Vmath::Vcopy(npoints, &(it.second)[j * npoints], 1,
761 &(sortedinarray[j]), m_slices);
762 }
763
764 // Create NekVectors from the given data arrays
765 NekVector<NekDouble> in(ncols, sortedinarray, eWrapper);
766 NekVector<NekDouble> out(nrows, sortedoutarray, eWrapper);
767
768 // Perform matrix-vector multiply.
769 out = (*blkmat) * in;
770
771 // Reshuffle data
772 for (int s = 0; s < m_slices; ++s)
773 {
774 Vmath::Vcopy(npoints, &sortedoutarray[s], m_slices,
775 &(it.second)[s * npoints], 1);
776 }
777
778 for (int r = 0; r < sortedinarray.size(); ++r)
779 {
780 sortedinarray[0] = 0;
781 sortedoutarray[0] = 0;
782 }
783
784#endif
785 }
786}
787
789{
790 return m_timeStart;
791}
792} // 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:223
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.
SOLVER_UTILS_EXPORT int GetNpoints()
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.
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:74
std::map< std::string, int > m_variableMap
variables
Definition: FileSolution.h:87
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:85
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)
static std::string className
Name of class.
Definition: FileSolution.h:128
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:117
FileFieldInterpolatorSharedPtr m_solutionFile
Definition: FileSolution.h:179
void UpdateField(NekDouble time)
Array< OneD, Array< OneD, NekDouble > > m_coord
Definition: FileSolution.h:181
std::set< std::string > m_variableFile
Definition: FileSolution.h:180
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)
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:182
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.
Base class for unsteady solvers.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
DNekMatSharedPtr GetStdMatrix(const StdMatrixKey &mkey)
Definition: StdExpansion.h:612
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
Definition: StdExpansion.h:370
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