chombo-discharge
CD_CdrPlasmaImExSdcStorage.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_CdrPlasmaImExSdcStorage_H
13 #define CD_CdrPlasmaImExSdcStorage_H
14 
15 // Our includes
17 #include <CD_AmrMesh.H>
18 #include <CD_NamespaceHeader.H>
19 
20 namespace Physics {
21  namespace CdrPlasma {
22 
24  {
25  public:
26  CdrStorage();
27  CdrStorage(const RefCountedPtr<AmrMesh>& a_amr,
28  const std::string a_realm,
29  const phase::which_phase a_phase,
30  const int m_ncomp);
31  ~CdrStorage();
32 
33  void
34  allocateStorage(const int a_p);
35  void
36  deallocateStorage();
37 
39  getScratch()
40  {
41  return m_scratch;
42  }
44  getScratch2()
45  {
46  return m_scratch2;
47  }
49  getError()
50  {
51  return m_error;
52  }
54  getGradient()
55  {
56  return m_gradient;
57  }
59  getOld()
60  {
61  return m_old;
62  }
64  getScratchD()
65  {
66  return m_scratchD;
67  }
69  getDivF()
70  {
71  return m_divF;
72  }
73 
74  Vector<EBAMRCellData>&
75  getPhi()
76  {
77  return m_phi;
78  }
79  Vector<EBAMRCellData>&
80  getFAR()
81  {
82  return m_FAR;
83  }
84  Vector<EBAMRCellData>&
85  getFD()
86  {
87  return m_FD;
88  }
89  Vector<EBAMRCellData>&
90  getF()
91  {
92  return m_F;
93  }
94 
96  getEbScratch1()
97  {
98  return m_scratchIVs;
99  }
100  EBAMRIVData&
101  getEbScratchD()
102  {
103  return m_scratchIVD;
104  }
105  EBAMRIVData&
106  getEbState()
107  {
108  return m_scratchIV1;
109  }
110  EBAMRIVData&
111  getEbVelo()
112  {
113  return m_scratchIV2;
114  }
115  EBAMRIVData&
116  getEbFlux()
117  {
118  return m_scratchIV3;
119  }
120  EBAMRIVData&
121  getEbGrad()
122  {
123  return m_scratchIV4;
124  }
125 
126  EBAMRIFData&
127  getDomainState()
128  {
129  return m_scratchIF1;
130  }
131  EBAMRIFData&
132  getDomainVelo()
133  {
134  return m_scratchIF2;
135  }
136  EBAMRIFData&
137  getDomainFlux()
138  {
139  return m_scratchIF3;
140  }
141  EBAMRIFData&
142  getDomainGrad()
143  {
144  return m_scratchIF4;
145  }
146 
147  protected:
148  std::string m_realm;
149  RefCountedPtr<AmrMesh> m_amr; // Needed for allocation. Will allocate
150  phase::which_phase m_phase; // on this phase
151  int m_ncomp; // with this many components
152  int m_p; // IMEX_SDC order
153  bool m_subcycle; // Extra storage for subcycling
154 
155  EBAMRCellData m_scratch; // Scratch data
156  EBAMRCellData m_scratch2; // Scratch data
157  EBAMRCellData m_error; // Error estimator
158  EBAMRCellData m_gradient; // Storage for holding gradient
159  EBAMRCellData m_old; // "Old solution". Only used for subcycling
160  EBAMRCellData m_scratchD; // SpaceDim scratch storage
161  EBAMRCellData m_divF; // SpaceDim scratch storage
162 
163  Vector<EBAMRCellData> m_phi; // phi^k in the IMEX_SDC notation
164  Vector<EBAMRCellData> m_FAR; // FAR(phi^k) in the IMEX_SDC notation
165  Vector<EBAMRCellData> m_FD; // FD(phi^k) in the IMEX_SDC notation
166  Vector<EBAMRCellData> m_F; // F(phi^k) in the IMEX_SDC notation
167 
168  EBAMRIVData m_scratchIVs; // Scratch data
169  EBAMRIVData m_scratchIVD; // Scratch data
170  EBAMRIVData m_scratchIV1; // Scratch data
171  EBAMRIVData m_scratchIV2; // Scratch data
172  EBAMRIVData m_scratchIV3; // Scratch data
173  EBAMRIVData m_scratchIV4; // Scratch data
174 
175  EBAMRIFData m_scratchIF1; // Scratch data
176  EBAMRIFData m_scratchIF2; // Scratch data
177  EBAMRIFData m_scratchIF3; // Scratch data
178  EBAMRIFData m_scratchIF4; // Scratch data
179  };
180 
182  {
183  public:
184  FieldStorage();
185  FieldStorage(const RefCountedPtr<AmrMesh>& a_amr,
186  const std::string a_realm,
187  const phase::which_phase a_phase,
188  const int a_ncomp);
189  ~FieldStorage();
190 
191  void
192  allocateStorage(const int a_p);
193  void
194  deallocateStorage();
195 
197  getPrevious()
198  {
199  return m_previous;
200  }
202  getElectricFieldCell()
203  {
204  return m_E_cell;
205  }
207  getElectricFieldFace()
208  {
209  return m_E_face;
210  }
211  EBAMRIVData&
212  getElectricFieldEb()
213  {
214  return m_E_eb;
215  }
216  EBAMRIFData&
217  getElectricFieldDomain()
218  {
219  return m_E_dom;
220  }
221 
222  protected:
223  std::string m_realm;
224  RefCountedPtr<AmrMesh> m_amr; // Needed for allocation. Will allocate
225  phase::which_phase m_phase; // on this phase
226  int m_ncomp; // with this many components
227  int m_p; // IMEX_SDC order
228 
229  MFAMRCellData m_previous; // Solution at previous time step
230  EBAMRCellData m_E_cell; // Cell-centered E
231  EBAMRFluxData m_E_face; // Face-centered E
232  EBAMRIVData m_E_eb; // EB-centered E
233  EBAMRIFData m_E_dom; // E-field on domain faces
234  };
235 
237  {
238  public:
239  RtStorage();
240  RtStorage(const RefCountedPtr<AmrMesh>& a_amr,
241  const std::string a_realm,
242  const phase::which_phase a_phase,
243  const int a_ncomp);
244  ~RtStorage();
245 
246  void
247  allocateStorage(const int a_p);
248  void
249  deallocateStorage();
250 
252  getPrevious()
253  {
254  return m_previous;
255  }
256  EBAMRIVData&
257  getEbFlux()
258  {
259  return m_scratchIV;
260  }
261  EBAMRIFData&
262  getDomainFlux()
263  {
264  return m_scratchIF;
265  }
266 
267  protected:
268  std::string m_realm;
269  RefCountedPtr<AmrMesh> m_amr; // Needed for allocation. Will allocate
270  phase::which_phase m_phase; // on this phase
271  int m_ncomp; // with this many components
272  int m_p; // IMEX_SDC order
273 
274  EBAMRCellData m_previous; // Solution at previous time step
275  EBAMRIVData m_scratchIV; // Used for EB-centered isotropic density
276  EBAMRIFData m_scratchIF; // Used for domain-centered isotropic density
277  };
278 
280  {
281  public:
282  SigmaStorage();
283  SigmaStorage(const RefCountedPtr<AmrMesh>& a_amr,
284  const std::string a_realm,
285  const phase::which_phase a_phase,
286  const int a_ncomp);
287  ~SigmaStorage();
288 
289  void
290  allocateStorage(const int a_p);
291  void
292  deallocateStorage();
293 
294  EBAMRIVData&
295  getScratch()
296  {
297  return m_scratch;
298  }
299  EBAMRIVData&
300  getError()
301  {
302  return m_error;
303  }
304 
305  Vector<EBAMRIVData>&
306  getSigmaSolver()
307  {
308  return m_sigma;
309  }
310  Vector<EBAMRIVData>&
311  getFnew()
312  {
313  return m_Fnew;
314  }
315  Vector<EBAMRIVData>&
316  getFold()
317  {
318  return m_Fold;
319  }
320 
321  protected:
322  std::string m_realm;
323  RefCountedPtr<AmrMesh> m_amr; // Needed for allocation. Will allocate
324  phase::which_phase m_phase; // on this phase
325  int m_ncomp; // with this many components
326  int m_p; // IMEX_SDC order
327 
328  EBAMRIVData m_scratch; // Scratch data
329  EBAMRIVData m_error; // Error
330 
331  Vector<EBAMRIVData> m_sigma; // sigma^k in the IMEX_SDC notation
332  Vector<EBAMRIVData> m_Fnew; // New operator lsopes
333  Vector<EBAMRIVData> m_Fold; // Lagged operator slopes
334  };
335  } // namespace CdrPlasma
336 } // namespace Physics
337 
338 #include <CD_NamespaceFooter.H>
339 
340 #endif
Declaration of core class for handling AMR-related operations (with embedded boundaries)
Declaration of a semi-implicit spectral deferred correction class for Physics/CdrPlasma.
Definition: CD_CdrPlasmaImExSdcStorage.H:24
Definition: CD_CdrPlasmaImExSdcStorage.H:182
Definition: CD_CdrPlasmaImExSdcStorage.H:237
Definition: CD_CdrPlasmaImExSdcStorage.H:280
Name containing various physics models for running chombo-discharge code.
Definition: CD_AdvectionDiffusion.H:15