Nektar++
Loading...
Searching...
No Matches
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
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
226 // Update time in field info if required
227 if (m_fieldMetaDataMap.find("Time") != m_fieldMetaDataMap.end())
228 {
229 m_fieldMetaDataMap["Time"] = boost::lexical_cast<std::string>(m_time);
230 }
231
232 if (dumpInitialConditions && m_checksteps && m_nchk == 0)
233 {
235 }
236 ++m_nchk;
237}
238
240{
241 for (int i = 0; i < m_fields.size(); ++i)
242 {
243 std::string var = m_session->GetVariable(i);
244 if (m_solutionFunction.count(var))
245 {
246 m_solutionFunction[var]->Evaluate(m_coord[0], m_coord[1],
247 m_coord[2], time,
248 m_fields[i]->UpdatePhys());
249 m_fields[i]->SetPhysState(true);
250 bool wavespace = m_fields[i]->GetWaveSpace();
251 m_fields[i]->SetWaveSpace(false);
252 m_fields[i]->FwdTransBndConstrained(m_fields[i]->GetPhys(),
253 m_fields[i]->UpdateCoeffs());
254 m_fields[i]->SetWaveSpace(wavespace);
255 }
256 else if (m_variableFile.count(var))
257 {
258 m_solutionFile->InterpolateField(var, m_fields[i]->UpdateCoeffs(),
259 time);
260 m_fields[i]->SetPhysState(true);
261 m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
262 m_fields[i]->UpdatePhys());
263 }
264 else
265 {
266 ASSERTL0(false, "solution not defined for variable " + var);
267 }
268 }
269}
270
272{
273 return false;
274}
275
277 [[maybe_unused]] const Array<OneD, const Array<OneD, NekDouble>> &physfield,
278 [[maybe_unused]] Array<OneD, NekDouble> &pressure)
279{
280}
281
283 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
284 Array<OneD, NekDouble> &density)
285{
286 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
287 {
288 if (m_session->GetVariable(i) == "rho")
289 {
290 int npoints = m_fields[i]->GetNpoints();
291 Vmath::Vcopy(npoints, physfield[i], 1, density, 1);
292 }
293 }
294 Vmath::Fill(m_fields[0]->GetNpoints(), 1., density, 1);
295}
296
298{
299 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
300 {
301 if (m_session->GetVariable(i) == "rho")
302 {
303 return false;
304 }
305 }
306 return true;
307}
308
310 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
312{
313 int npoints = m_fields[0]->GetNpoints();
314 if (boost::iequals(m_session->GetVariable(0), "u"))
315 {
316 // IncNavierStokesSolver
317 for (int i = 0; i < velocity.size(); ++i)
318 {
319 Vmath::Vcopy(npoints, physfield[i], 1, velocity[i], 1);
320 }
321 }
322 else if (boost::iequals(m_session->GetVariable(0), "rho") &&
323 boost::iequals(m_session->GetVariable(1), "rhou"))
324 {
325 // CompressibleFlowSolver
326 for (int i = 0; i < velocity.size(); ++i)
327 {
328 Vmath::Vdiv(npoints, physfield[i], 1, physfield[0], 1, velocity[i],
329 1);
330 }
331 }
332 else
333 {
334 // Unknown
335 ASSERTL0(false, "Could not identify velocity for ProcessVorticity");
336 }
337}
338
340 const std::string functionName,
343 std::set<std::string> &variables, std::map<std::string, int> &series,
344 std::map<std::string, NekDouble> &times)
345{
346 m_session = pSession;
347 for (size_t i = 0; i < m_session->GetVariables().size(); ++i)
348 {
349 std::string var = m_session->GetVariable(i);
350 if (variables.count(var))
351 {
352 ASSERTL0(m_session->DefinesFunction(functionName, var) &&
353 (m_session->GetFunctionType(functionName, var) ==
355 functionName + "(" + var + ") is not defined as a file.");
356 m_variableMap[var] = i;
357 }
358 }
359
360 if (series.count("start"))
361 {
362 m_start = series["start"];
363 }
364 else
365 {
366 m_start = 0;
367 }
368
369 if (series.count("skip"))
370 {
371 m_skip = series["skip"];
372 }
373 else
374 {
375 m_skip = 1;
376 }
377
378 if (series.count("slices"))
379 {
380 m_slices = series["slices"];
381 }
382 else
383 {
384 m_slices = 1;
385 }
386
387 if (series.count("order"))
388 {
389 m_interporder = series["order"];
390 }
391 else
392 {
393 m_interporder = 0;
394 }
395
396 if (series.count("isperiodic"))
397 {
398 m_isperiodic = series["isperiodic"];
399 }
400 else
401 {
402 m_isperiodic = 1;
403 }
404
405 bool timefromfile = false;
406 if (times.count("period"))
407 {
408 m_period = times["period"];
409 }
410 else if (m_slices > 1)
411 {
412 timefromfile = true;
413 }
414 if (times.count("start"))
415 {
416 m_timeStart = times["start"];
417 }
418 else
419 {
420 m_timeStart = 0.;
421 }
422
423 if (m_session->GetComm()->GetRank() == 0)
424 {
425 std::cout << "baseflow info : interpolation order " << m_interporder
426 << ", period " << m_period << ", periodicity ";
427 if (m_isperiodic)
428 {
429 std::cout << "yes\n";
430 }
431 else
432 {
433 std::cout << "no\n";
434 }
435 std::cout << "baseflow info : files from " << m_start << " to "
436 << (m_start + (m_slices - 1) * m_skip) << " (skip " << m_skip
437 << ") with " << (m_slices - (m_interporder > 1))
438 << " time intervals" << std::endl;
439 }
440
441 std::string file = m_session->GetFunctionFilename("Solution", 0);
442 DFT(file, pFields, timefromfile);
443}
444
445/**
446 * Import field from infile and load into \a m_fields. This routine will
447 * also perform a \a BwdTrans to ensure data is in both the physical and
448 * coefficient storage.
449 * @param pInFile Filename to read.
450 * @param pFields Array of expansion lists
451 */
453 std::string pInfile,
455 int pSlice, std::map<std::string, NekDouble> &params)
456{
457 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
458 std::vector<std::vector<NekDouble>> FieldData;
459
460 int numexp = pFields[0]->GetExpSize();
461 Array<OneD, int> ElementGIDs(numexp);
462
463 // Define list of global element ids
464 for (int i = 0; i < numexp; ++i)
465 {
466 ElementGIDs[i] = pFields[0]->GetExp(i)->GetGeom()->GetGlobalID();
467 }
468
469 // Get Homogeneous
472 fld->Import(pInfile, FieldDef, FieldData,
474
475 int nFileVar = FieldDef[0]->m_fields.size();
476 for (int j = 0; j < nFileVar; ++j)
477 {
478 std::string var = FieldDef[0]->m_fields[j];
479 if (!m_variableMap.count(var))
480 {
481 continue;
482 }
483 int ncoeffs = pFields[m_variableMap[var]]->GetNcoeffs();
484 Array<OneD, NekDouble> tmp_coeff(ncoeffs, 0.);
485 for (int i = 0; i < FieldDef.size(); ++i)
486 {
487 pFields[m_variableMap[var]]->ExtractDataToCoeffs(
488 FieldDef[i], FieldData[i], FieldDef[i]->m_fields[j], tmp_coeff);
489 }
490 Vmath::Vcopy(ncoeffs, &tmp_coeff[0], 1,
491 &m_interp[m_variableMap[var]][pSlice * ncoeffs], 1);
492 }
493
494 LibUtilities::FieldMetaDataMap fieldMetaDataMap;
495 fld->ImportFieldMetaData(pInfile, fieldMetaDataMap);
496 // check to see if time defined
497 if (fieldMetaDataMap != LibUtilities::NullFieldMetaDataMap)
498 {
499 auto iter = fieldMetaDataMap.find("Time");
500 if (iter != fieldMetaDataMap.end())
501 {
502 params["time"] = std::stod(iter->second);
503 }
504 }
505}
506
507void FileFieldInterpolator::InterpolateField(const std::string variable,
508 Array<OneD, NekDouble> &outarray,
509 const NekDouble time)
510{
511 if (!m_variableMap.count(variable))
512 {
513 return;
514 }
515 InterpolateField(m_variableMap[variable], outarray, time);
516}
517
519 Array<OneD, NekDouble> &outarray,
520 NekDouble time)
521{
522 // doesnot have this variable
523 if (!m_interp.count(v))
524 {
525 return;
526 }
527 // one slice, steady solution
528 int npoints = m_interp[v].size() / m_slices;
529 if (m_slices == 1)
530 {
531 Vmath::Vcopy(npoints, &m_interp[v][0], 1, &outarray[0], 1);
532 return;
533 }
534 // unsteady solution
535 time -= m_timeStart;
536 if (m_isperiodic && time > m_period)
537 {
538 time = fmod(time, m_period);
539 if (time < 0.)
540 {
541 time += m_period;
542 }
543 }
544 if (m_interporder < 1)
545 {
546 NekDouble BetaT = 2 * M_PI * fmod(time, m_period) / m_period;
547 NekDouble phase;
548 Array<OneD, NekDouble> auxiliary(npoints);
549
550 Vmath::Vcopy(npoints, &m_interp[v][0], 1, &outarray[0], 1);
551 Vmath::Svtvp(npoints, cos(0.5 * m_slices * BetaT),
552 &m_interp[v][npoints], 1, &outarray[0], 1, &outarray[0],
553 1);
554
555 for (int i = 2; i < m_slices; i += 2)
556 {
557 phase = (i >> 1) * BetaT;
558
559 Vmath::Svtvp(npoints, cos(phase), &m_interp[v][i * npoints], 1,
560 &outarray[0], 1, &outarray[0], 1);
561 Vmath::Svtvp(npoints, -sin(phase), &m_interp[v][(i + 1) * npoints],
562 1, &outarray[0], 1, &outarray[0], 1);
563 }
564 }
565 else
566 {
567 NekDouble x = time;
568 x = x / m_period * (m_slices - 1);
569 int ix = x;
570 if (ix < 0)
571 {
572 ix = 0;
573 }
574 if (ix > m_slices - 2)
575 {
576 ix = m_slices - 2;
577 }
578 int padleft = std::max(0, m_interporder / 2 - 1);
579 if (padleft > ix)
580 {
581 padleft = ix;
582 }
583 int padright = m_interporder - 1 - padleft;
584 if (padright > m_slices - 1 - ix)
585 {
586 padright = m_slices - 1 - ix;
587 }
588 padleft = m_interporder - 1 - padright;
590 for (int i = 0; i < m_interporder; ++i)
591 {
592 for (int j = 0; j < m_interporder; ++j)
593 {
594 if (i != j)
595 {
596 coeff[i] *= (x - ix + padleft - (NekDouble)j) /
597 ((NekDouble)i - (NekDouble)j);
598 }
599 }
600 }
601 Vmath::Zero(npoints, &outarray[0], 1);
602 for (int i = ix - padleft; i < ix + padright + 1; ++i)
603 {
604 Vmath::Svtvp(npoints, coeff[i - ix + padleft],
605 &m_interp[v][i * npoints], 1, &outarray[0], 1,
606 &outarray[0], 1);
607 }
608 }
609}
610
612{
613 DNekMatSharedPtr loc_mat;
614 DNekBlkMatSharedPtr BlkMatrix;
615
616 Array<OneD, unsigned int> nrows(nexp);
617 Array<OneD, unsigned int> ncols(nexp);
618
619 nrows = Array<OneD, unsigned int>(nexp, m_slices);
620 ncols = Array<OneD, unsigned int>(nexp, m_slices);
621
622 MatrixStorage blkmatStorage = eDIAGONAL;
623 BlkMatrix = MemoryManager<DNekBlkMat>::AllocateSharedPtr(nrows, ncols,
624 blkmatStorage);
625
629 StdRegions::StdSegExp StdSeg(BK);
630
632 StdSeg.DetShapeType(), StdSeg);
633
634 loc_mat = StdSeg.GetStdMatrix(matkey);
635
636 // set up array of block matrices.
637 for (int i = 0; i < nexp; ++i)
638 {
639 BlkMatrix->SetBlock(i, i, loc_mat);
640 }
641
642 return BlkMatrix;
643}
644
645// Discrete Fourier Transform for Floquet analysis
647 const std::string file,
649 const bool timefromfile)
650{
651 for (auto it : m_variableMap)
652 {
653 int ncoeffs = pFields[it.second]->GetNcoeffs();
654 m_interp[it.second] = Array<OneD, NekDouble>(ncoeffs * m_slices, 0.0);
655 }
656
657 // Import the slides into auxiliary vector
658 // The base flow should be stored in the form "filename_%d.ext"
659 // A subdirectory can also be included, such as "dir/filename_%d.ext"
660 size_t found = file.find("%d");
661 std::map<std::string, NekDouble> params;
662 if (found != std::string::npos)
663 {
664 ASSERTL0(file.find("%d", found + 1) == std::string::npos,
665 "There are more than one '%d'.");
666 int nstart = m_start;
667 std::vector<NekDouble> times;
668 for (int i = 0; i < m_slices; ++i)
669 {
670 int filen = nstart + i * m_skip;
671 auto fmt = boost::format(file) % filen;
672 ImportFldBase(fmt.str(), pFields, i, params);
673 if (m_session->GetComm()->GetRank() == 0)
674 {
675 std::cout << "read base flow file " << fmt.str() << std::endl;
676 }
677 if (timefromfile && params.count("time"))
678 {
679 times.push_back(params["time"]);
680 }
681 }
682 if (timefromfile && times.size() == m_slices && m_slices > 1)
683 {
684 m_timeStart = times[0];
685 if (m_interporder < 1)
686 {
687 m_period = m_slices * (times[m_slices - 1] - times[0]) /
688 (m_slices - 1.);
689 }
690 else
691 {
692 m_period = times[m_slices - 1] - times[0];
693 }
694 }
695 }
696 else if (m_slices == 1)
697 {
698 ImportFldBase(file.c_str(), pFields, 0, params);
699 }
700 else
701 {
702 ASSERTL0(
703 false,
704 "Since N_slices is specified, the filename provided for function "
705 "'BaseFlow' must include exactly one instance of the format "
706 "specifier '%d', to index the time-slices.");
707 }
708
709 if (!m_isperiodic || m_slices == 1)
710 {
711 return;
712 }
713
714 // Discrete Fourier Transform of the fields
715 for (auto it : m_interp)
716 {
717 int npoints = pFields[it.first]->GetNcoeffs();
718#ifdef NEKTAR_USING_FFTW
719
720 // Discrete Fourier Transform using FFTW
721 Array<OneD, NekDouble> fft_in(npoints * m_slices);
722 Array<OneD, NekDouble> fft_out(npoints * m_slices);
723
726
727 // Shuffle the data
728 for (int j = 0; j < m_slices; ++j)
729 {
730 Vmath::Vcopy(npoints, &(it.second)[j * npoints], 1, &(fft_in[j]),
731 m_slices);
732 }
733
735 m_slices);
736
737 // FFT Transform
738 for (int i = 0; i < npoints; i++)
739 {
740 m_FFT->FFTFwdTrans(m_tmpIN = fft_in + i * m_slices,
741 m_tmpOUT = fft_out + i * m_slices);
742 }
743
744 // Reshuffle data
745 for (int s = 0; s < m_slices; ++s)
746 {
747 Vmath::Vcopy(npoints, &fft_out[s], m_slices,
748 &(it.second)[s * npoints], 1);
749 }
750
751 Vmath::Zero(fft_in.size(), &fft_in[0], 1);
752 Vmath::Zero(fft_out.size(), &fft_out[0], 1);
753#else
754 // Discrete Fourier Transform using MVM
755 DNekBlkMatSharedPtr blkmat;
756 blkmat = GetFloquetBlockMatrix(npoints);
757
758 int nrows = blkmat->GetRows();
759 int ncols = blkmat->GetColumns();
760
761 Array<OneD, NekDouble> sortedinarray(ncols);
762 Array<OneD, NekDouble> sortedoutarray(nrows);
763
764 // Shuffle the data
765 for (int j = 0; j < m_slices; ++j)
766 {
767 Vmath::Vcopy(npoints, &(it.second)[j * npoints], 1,
768 &(sortedinarray[j]), m_slices);
769 }
770
771 // Create NekVectors from the given data arrays
772 NekVector<NekDouble> in(ncols, sortedinarray, eWrapper);
773 NekVector<NekDouble> out(nrows, sortedoutarray, eWrapper);
774
775 // Perform matrix-vector multiply.
776 out = (*blkmat) * in;
777
778 // Reshuffle data
779 for (int s = 0; s < m_slices; ++s)
780 {
781 Vmath::Vcopy(npoints, &sortedoutarray[s], m_slices,
782 &(it.second)[s * npoints], 1);
783 }
784
785 for (int r = 0; r < sortedinarray.size(); ++r)
786 {
787 sortedinarray[0] = 0;
788 sortedoutarray[0] = 0;
789 }
790
791#endif
792 }
793}
794
799} // namespace Nektar::SolverUtils
#define ASSERTL0(condition, msg)
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 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.
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
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
std::map< std::string, int > m_variableMap
variables
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
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.
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.
FileFieldInterpolatorSharedPtr m_solutionFile
Array< OneD, Array< OneD, NekDouble > > m_coord
std::set< std::string > m_variableFile
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
Virtual function for initialisation implementation.
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
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)
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
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:224
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
std::shared_ptr< DNekMat > DNekMatSharedPtr
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