-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRadMom1DState_Third_Order.h
1422 lines (1202 loc) · 49.4 KB
/
RadMom1DState_Third_Order.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*!\file RadMom1DState_Third_Order.h
\brief Header file defining 1D RadMom Solution State Classes. */
#ifndef _RADMOM1D_STATE_THIRD_ORDER_INCLUDED
#define _RADMOM1D_STATE_THIRD_ORDER_INCLUDED
/* Include required C++ libraries. */
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstdlib>
#include <cstring>
/* Using std namespace functions */
using namespace std;
#ifndef _RADMOM1D_STATE_INCLUDED
#include "RadMom1DState.h"
#endif //_RADMOM1D_STATE_INCLUDED
/* Define some constants. */
#define STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER 4
/* Define additional structures. */
struct Eigenstructure_P3 {
double lambdas[STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER];
double rc_vec[STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER][STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER];
double lc_vec[STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER][STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER];
};
/* Define the classes. */
class RadMom1D_cState_Third_Order;
/*!
* Class: RadMom1D_cState_Third_Order
*
* @brief Primitive variable solution state class definition for radiative
* transfer.
*
* Primitive variable solution state class definition for radiative
* transfer
*
* \verbatim
* Member functions
* I0 -- Return radiative energy density (zeroth-order angular moment).
* N1x -- Return normalized radiative flux (first-order normalized angular moment).
* N2xx -- Return second-order normalized moment.
* N3xxx -- Return third-order normalized moment.
* fsca -- Return absolute normalized flux (scalar).
* f2 -- Return square of radiative flux (scalar).
* xi -- Return sqrt(4-3*fsca^2).
* chi -- Return Eddington factor (3+4*fsca^2)/(5+2*xi).
* U -- Return conserved solution state.
* Fx -- Return x-direction solution flux.
* dFxdU -- Return x-direction flux Jacobian.
* lambda_x -- Return x-direction eigenvalue(s).
* rp -- Return primitive right eigenvector (x-direction).
* rc -- Return conserved right eigenvector (x-direction).
* S -- Return source term vector.
* Sr -- Return radiative source term.
*
* Member operators
* W -- a primitive solution state
* b -- a scalar (double)
*
* W = W;
* c = W[i];
* W = W + W;
* W = W - W;
* c = W * W; (inner product)
* W = c * W;
* W = W * c;
* W = W / c;
* W = W ^ W; (a useful product)
* W = +W;
* W = -W;
* W += W;
* W -= W;
* W == W;
* W != W;
* cout << W; (output function)
* cin >> W; (input function)
* \endverbatim
*/
class RadMom1D_pState_Third_Order : public RadMom1D_pState<RadMom1D_cState_Third_Order, RadMom1D_pState_Third_Order>{
protected:
private:
public:
#ifdef STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER
double m_values[STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER];
#else
double* m_values;
#endif
//@{ @name constants:
static int NUM_VAR_RADMOM1D_THIRD_ORDER; //!< total number of RadMom1D state variables
//@}
//!
void Setup_Eigenstructure_P3(Eigenstructure_P3 &Eig_P3) const;
//@{ @name Creation, copy, and assignment constructors.
//! Creation constructor.
RadMom1D_pState_Third_Order(void) {
Nullify();
Allocate();
for ( int i = 0; i < STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER; i++ ){
m_values[i] = ZERO;
}
}
//! Copy constructor.
RadMom1D_pState_Third_Order(const RadMom1D_pState_Third_Order &W) {
Nullify();
Allocate();
for ( int i = 0; i < STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER; i++ ){
m_values[i] = W.m_values[i];
}
}
//! Assignment constructor.
RadMom1D_pState_Third_Order(const RadMom1D_cState_Third_Order &U);
//! Assignment constructor.
RadMom1D_pState_Third_Order(const double &den, const double &fx,
const double &p_xx, const double &q_xxx) {
Nullify();
Allocate();
m_values[0] = den;
m_values[1] = fx;
m_values[2] = p_xx;
m_values[3] = q_xxx;
}
//! Value Constructor
explicit RadMom1D_pState_Third_Order(const double &Val);
/* Destructor. */
~RadMom1D_pState_Third_Order(void) { Deallocate(); }
// Use automatically generated destructor.
//@}
//@{ @name Useful operators.
//! Return the number of variables.
static int StaticNumVar(void) { return STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER; }
static int NumVar(void) { return NUM_VAR_RADMOM1D_THIRD_ORDER; }
//! Copy operator.
void Copy(const RadMom1D_pState_Third_Order &W) {
RadMom1D_pState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order>::Copy(*this, W); // *this can be passed as non-const argument here because function is non-const
}
void Copy_to_W(RadMom1D_pState_Third_Order &W) const {
RadMom1D_pState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order>::Copy_to_W(W, *this); // *this can be passed as const argument here because function is const
}
//! Set array pointers to null
void Nullify();
//! Vacuum operator.
void Vacuum(void) {
RadMom1D_pState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order>::Vacuum(*this);
}
//! One operator. Set the solution to ONE.
void Ones(void) {
RadMom1D_pState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order>::Ones(*this);
}
double I0() const {return m_values[0];}
double N1x() const {return m_values[1];}
double N2xx() const {return m_values[2];}
double N3xxx() const {return m_values[3];}
double r_xxxx() const {return ((SIX/SEVEN)*N2xx()-(THREE/THIRTY_FIVE));}
//! Check for unphysical state properties.
int Unphysical_Properties(void) const {
return 0;
}
//@}
//@{ @name State functions.
//! Absolute flux (scalar).
double fsca() const;
//! Radiative flux squared (scalar).
double f2() const;
//@{ @name Conserved solution state.
double U(const int &index_U) const;
RadMom1D_cState_Third_Order U(void) const;
RadMom1D_cState_Third_Order U(const RadMom1D_pState_Third_Order &W);
friend RadMom1D_cState_Third_Order U(const RadMom1D_pState_Third_Order &W);
//@}
//@{ @name Solution flux and Jacobian (x-direction).
RadMom1D_cState_Third_Order Fx(void) const;
RadMom1D_cState_Third_Order Fx(const RadMom1D_pState_Third_Order &W);
friend RadMom1D_cState_Third_Order Fx(const RadMom1D_pState_Third_Order &W);
//@}
//@{ @name Eigenvalue(s) (x-direction).
RadMom1D_pState_Third_Order lambda_x(void) const;
RadMom1D_pState_Third_Order lambda_x(const RadMom1D_pState_Third_Order &W);
friend RadMom1D_pState_Third_Order lambda_x(const RadMom1D_pState_Third_Order &W);
friend double lambda_x(const RadMom1D_pState_Third_Order &W, int index);
RadMom1D_pState_Third_Order lambda_x(const double &V) const;
//@}
void Compute_Correction_Factor_Roe(double *Correction_Factor,
const RadMom1D_pState_Third_Order &Wl,
const RadMom1D_pState_Third_Order &Wr) const;
void Compute_Correction_Factor_Approximate_Jacobian_Roe(double A_Roe[][STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER]) const;
//@{ @name Conserved right eigenvector (x-direction).
double rc(const int &index_U, const int &j) const;
void rc(Eigenstructure_P3 &Eig_P3) const;
friend void rc(const RadMom1D_pState_Third_Order &W, Eigenstructure_P3 &Eig_P3);
//@}
//@{ @name Primitive right eigenvector (x-direction).
RadMom1D_pState_Third_Order rp(const int &index_U) const;
friend RadMom1D_pState_Third_Order rp(const RadMom1D_pState_Third_Order &W, const int &index_U);
//@}
//@{ @name Conserved left eigenvector (x-direction).
double lc(const int &index_U, const int &j) const;
void lc(Eigenstructure_P3 &Eig_P3) const;
friend void lc(const RadMom1D_pState_Third_Order &W, Eigenstructure_P3 &Eig_P3);
//@}
//@{ @name Primitive left eigenvector (x-direction).
RadMom1D_pState_Third_Order lp(const int &index_U) const;
friend RadMom1D_pState_Third_Order lp(const RadMom1D_pState_Third_Order &W, const int &index_U);
//@}
//@{ @name First order linear solution reconstruction
void Reconstruct( const RadMom1D_pState_Third_Order &Wc,
const RadMom1D_pState_Third_Order &phi,
const RadMom1D_pState_Third_Order &dWdx,
const double &dX);
//! memory allocation / deallocation for the I array
void Allocate();
void Deallocate();
//! Setup state static variables
//! memory allocation / deallocation for the static arrays
static void SetupStatic( const int &ScatteringFunc,
const int &i_Moment_Closure,
const int &i_AbsorptionModel);
static void DeallocateStatic();
void RoeAverage(const RadMom1D_pState_Third_Order &Wl,
const RadMom1D_pState_Third_Order &Wr);
void AverageStates(const RadMom1D_pState_Third_Order &Wl,
const RadMom1D_pState_Third_Order &Wr);
void Rotate(const double &norm_dir);
void Reflect(RadMom1D_pState_Third_Order W_inner,
const double &norm_dir);
void Characteristic(RadMom1D_pState_Third_Order W_inner,
const double &wall_temperature,
const double &wall_emissivity,
const double &norm_dir);
void PartialFlux_n(RadMom1D_pState_Third_Order W_inner,
const double &wall_temperature,
const double &wall_emissivity,
const double &norm_dir);
void Gray_Wall(RadMom1D_pState_Third_Order W_wall,
const double &wall_temperature,
const double &wall_emissivity,
const double &norm_dir);
void Marshak_n(RadMom1D_pState_Third_Order W_inner,
const double &wall_temperature,
const double &wall_emissivity,
const double &norm_dir);
void PartialMoments_n(RadMom1D_pState_Third_Order W_inner,
const double &wall_temperature,
const double &wall_emissivity,
const double &norm_dir);
//! Index operator.
double &operator[](int index) {
return W_index(*this, index);
}
const double &operator[](int index) const {
return W_index(*this, index);
}
//@{ @name Binary arithmetic operators.
RadMom1D_pState_Third_Order operator +(const RadMom1D_pState_Third_Order &W);
RadMom1D_pState_Third_Order operator -(const RadMom1D_pState_Third_Order &W);
RadMom1D_pState_Third_Order operator *(const double &b);
double operator *(const RadMom1D_pState_Third_Order &W);
friend RadMom1D_pState_Third_Order operator *(const double &b, const RadMom1D_pState_Third_Order &W);
RadMom1D_pState_Third_Order operator /(const double &b);
RadMom1D_pState_Third_Order operator /(const RadMom1D_pState_Third_Order &W);
RadMom1D_pState_Third_Order operator ^(const RadMom1D_pState_Third_Order &W);
/* Assignment operator. */
RadMom1D_pState_Third_Order &operator = (const RadMom1D_pState_Third_Order &W);
//@{ @name Shortcut arithmetic operators.
RadMom1D_pState_Third_Order &operator +=(const RadMom1D_pState_Third_Order &W);
RadMom1D_pState_Third_Order &operator -=(const RadMom1D_pState_Third_Order &W);
RadMom1D_pState_Third_Order &operator *=(const double &b);
RadMom1D_pState_Third_Order &operator *=(const RadMom1D_pState_Third_Order &W);
RadMom1D_pState_Third_Order &operator /=(const double &b);
RadMom1D_pState_Third_Order &operator /=(const RadMom1D_pState_Third_Order &W);
//@}
//@{ @name Input-output operators.
friend ostream &operator << (ostream &out_file, const RadMom1D_pState_Third_Order &W);
friend istream &operator >> (istream &in_file, RadMom1D_pState_Third_Order &W);
//@}
RadMom1D_pState_Third_Order U_to_W_Roe(const RadMom1D_cState_Third_Order &U) const;
RadMom1D_cState_Third_Order W_Roe_to_U(const RadMom1D_pState_Third_Order &W_Roe) const;
};
// end of RadMom1D_pState_Third_Order class
/*!
* Class: RadMom1D_cState_Third_Order
*
* @brief Conserved variable solution state class definition for radiative
* transfer.
*
* Conserved variable solution state class definition for radiative
* transfer.
* I0 -- Return radiative energy density (zeroth-order angular moment).
* I1x -- Return radiative flux (first-order angular moment).
* I2xx -- Return second-order moment.
* I3xxx -- Return third-order moment.
* fsca -- Return absolute normalized flux (scalar).
* f2 -- Return square of radiative flux (scalar).
* xi -- Return sqrt(4-3*fsca^2).
* chi -- Return (3+4*fsca^2)/(5+2*xi).
* k -- Return Boltzmann constant.
* h -- Return Planck's constant.
* c -- Return speed of light.
* a -- Return 8*pi^5*k^4/(15*h^3*c^3).
* W -- Return primitive solution state.
* Flux -- Return x-direction solution flux.
* Fx -- Return x-direction solution flux.
* dFxdU -- Return x-direction flux Jacobian.
* S -- Return source term vector.
* Sr -- Return radiative source term.
* Member operators
* U -- a primitive solution state
* b -- a scalar (double)
*
* U = U;
* c = U[i];
* U = U + U;
* U = U - U;
* c = U * U; (inner product)
* U = c * U;
* U = U * c;
* U = U / c;
* U = U ^ U; (a useful product)
* U = +U;
* U = -U;
* U += U;
* U -= U;
* U == U;
* U != U;
* cout << U; (output function)
* cin >> U; (input function)
* \endverbatim
*/
class RadMom1D_cState_Third_Order : public RadMom1D_cState<class RadMom1D_cState_Third_Order, class RadMom1D_pState_Third_Order> {
protected:
private:
public:
#ifdef STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER
double m_values[STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER];
#else
double* m_values;
#endif
//@{ @name constants:
static int NUM_VAR_RADMOM1D_THIRD_ORDER; //!< total number of RadMom1D state variables
//@}
//@{ @name Creation, copy, and assignment constructors.
//! Creation constructor.
RadMom1D_cState_Third_Order(void) {
Nullify();
Allocate();
for ( int i = 0; i < STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER; i++ ){
m_values[i] = ZERO;
}
}
//! Copy constructor.
RadMom1D_cState_Third_Order(const RadMom1D_cState_Third_Order &U) {
Nullify();
Allocate();
for ( int i = 0; i < STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER; i++ ){
m_values[i] = U.m_values[i];
}
}
//! Copy constructor.
RadMom1D_cState_Third_Order(const RadMom1D_pState_Third_Order &W);
//! Value Constructor
explicit RadMom1D_cState_Third_Order(const double &Val);
//! Assignment constructor.
RadMom1D_cState_Third_Order(const double &den, const double &Fx,
const double &P_xx, const double &Q_xxx) {
Nullify();
Allocate();
m_values[0] = den;
m_values[1] = Fx;
m_values[2] = P_xx;
m_values[3] = Q_xxx;
}
/* Destructor. */
~RadMom1D_cState_Third_Order(void) { Deallocate(); }
// Use automatically generated destructor.
//@}
//@{ @name Useful operators.
//! Return the number of variables.
static int StaticNumVar(void) { return STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER; }
static int NumVar(void) { return NUM_VAR_RADMOM1D_THIRD_ORDER; }
//! Copy operator.
void Copy(const RadMom1D_cState_Third_Order &U) {
RadMom1D_cState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order>::Copy(*this, U); // *this can be passed as non-const argument here because function is non-const
}
void Copy_to_U(RadMom1D_cState_Third_Order &U) const {
RadMom1D_cState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order>::Copy_to_U(U, *this); // *this can be passed as const argument here because function is const
}
//! Set array pointers to null
void Nullify();
//! Vacuum operator.
void Vacuum(void) {
RadMom1D_cState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order>::Vacuum(*this);
}
//! Ones operator.
void Ones(void) {
RadMom1D_cState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order>::Ones(*this);
}
double I0() const {return m_values[0];}
double I1x() const {return m_values[1];}
double I2xx() const {return m_values[2];}
double I3xxx() const {return m_values[3];}
double R_xxxx() const {return ((SIX/SEVEN)*I2xx()-(THREE/THIRTY_FIVE)*I0());}
//! Check for unphysical state properties.
int Unphysical_Properties() const {
return 0;
}
//@{ @name State functions.
//! Absolute radiative flux (scalar).
double fsca();
double fsca() const;
//! Square of radiative flux (scalar).
double f2();
double f2() const;
//@{ @name Primitive solution state.
RadMom1D_pState_Third_Order W(void) const;
RadMom1D_pState_Third_Order W(const RadMom1D_cState_Third_Order &U);
friend RadMom1D_pState_Third_Order W(const RadMom1D_cState_Third_Order &U);
//@}
//@{ @name Solution flux and Jacobian (x-direction).
RadMom1D_cState_Third_Order Fx(void) const;
RadMom1D_cState_Third_Order Fx(const RadMom1D_cState_Third_Order &U);
friend RadMom1D_cState_Third_Order Fx(const RadMom1D_cState_Third_Order &U);
//@}
//@{ @name Include all source vectors and Jacobians.
RadMom1D_cState_Third_Order S(const Medium1D_State &M );
double Sr(const Medium1D_State &M);
//! memory allocation / deallocation for the I array
void Allocate();
void Deallocate();
//! Setup state static variables
//! memory allocation / deallocation for the static arrays
static void SetupStatic( const int &ScatteringFunc,
const int &i_Moment_Closure,
const int &i_AbsorptionModel);
static void DeallocateStatic();
void Rotate(const double &norm_dir);
void Set_ICs(const double &Medium_Temperature);
void Set_ICs_Beam(const double &Medium_Temperature);
void Set_ICs_Intensity(const double &Ib_wall);
void Set_BCs(const double *Intensity, const double & norm_dir);
void Partial_Numerical_Flux(RadMom1D_pState_Third_Order W_inner,
const double &norm_dir);
//! Index operator.
double &operator[](int index) {
return U_index(*this, index);
}
const double &operator[](int index) const {
return U_index(*this, index);
}
//@{ @name Binary arithmetic operators.
RadMom1D_cState_Third_Order operator +(const RadMom1D_cState_Third_Order &U);
RadMom1D_cState_Third_Order operator -(const RadMom1D_cState_Third_Order &U);
RadMom1D_cState_Third_Order operator *(const double &b);
double operator *(const RadMom1D_cState_Third_Order &U);
friend RadMom1D_cState_Third_Order operator *(const double &b, const RadMom1D_cState_Third_Order &U);
RadMom1D_cState_Third_Order operator /(const double &b);
RadMom1D_cState_Third_Order operator /(const RadMom1D_cState_Third_Order &U);
RadMom1D_cState_Third_Order operator ^(const RadMom1D_cState_Third_Order &U);
/* Assignment operator. */
RadMom1D_cState_Third_Order &operator = (const RadMom1D_cState_Third_Order &U);
//@{ @name Shortcut arithmetic operators.
RadMom1D_cState_Third_Order &operator +=(const RadMom1D_cState_Third_Order &U);
RadMom1D_cState_Third_Order &operator -=(const RadMom1D_cState_Third_Order &U);
RadMom1D_cState_Third_Order &operator *=(const double &b);
RadMom1D_cState_Third_Order &operator *=(const RadMom1D_cState_Third_Order &U);
RadMom1D_cState_Third_Order &operator /=(const double &b);
RadMom1D_cState_Third_Order &operator /=(const RadMom1D_cState_Third_Order &U);
//@}
//@{ @name Input-output operators.
friend ostream &operator << (ostream &out_file, const RadMom1D_cState_Third_Order &U);
friend istream &operator >> (istream &in_file, RadMom1D_cState_Third_Order &U);
//@}
};
// End of RadMom1D_cState_Third_Order class
/****************************************************************//**
* RadMom1D_pState_Third_Order -- Binary arithmetic operators.
********************************************************************/
//! addition
inline RadMom1D_pState_Third_Order RadMom1D_pState_Third_Order :: operator +(const RadMom1D_pState_Third_Order &W) {
RadMom1D_pState_Third_Order W_temp(*this);
addition(W_temp, W);
return W_temp;
}
//! subtraction
inline RadMom1D_pState_Third_Order RadMom1D_pState_Third_Order :: operator -(const RadMom1D_pState_Third_Order &W) {
RadMom1D_pState_Third_Order W_temp(*this);
subtraction(W_temp, W);
return W_temp;
}
//! scalar multiplication
inline RadMom1D_pState_Third_Order RadMom1D_pState_Third_Order :: operator *(const double &b) {
RadMom1D_pState_Third_Order W_temp(*this);
multiplication(W_temp, b);
return W_temp;
}
inline RadMom1D_pState_Third_Order operator *(const double &b, const RadMom1D_pState_Third_Order &W) {
RadMom1D_pState_Third_Order W_tmp(W);
// Use class object U_tmp to access base class member function
W_tmp.multiplication(b,W_tmp);
return (W_tmp);
}
//! scalar division
inline RadMom1D_pState_Third_Order RadMom1D_pState_Third_Order :: operator /(const double &b) {
RadMom1D_pState_Third_Order W_temp(*this);
division(W_temp, b);
return W_temp;
}
//! solution state division operator
inline RadMom1D_pState_Third_Order RadMom1D_pState_Third_Order :: operator /(const RadMom1D_pState_Third_Order &W) {
RadMom1D_pState_Third_Order W_temp(*this);
division(W_temp, W);
return W_temp;
}
//! inner product
inline double RadMom1D_pState_Third_Order :: operator *(const RadMom1D_pState_Third_Order &W) {
return multiplication(*this, W);
}
//! solution state product operator
inline RadMom1D_pState_Third_Order RadMom1D_pState_Third_Order :: operator ^(const RadMom1D_pState_Third_Order &W) {
RadMom1D_pState_Third_Order W_temp(*this);
dot_product(W_temp, W);
return W_temp;
}
/****************************************************************//**
* RadMom1D_pState_Third_Order -- Assignment operator.
********************************************************************/
inline RadMom1D_pState_Third_Order& RadMom1D_pState_Third_Order :: operator =(const RadMom1D_pState_Third_Order &W) {
equals(*this, W);
return (*this);
}
/****************************************************************//**
* RadMom1D_pState_Third_Order -- Shortcut operators.
********************************************************************/
inline RadMom1D_pState_Third_Order& RadMom1D_pState_Third_Order :: operator +=(const RadMom1D_pState_Third_Order &W) {
plus_equal(*this, W);
return (*this);
}
inline RadMom1D_pState_Third_Order& RadMom1D_pState_Third_Order :: operator -=(const RadMom1D_pState_Third_Order &W) {
minus_equal(*this, W);
return (*this);
}
inline RadMom1D_pState_Third_Order& RadMom1D_pState_Third_Order::operator *=(const double &b) {
times_equal(*this, b);
return (*this);
}
inline RadMom1D_pState_Third_Order& RadMom1D_pState_Third_Order::operator *=(const RadMom1D_pState_Third_Order &W) {
times_equal(*this, W);
return (*this);
}
inline RadMom1D_pState_Third_Order& RadMom1D_pState_Third_Order::operator /=(const double &b) {
divide_equal(*this, b);
return (*this);
}
inline RadMom1D_pState_Third_Order& RadMom1D_pState_Third_Order::operator /=(const RadMom1D_pState_Third_Order &W) {
divide_equal(*this, W);
return (*this);
}
/********************************************************
* RadMom1D_pState_Third_Order -- Input-output operators. *
********************************************************/
inline ostream &operator << (ostream &out_file, const RadMom1D_pState_Third_Order &W) {
RadMom1D_pState_Third_Order W_temp;
W_temp.output(out_file, W);
return (out_file);
}
inline istream &operator >> (istream &in_file, RadMom1D_pState_Third_Order &W) {
W.input(in_file, W);
return (in_file);
}
/****************************************************************//**
* RadMom1D_cState_Third_Order -- Binary arithmetic operators.
********************************************************************/
//! addition
inline RadMom1D_cState_Third_Order RadMom1D_cState_Third_Order :: operator +(const RadMom1D_cState_Third_Order &U) {
RadMom1D_cState_Third_Order U_temp(*this);
addition(U_temp, U);
return U_temp;
}
//! subtraction
inline RadMom1D_cState_Third_Order RadMom1D_cState_Third_Order :: operator -(const RadMom1D_cState_Third_Order &U) {
RadMom1D_cState_Third_Order U_temp(*this);
subtraction(U_temp, U);
return U_temp;
}
//! scalar multiplication
inline RadMom1D_cState_Third_Order RadMom1D_cState_Third_Order :: operator *(const double &b) {
RadMom1D_cState_Third_Order U_temp(*this);
multiplication(U_temp, b);
return U_temp;
}
inline RadMom1D_cState_Third_Order operator *(const double &b, const RadMom1D_cState_Third_Order &U) {
RadMom1D_cState_Third_Order U_tmp(U);
// Use class object U_tmp to access base class member function
U_tmp.multiplication(b,U_tmp);
return U_tmp;
}
//! scalar division
inline RadMom1D_cState_Third_Order RadMom1D_cState_Third_Order :: operator /(const double &b) {
RadMom1D_cState_Third_Order U_temp(*this);
division(U_temp, b);
return U_temp;
}
//! solution state division operator
inline RadMom1D_cState_Third_Order RadMom1D_cState_Third_Order :: operator /(const RadMom1D_cState_Third_Order &U) {
RadMom1D_cState_Third_Order U_temp(*this);
division(U_temp, U);
return U_temp;
}
//! inner product
inline double RadMom1D_cState_Third_Order :: operator *(const RadMom1D_cState_Third_Order &U) {
return multiplication(*this, U);
}
//! solution state product operator
inline RadMom1D_cState_Third_Order RadMom1D_cState_Third_Order :: operator ^(const RadMom1D_cState_Third_Order &U) {
RadMom1D_cState_Third_Order U_temp(*this);
dot_product(U_temp, U);
return U_temp;
}
/****************************************************************//**
* RadMom1D_cState_Third_Order -- Assignment operator.
********************************************************************/
inline RadMom1D_cState_Third_Order& RadMom1D_cState_Third_Order :: operator =(const RadMom1D_cState_Third_Order &U) {
equals(*this, U);
return (*this);
}
/****************************************************************//**
* RadMom1D_cState_Third_Order -- Shortcut operators.
********************************************************************/
inline RadMom1D_cState_Third_Order& RadMom1D_cState_Third_Order :: operator +=(const RadMom1D_cState_Third_Order &U) {
plus_equal(*this, U);
return (*this);
}
inline RadMom1D_cState_Third_Order& RadMom1D_cState_Third_Order :: operator -=(const RadMom1D_cState_Third_Order &U) {
minus_equal(*this, U);
return (*this);
}
inline RadMom1D_cState_Third_Order& RadMom1D_cState_Third_Order::operator *=(const double &b) {
times_equal(*this, b);
return (*this);
}
inline RadMom1D_cState_Third_Order& RadMom1D_cState_Third_Order::operator *=(const RadMom1D_cState_Third_Order &U) {
times_equal(*this, U);
return (*this);
}
inline RadMom1D_cState_Third_Order& RadMom1D_cState_Third_Order::operator /=(const double &b) {
divide_equal(*this, b);
return (*this);
}
inline RadMom1D_cState_Third_Order& RadMom1D_cState_Third_Order::operator /=(const RadMom1D_cState_Third_Order &U) {
divide_equal(*this, U);
return (*this);
}
/********************************************************
* RadMom1D_cState_Third_Order -- Input-output operators. *
********************************************************/
inline ostream &operator << (ostream &out_file, const RadMom1D_cState_Third_Order &U) {
RadMom1D_cState_Third_Order U_temp;
U_temp.output(out_file, U);
return (out_file);
}
inline istream &operator >> (istream &in_file, RadMom1D_cState_Third_Order &U) {
U.input(in_file, U);
return (in_file);
}
/****************************************************************//**
* Set array pointers to null.
********************************************************************/
inline void RadMom1D_pState_Third_Order :: Nullify()
{
#ifndef STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER
m_values = NULL;
#endif
};
inline void RadMom1D_pState_Third_Order :: Allocate()
{
#ifndef STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER
// deallocate first
Deallocate();
// create the jagged array
if (NUM_VAR_RADMOM1D_THIRD_ORDER > 0) { m_values = new double[NUM_VAR_RADMOM1D_THIRD_ORDER]; }
#endif
}
inline void RadMom1D_pState_Third_Order :: Deallocate()
{
#ifndef STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER
if ( m_values != NULL ) { delete[] m_values; m_values = NULL; }
#endif
}
/****************************************************************//**
* Set array pointers to null.
********************************************************************/
inline void RadMom1D_cState_Third_Order :: Nullify()
{
#ifndef STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER
m_values = NULL;
#endif
};
inline void RadMom1D_cState_Third_Order :: Allocate()
{
#ifndef STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER
// deallocate first
Deallocate();
// create the jagged array
if (NUM_VAR_RADMOM1D_THIRD_ORDER > 0) { m_values = new double[NUM_VAR_RADMOM1D_THIRD_ORDER]; }
#endif
}
inline void RadMom1D_cState_Third_Order :: Deallocate()
{
#ifndef STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER
if ( m_values != NULL ) { delete[] m_values; m_values = NULL; }
#endif
}
/****************************************************************//**
* RadMom1D_pState_Third_Order :: Setting up static variables.
********************************************************************/
inline void RadMom1D_pState_Third_Order :: SetupStatic( const int &ScatteringFunc,
const int &i_Moment_Closure,
const int &i_AbsorptionModel)
{
// deallocate static vars first, just to be safe
DeallocateStatic();
NUM_VAR_RADMOM1D_THIRD_ORDER = STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER;
RadMom1D_pState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order> :: SetupStatic(ScatteringFunc,
i_Moment_Closure,
i_AbsorptionModel);
if (closure_type != MOMENT_CLOSURE_P3) {
cout << "Closure type not specified properly !!!!" << endl;
cout << "Should specify MOMENT_CLOSURE_P3" << endl;
exit(0);
}
}
inline void RadMom1D_pState_Third_Order :: DeallocateStatic()
{
}
/****************************************************************//**
* RadMom1D_cState_Third_Order :: Setting up static variables.
********************************************************************/
inline void RadMom1D_cState_Third_Order :: SetupStatic( const int &ScatteringFunc,
const int &i_Moment_Closure,
const int &i_AbsorptionModel)
{
// deallocate static vars first, just to be safe
DeallocateStatic();
NUM_VAR_RADMOM1D_THIRD_ORDER = STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER;
RadMom1D_pState<RadMom1D_cState_Third_Order,
RadMom1D_pState_Third_Order> :: SetupStatic(ScatteringFunc,
i_Moment_Closure,
i_AbsorptionModel);
if (closure_type != MOMENT_CLOSURE_P3) {
cout << "Closure type not specified properly !!!!" << endl;
cout << "Should specify MOMENT_CLOSURE_P3" << endl;
exit(0);
}
}
inline void RadMom1D_cState_Third_Order :: DeallocateStatic()
{
}
/********************************************
* RadMom1D_pState_Third_Order Value Constructor. *
*******************************************/
inline RadMom1D_pState_Third_Order::RadMom1D_pState_Third_Order(const double &Val){
for ( int i = 0; i < STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER; i++ ){
m_values[i] = Val;
}
}
/********************************************
* RadMom1D_cState_Third_Order Value Constructor. *
*******************************************/
inline RadMom1D_cState_Third_Order::RadMom1D_cState_Third_Order(const double &Val){
for ( int i = 0; i < STATIC_NUM_VAR_RADMOM1D_THIRD_ORDER; i++ ){
m_values[i] = Val;
}
}
/********************************************************
* RadMom1D_pState_Third_Order::fsca -- Absolute radiative flux. *
********************************************************/
inline double RadMom1D_pState_Third_Order::fsca() const {
return ( sqrt(f2()) );
}
/********************************************************
* RadMom1D_pState_Third_Order::f2 -- Square of radiative flux. *
********************************************************/
inline double RadMom1D_pState_Third_Order::f2() const {
return (sqr(N1x()));
}
/********************************************************
* RadMom1D_cState_Third_Order::fsca -- Absolute radiative flux. *
********************************************************/
inline double RadMom1D_cState_Third_Order::fsca() const {
return ( sqrt(f2()) );
}
/********************************************************
* RadMom1D_cState_Third_Order::f2 -- Square of radiative flux. *
********************************************************/
inline double RadMom1D_cState_Third_Order::f2() const {
return W().f2();
}
/********************************************************
* RadMom1D_pState_Third_Order::RadMom1D_pState_Third_Order -- Constructor. *
********************************************************/
inline RadMom1D_pState_Third_Order::RadMom1D_pState_Third_Order(const RadMom1D_cState_Third_Order &U) {
Nullify();
Allocate();
if (U.I0() == ZERO){
m_values[0] = ZERO;
m_values[1] = ZERO;
m_values[2] = ZERO;
m_values[3] = ZERO;
} else {
m_values[0] = U.I0();
m_values[1] = U.I1x()/U.I0();
m_values[2] = U.I2xx()/U.I0();
m_values[3] = U.I3xxx()/U.I0();
}
}
/********************************************************
* RadMom1D_pState_Third_Order::U -- Conserved solution state. * (Start adding closure_type here)
********************************************************/
inline RadMom1D_cState_Third_Order RadMom1D_pState_Third_Order::U(void) const {
return U_from_W(*this);
}
inline RadMom1D_cState_Third_Order RadMom1D_pState_Third_Order::U(const RadMom1D_pState_Third_Order &W) {
return W.U();
}
inline RadMom1D_cState_Third_Order U(const RadMom1D_pState_Third_Order &W) {