OSHUN  beta
Arbitrary Order Spherical-Harmonic 1D-3P Vlasov-Fokker-Planck-Maxwell code
Node_Communications Class Reference

#include <parallel.h>

Public Member Functions

 Node_Communications ()
 
 ~Node_Communications ()
 
int BNDX () const
 
void Send_right_X (State1D &Y, int dest)
 
void Recv_from_left_X (State1D &Y, int origin)
 
void Send_left_X (State1D &Y, int dest)
 
void Recv_from_right_X (State1D &Y, int origin)
 
void mirror_bound_Xleft (State1D &Y)
 
void mirror_bound_Xright (State1D &Y)
 
void sameNode_bound_X (State1D &Y)
 

Private Member Functions

void sameNode_periodic_X (State1D &Y)
 
void sameNode_mirror_X (State1D &Y)
 

Private Attributes

int Nbc
 
int bndX
 
int numspec
 
int numpmax
 
int msg_sizeX
 
complex< double > * msg_bufX
 

Detailed Description

Definition at line 81 of file parallel.h.

Constructor & Destructor Documentation

◆ Node_Communications()

Node_Communications::Node_Communications ( )

Definition at line 341 of file parallel.cpp.

References Input::List(), Input::Input_List::ls, Input::Input_List::ms, msg_bufX, msg_sizeX, Nbc, numspec, and Input::Input_List::ps.

341  :
342 //--------------------------------------------------------------
343 // Constructor
344 //--------------------------------------------------------------
345  Nbc(Input::List().BoundaryCells), // # of boundary cells
346  bndX(Input::List().bndX) { // Type of boundary in X
347 
348  numspec = Input::List().ls.size();
349  // numpmax = Input::List().ps;
350 
351  double temp;
352 
353  // # of harmonics
354  msg_sizeX = 0; temp = 0;
355  for(int s(0); s < numspec; ++s) {
356  temp = ((Input::List().ms[s]+1)*(2*Input::List().ls[s]-Input::List().ms[s]+2))/2;
357  msg_sizeX += temp*Input::List().ps[s];
358  }
359  // (# of harmonics) * (# cells in p)
360  // msg_sizeX *= numpmax
361  // 6 fields: Ex, Ey, Ez, Bx, By, Bz
362  msg_sizeX += 6;
363 
364  // 6 Hydro Quantities, density, vx, vy, vz, temp, Z
365  if (Input::List().hydromotion)
366  {
367  msg_sizeX += 6;
368  }
369 
370  msg_sizeX *= Nbc; //(IN().inp().y.dim()*Nbc);
371  msg_bufX = new complex<double>[msg_sizeX];
372 
373 }
complex< double > * msg_bufX
Definition: parallel.h:113
std::vector< size_t > ps
Definition: input.h:158
std::vector< size_t > ls
Definition: input.h:156
std::vector< size_t > ms
Definition: input.h:157
Input_List & List()
Definition: input.cpp:1585
Here is the call graph for this function:

◆ ~Node_Communications()

Node_Communications::~Node_Communications ( )

Definition at line 377 of file parallel.cpp.

References msg_bufX.

377  {
378 //--------------------------------------------------------------
379 // Destructor
380 //--------------------------------------------------------------
381  delete[] msg_bufX;
382 }
complex< double > * msg_bufX
Definition: parallel.h:113

Member Function Documentation

◆ BNDX()

int Node_Communications::BNDX ( ) const

Definition at line 386 of file parallel.cpp.

References bndX.

Referenced by sameNode_bound_X().

386 {return bndX;}
Here is the caller graph for this function:

◆ mirror_bound_Xleft()

void Node_Communications::mirror_bound_Xleft ( State1D Y)

Definition at line 701 of file parallel.cpp.

References EMF1D::Bx(), Hydro1D::density(), State1D::DF(), EMF1D::dim(), State1D::EMF(), EMF1D::Ey(), EMF1D::Ez(), State1D::FLD(), State1D::HYDRO(), Input::Input_List::hydromotion, DistFunc1D::l0(), Input::List(), DistFunc1D::m0(), Nbc, SHarmonic1D::nump(), SHarmonic1D::numx(), State1D::SH(), State1D::Species(), Hydro1D::temperature(), Hydro1D::vx(), and Hydro1D::Z().

Referenced by Parallel_Environment_1D::Neighbor_Communications().

701  {
702 //--------------------------------------------------------------
703 // Mirror boundary in the x direction on the left
704 //--------------------------------------------------------------
705  int sign(1);
706  size_t Nx(Y.SH(0,0,0).numx());
707 
708  // Mirror the harmonics
709  for(int s(0); s < Y.Species(); ++s) {
710  for(int l(0); l < Y.DF(s).l0(); ++l){
711  for(int m(0); m < ((Y.DF(s).m0() < l)? Y.DF(s).m0():l)+1; ++m){
712  sign = 1-2*((l+m)%2); //(-1)^(m+n)
713 
714  for (int c(0); c < Nbc; ++c) {
715  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
716  Y.SH(s,l,m)(p, c) = Y.SH(s,l,m)(p, 2*Nbc-c-1);
717  Y.SH(s,l,m)(p, c) *= sign;
718  }
719  }
720 
721  }
722  }
723  }
724 
725  // Mirror the fields
726  for(int i(0); i < Y.EMF().dim(); ++i){
727  for (int c(0); c < Nbc; ++c)
728  Y.FLD(i)(c) = Y.FLD(i)(2*Nbc-c-1);
729  }
730 
731  for (int c(0); c < Nbc; ++c) {
732 // Ey
733  Y.EMF().Ey()(c) *= -1.0; // left boundary
734 // Ez
735  Y.EMF().Ez()(c) *= -1.0; // left boundary
736 // Bx
737  Y.EMF().Bx()(c) *= -1.0; // left boundary
738 
739 // Y.EMF().By()(c) = 1e-3; // left boundary
740  }
741 
742  if (Input::List().hydromotion)
743  {
744  // Hydro Quantities: x0 "Right-Bound ---> Left-Guard"
745  for(int c(0); c < Nbc; c++) {
746  Y.HYDRO().density(c) = Y.HYDRO().density(2*Nbc-c-1);
747  Y.HYDRO().temperature(c) = Y.HYDRO().temperature(2*Nbc-c-1);
748  Y.HYDRO().Z(c) = Y.HYDRO().Z(2*Nbc-c-1);
749 
750  Y.HYDRO().vx(c) *= -1.0;
751  }
752  }
753 
754 
755 }
bool hydromotion
Definition: input.h:82
size_t dim() const
Definition: state.h:286
size_t numx() const
Definition: state.h:72
Field1D & Ez()
Definition: state.h:292
Field1D & Bx()
Definition: state.h:293
Hydro1D & HYDRO()
Definition: state.h:613
double & temperature(size_t i)
Definition: state.h:539
double & Z(size_t i)
Definition: state.h:542
size_t nump() const
Definition: state.h:71
size_t m0() const
Definition: state.h:397
DistFunc1D & DF(size_t s)
Definition: state.h:602
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
double & vx(size_t i)
Definition: state.h:530
Input_List & List()
Definition: input.cpp:1585
Field1D & FLD(size_t ip) const
Definition: state.h:611
double & density(size_t i)
Definition: state.h:527
Field1D & Ey()
Definition: state.h:291
size_t l0() const
Definition: state.h:396
size_t Species() const
Definition: state.h:596
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mirror_bound_Xright()

void Node_Communications::mirror_bound_Xright ( State1D Y)

Definition at line 759 of file parallel.cpp.

References EMF1D::Bx(), Hydro1D::density(), State1D::DF(), EMF1D::dim(), State1D::EMF(), EMF1D::Ex(), EMF1D::Ey(), EMF1D::Ez(), State1D::FLD(), State1D::HYDRO(), Input::Input_List::hydromotion, DistFunc1D::l0(), Input::List(), DistFunc1D::m0(), Nbc, SHarmonic1D::nump(), SHarmonic1D::numx(), Field1D::numx(), State1D::SH(), State1D::Species(), Hydro1D::temperature(), Hydro1D::vx(), and Hydro1D::Z().

Referenced by Parallel_Environment_1D::Neighbor_Communications().

759  {
760 //--------------------------------------------------------------
761 // Mirror boundary in the x direction on the right
762 //--------------------------------------------------------------
763  int sign(1);
764  size_t Nx(Y.SH(0,0,0).numx());
765 
766  // Mirror the harmonics
767  for(int s(0); s < Y.Species(); ++s) {
768  for(int l(0); l < Y.DF(s).l0(); ++l){
769  for(int m(0); m < ((Y.DF(s).m0() < l)? Y.DF(s).m0():l)+1; ++m){
770  sign = 1-2*((l+m)%2); //(-1)^(m+n)
771 
772  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
773  for (int c(0); c < Nbc; ++c) {
774  Y.SH(s,l,m)(p, Nx-c-1) = Y.SH(s,l,m)(p, Nx-2*Nbc+c);
775  Y.SH(s,l,m)(p, Nx-c-1) *= sign;
776  }
777  }
778 
779  }
780  }
781  }
782 
783  // Mirror the fields
784  for(int i(0); i < Y.EMF().dim(); ++i){
785  for (int c(0); c < Nbc; ++c)
786  Y.FLD(i)(Nx-c-1) = Y.FLD(i)(Nx-2*Nbc+c);
787  }
788 
789  for (int c(0); c < Nbc; ++c) {
790  //Ey
791  Y.EMF().Ey()(Nx-c-1) *= -1.0; // right boundary
792  //Ez
793  Y.EMF().Ez()(Nx-c-1) *= -1.0; // right boundary
794  //Bx
795  Y.EMF().Bx()(Nx-c-1) *= -1.0; // right boundary
796 
797 // Y.EMF().By()(Nx-c-1) = 1e-3; // right boundary
798  }
799 
800  if (Input::List().hydromotion)
801  {
802  // Hydro Quantities: x0 "Left-Bound ---> Right-Guard"
803  for(int c(0); c < Nbc; c++) {
804  Y.HYDRO().density(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().density(Y.EMF().Ex().numx()-2*Nbc+c);
805  Y.HYDRO().temperature(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().temperature(Y.EMF().Ex().numx()-2*Nbc+c);
806  Y.HYDRO().Z(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().Z(Y.EMF().Ex().numx()-2*Nbc+c);
807 
808 
809  Y.HYDRO().vx(Y.EMF().Ex().numx()-Nbc+c) *= -1.0;
810  }
811  }
812 
813 }
size_t numx() const
Definition: state.h:197
bool hydromotion
Definition: input.h:82
size_t dim() const
Definition: state.h:286
size_t numx() const
Definition: state.h:72
Field1D & Ez()
Definition: state.h:292
Field1D & Bx()
Definition: state.h:293
Hydro1D & HYDRO()
Definition: state.h:613
double & temperature(size_t i)
Definition: state.h:539
double & Z(size_t i)
Definition: state.h:542
size_t nump() const
Definition: state.h:71
size_t m0() const
Definition: state.h:397
DistFunc1D & DF(size_t s)
Definition: state.h:602
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
Field1D & Ex()
Definition: state.h:290
double & vx(size_t i)
Definition: state.h:530
Input_List & List()
Definition: input.cpp:1585
Field1D & FLD(size_t ip) const
Definition: state.h:611
double & density(size_t i)
Definition: state.h:527
Field1D & Ey()
Definition: state.h:291
size_t l0() const
Definition: state.h:396
size_t Species() const
Definition: state.h:596
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Recv_from_left_X()

void Node_Communications::Recv_from_left_X ( State1D Y,
int  origin 
)

Definition at line 465 of file parallel.cpp.

References Hydro1D::density(), State1D::DF(), EMF1D::dim(), DistFunc1D::dim(), State1D::EMF(), State1D::FLD(), State1D::HYDRO(), Input::Input_List::hydromotion, Input::List(), msg_bufX, msg_sizeX, Nbc, SHarmonic1D::nump(), State1D::SH(), State1D::Species(), Hydro1D::temperature(), Hydro1D::vx(), Hydro1D::vy(), Hydro1D::vz(), and Hydro1D::Z().

Referenced by Parallel_Environment_1D::Neighbor_Communications().

465  {
466 //--------------------------------------------------------------
467 // X-axis : Receive data from the node on the left and update
468 // the left guard cells
469 //--------------------------------------------------------------
470 
471  // static size_t step_h(Y.SH(s,0,0).nump()*Nbc);
472  static size_t step_f(Nbc);
473  size_t bufind(0);
474  MPI_Status status;
475 
476  // Receive Data
477  MPI_Recv(msg_bufX, msg_sizeX, MPI_DOUBLE_COMPLEX, origin, 0, MPI_COMM_WORLD, &status);
478 
479  // Harmonics:x0-"---> Left-Guard"
480  for(int s(0); s < Y.Species(); ++s) {
481  for(int i = 0; i < Y.DF(s).dim(); ++i){
482  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
483  for(int e(0); e < Nbc; e++) {
484  (Y.DF(s)(i))(p, e) = msg_bufX[bufind + e];
485  }
486  bufind += step_f;
487  }
488  }
489  }
490 
491 
492  // Fields: x0-"---> Left-Guard"
493  for(int i = 0; i < Y.EMF().dim(); ++i){
494  for(int e(0); e < Nbc; e++) {
495  Y.FLD(i)(e) = msg_bufX[bufind + e];
496  }
497  bufind += step_f;
498  }
499 
500  if (Input::List().hydromotion)
501  {
502  // Hydro-velocity: x0-"---> Left-Guard"
503  for(int e(0); e < Nbc; e++) {
504  Y.HYDRO().density(e) = (msg_bufX[bufind + e]).real();
505  }
506  bufind += step_f;
507 
508  // Hydro-velocity: x0-"---> Left-Guard"
509  for(int e(0); e < Nbc; e++) {
510  Y.HYDRO().vx(e) = (msg_bufX[bufind + e]).real();
511  }
512  bufind += step_f;
513 
514  // Hydro-velocity: x0-"---> Left-Guard"
515  for(int e(0); e < Nbc; e++) {
516  Y.HYDRO().vy(e) = (msg_bufX[bufind + e]).real();
517  }
518  bufind += step_f;
519 
520  // Hydro-velocity: x0-"---> Left-Guard"
521  for(int e(0); e < Nbc; e++) {
522  Y.HYDRO().vz(e) = (msg_bufX[bufind + e]).real();
523  }
524  bufind += step_f;
525 
526  // Hydro-temperature: x0-"---> Left-Guard"
527  for(int e(0); e < Nbc; e++) {
528  Y.HYDRO().temperature(e) = (msg_bufX[bufind + e]).real();
529  }
530  bufind += step_f;
531 
532  // Hydro-charge fraction: x0-"---> Left-Guard"
533  for(int e(0); e < Nbc; e++) {
534  Y.HYDRO().Z(e) = (msg_bufX[bufind + e]).real();
535  }
536  bufind += step_f;
537  }
538 
539 
540 }
complex< double > * msg_bufX
Definition: parallel.h:113
bool hydromotion
Definition: input.h:82
size_t dim() const
Definition: state.h:286
double & vz(size_t i)
Definition: state.h:536
size_t dim() const
Definition: state.h:395
Hydro1D & HYDRO()
Definition: state.h:613
double & temperature(size_t i)
Definition: state.h:539
double & Z(size_t i)
Definition: state.h:542
size_t nump() const
Definition: state.h:71
DistFunc1D & DF(size_t s)
Definition: state.h:602
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
double & vx(size_t i)
Definition: state.h:530
Input_List & List()
Definition: input.cpp:1585
Field1D & FLD(size_t ip) const
Definition: state.h:611
double & density(size_t i)
Definition: state.h:527
double & vy(size_t i)
Definition: state.h:533
size_t Species() const
Definition: state.h:596
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Recv_from_right_X()

void Node_Communications::Recv_from_right_X ( State1D Y,
int  origin 
)

Definition at line 616 of file parallel.cpp.

References Hydro1D::density(), State1D::DF(), EMF1D::dim(), DistFunc1D::dim(), State1D::EMF(), State1D::FLD(), State1D::HYDRO(), Input::Input_List::hydromotion, Input::List(), msg_bufX, msg_sizeX, Nbc, SHarmonic1D::nump(), Field1D::numx(), State1D::SH(), State1D::Species(), Hydro1D::temperature(), Hydro1D::vx(), Hydro1D::vy(), Hydro1D::vz(), and Hydro1D::Z().

Referenced by Parallel_Environment_1D::Neighbor_Communications().

616  {
617 //--------------------------------------------------------------
618 // X-axis : Receive data from the node on the right and update
619 // the right guard cells
620 //--------------------------------------------------------------
621 
622  // static size_t step_h(Y.SH(s,0,0).nump()*Nbc);
623  static size_t step_f(Nbc);
624  size_t bufind(0);
625  MPI_Status status;
626 
627  // Receive Data
628  MPI_Recv(msg_bufX, msg_sizeX, MPI_DOUBLE_COMPLEX, origin, 1, MPI_COMM_WORLD, &status);
629 
630  // Harmonics:x0-"Right-Guard <--- "
631  for(int s(0); s < Y.Species(); ++s) {
632  for(int i = 0; i < Y.DF(s).dim(); ++i){
633  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
634  for(int e(0); e < Nbc; e++) {
635  (Y.DF(s)(i))(p, Y.FLD(0).numx()-Nbc+e) = msg_bufX[bufind + e];
636  }
637  bufind += step_f;
638  }
639  }
640  }
641  // Fields: x0-"Right-Guard <--- "
642  for(int i = 0; i < Y.EMF().dim(); ++i){
643  for(int e(0); e < Nbc; e++) {
644  Y.FLD(i)(Y.FLD(0).numx()-Nbc+e) = msg_bufX[bufind + e];
645  }
646  bufind += step_f;
647  }
648 
649  if (Input::List().hydromotion)
650  {
651  // Hydro-density: x0-"Right-Guard <--- "
652  for(int e(0); e < Nbc; e++) {
653  Y.HYDRO().density(Y.FLD(0).numx()-Nbc+e) = (msg_bufX[bufind + e]).real();
654  }
655  bufind += step_f;
656 
657  // Hydro-velocity: x0-"Right-Guard <--- "
658  for(int e(0); e < Nbc; e++) {
659  Y.HYDRO().vx(Y.FLD(0).numx()-Nbc+e) = (msg_bufX[bufind + e]).real();
660  }
661  bufind += step_f;
662 
663  // Hydro-velocity: x0-"Right-Guard <--- "
664  for(int e(0); e < Nbc; e++) {
665  Y.HYDRO().vy(Y.FLD(0).numx()-Nbc+e) = (msg_bufX[bufind + e]).real();
666  }
667  bufind += step_f;
668 
669  // Hydro-velocity: x0-"Right-Guard <--- "
670  for(int e(0); e < Nbc; e++) {
671  Y.HYDRO().vz(Y.FLD(0).numx()-Nbc+e) = (msg_bufX[bufind + e]).real();
672  }
673  bufind += step_f;
674 
675  // Hydro-temperature: x0-"Right-Guard <--- "
676  for(int e(0); e < Nbc; e++) {
677  Y.HYDRO().temperature(Y.FLD(0).numx()-Nbc+e) = (msg_bufX[bufind + e]).real();
678  }
679  bufind += step_f;
680 
681  // Hydro-charge fraction: x0-"Right-Guard <--- "
682  for(int e(0); e < Nbc; e++) {
683  Y.HYDRO().Z(Y.FLD(0).numx()-Nbc+e) = (msg_bufX[bufind + e]).real();
684  }
685  bufind += step_f;
686  }
687 
688 }
size_t numx() const
Definition: state.h:197
complex< double > * msg_bufX
Definition: parallel.h:113
bool hydromotion
Definition: input.h:82
size_t dim() const
Definition: state.h:286
double & vz(size_t i)
Definition: state.h:536
size_t dim() const
Definition: state.h:395
Hydro1D & HYDRO()
Definition: state.h:613
double & temperature(size_t i)
Definition: state.h:539
double & Z(size_t i)
Definition: state.h:542
size_t nump() const
Definition: state.h:71
DistFunc1D & DF(size_t s)
Definition: state.h:602
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
double & vx(size_t i)
Definition: state.h:530
Input_List & List()
Definition: input.cpp:1585
Field1D & FLD(size_t ip) const
Definition: state.h:611
double & density(size_t i)
Definition: state.h:527
double & vy(size_t i)
Definition: state.h:533
size_t Species() const
Definition: state.h:596
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameNode_bound_X()

void Node_Communications::sameNode_bound_X ( State1D Y)

Definition at line 821 of file parallel.cpp.

References BNDX(), sameNode_mirror_X(), and sameNode_periodic_X().

Referenced by Parallel_Environment_1D::Neighbor_Communications().

821  {
822 //--------------------------------------------------------------
823 // Choose between boundary conditions in the x direction
824 //--------------------------------------------------------------
825 
826  switch (BNDX()) {
827  case 0: // periodic
829 
830  break;
831  case 1: // mirror boundary
833  break;
834  default:
835  cout<<"Not a valid boundary condition." << endl;
836  break;
837  }
838 }
void sameNode_periodic_X(State1D &Y)
Definition: parallel.cpp:842
int BNDX() const
Definition: parallel.cpp:386
void sameNode_mirror_X(State1D &Y)
Definition: parallel.cpp:938
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameNode_mirror_X()

void Node_Communications::sameNode_mirror_X ( State1D Y)
private

Definition at line 938 of file parallel.cpp.

References EMF1D::Bx(), State1D::DF(), EMF1D::dim(), State1D::EMF(), EMF1D::Ex(), EMF1D::Ey(), EMF1D::Ez(), State1D::FLD(), State1D::HYDRO(), Input::Input_List::hydromotion, DistFunc1D::l0(), Input::List(), DistFunc1D::m0(), Nbc, SHarmonic1D::nump(), SHarmonic1D::numx(), Field1D::numx(), State1D::SH(), State1D::Species(), and Hydro1D::vx().

Referenced by sameNode_bound_X().

938  {
939 //--------------------------------------------------------------
940 // Mirror boundary in the x direction for 1 node
941 //--------------------------------------------------------------
942  int sign(1);
943  size_t Nx(Y.SH(0,0,0).numx());
944 
945  // Mirror the harmonics
946  for(int s(0); s < Y.Species(); ++s) {
947  for(int l(0); l < Y.DF(s).l0(); ++l){
948  for(int m(0); m < ((Y.DF(s).m0() < l)? Y.DF(s).m0():l)+1; ++m){
949  sign = 1-2*((l+m)%2); //(-1)^(m+n)
950 
951  // right boundary
952  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
953  for (int c(0); c < Nbc; ++c) {
954  Y.SH(s,l,m)(p, Nx-c-1) = Y.SH(s,l,m)(p, Nx-2*Nbc+c);
955  Y.SH(s,l,m)(p, Nx-c-1) *= sign;
956  }
957  }
958 
959  // left boundary
960  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
961  for (int c(0); c < Nbc; ++c) {
962  Y.SH(s,l,m)(p, c) = Y.SH(s,l,m)(p, 2*Nbc-c-1);
963  Y.SH(s,l,m)(p, c) *= sign;
964  }
965  }
966 
967  }
968  }
969  }
970 
971  // Mirror the fields
972  for(int i(0); i < Y.EMF().dim(); ++i){
973  // right boundary
974  for (int c(0); c < Nbc; ++c)
975  Y.FLD(i)(Nx-c-1) = Y.FLD(i)(Nx-2*Nbc+c);
976  // left boundary
977  for (int c(0); c < Nbc; ++c)
978  Y.FLD(i)(c) = Y.FLD(i)(2*Nbc-c-1);
979  }
980 
981  for(int c(0); c < Nbc; c++) {
982  //Ey
983  Y.EMF().Ey()(Nx-Nbc+c) *= -1.0; // right boundary
984  Y.EMF().Ey()(c) *= -1.0; // left boundary
985 
986  //Ez
987  Y.EMF().Ez()(Nx-Nbc+c) *= -1.0; // right boundary
988  Y.EMF().Ez()(c) *= -1.0; // left boundary
989 
990  //Bx
991  Y.EMF().Bx()(Nx-Nbc+c) *= -1.0; // right boundary
992  Y.EMF().Bx()(c) *= -1.0; // left boundary
993  }
994 
995 
996  if (Input::List().hydromotion)
997  {
998  // Hydro Quantities: x0 "Right-Bound ---> Left-Guard"
999  for(int c(0); c < Nbc; c++) {
1000  Y.HYDRO().vx(c) *= -1.0;
1001  }
1002 
1003  // Hydro Quantities: x0 "Left-Bound ---> Right-Guard"
1004  for(int c(0); c < Nbc; c++) {
1005  Y.HYDRO().vx(Y.EMF().Ex().numx()-Nbc+c) *= -1.0;
1006 
1007 
1008  }
1009  }
1010 
1011 }
size_t numx() const
Definition: state.h:197
bool hydromotion
Definition: input.h:82
size_t dim() const
Definition: state.h:286
size_t numx() const
Definition: state.h:72
Field1D & Ez()
Definition: state.h:292
Field1D & Bx()
Definition: state.h:293
Hydro1D & HYDRO()
Definition: state.h:613
size_t nump() const
Definition: state.h:71
size_t m0() const
Definition: state.h:397
DistFunc1D & DF(size_t s)
Definition: state.h:602
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
Field1D & Ex()
Definition: state.h:290
double & vx(size_t i)
Definition: state.h:530
Input_List & List()
Definition: input.cpp:1585
Field1D & FLD(size_t ip) const
Definition: state.h:611
Field1D & Ey()
Definition: state.h:291
size_t l0() const
Definition: state.h:396
size_t Species() const
Definition: state.h:596
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sameNode_periodic_X()

void Node_Communications::sameNode_periodic_X ( State1D Y)
private

Definition at line 842 of file parallel.cpp.

References Hydro1D::density(), State1D::DF(), EMF1D::dim(), DistFunc1D::dim(), State1D::EMF(), EMF1D::Ex(), State1D::FLD(), State1D::HYDRO(), Input::Input_List::hydromotion, Input::List(), Nbc, SHarmonic1D::nump(), Field1D::numx(), State1D::SH(), State1D::Species(), Hydro1D::temperature(), Hydro1D::vx(), Hydro1D::vy(), Hydro1D::vz(), and Hydro1D::Z().

Referenced by sameNode_bound_X().

842  {
843 //--------------------------------------------------------------
844 // Periodic boundary in the x direction for 1 node
845 //--------------------------------------------------------------
846 
847  // Harmonics:x0 "Right-Bound ---> Left-Guard"
848  for(int s(0); s < Y.Species(); ++s) {
849  for(int i(0); i < Y.DF(s).dim(); ++i) {
850  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
851  for(int c(0); c < Nbc; c++) {
852  (Y.DF(s)(i))(p, c) = (Y.DF(s)(i))(p, Y.EMF().Ex().numx()-2*Nbc+c);
853  // std::cout << "\n 1: DF(" << i << "," << p << "," << c << ") = " << (Y.DF(s)(i))(p, Y.EMF().Ex().numx()-2*Nbc+c) << "\n";
854  }
855  }
856  }
857  }
858  // Fields: x0 "Right-Bound ---> Left-Guard"
859  for(int i(0); i < Y.EMF().dim(); ++i) {
860  for(int c(0); c < Nbc; c++) {
861  Y.FLD(i)(c) = Y.FLD(i)(Y.EMF().Ex().numx()-2*Nbc+c);
862  // std::cout << "\n 2: FLD(" << i << "," << c << ") = " << Y.FLD(i)(Y.EMF().Ex().numx()-2*Nbc+c) << "\n";
863  }
864  }
865 
866 
867 
868  // Harmonics:x0 "Left-Bound ---> Right-Guard"
869  for(int s(0); s < Y.Species(); ++s) {
870  for(int i(0); i < Y.DF(s).dim(); ++i) {
871  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
872  for(int c(0); c < Nbc; c++) {
873  // std::cout << "\n 3: DF(" << i << "," << p << "," << Y.EMF().Ex().numx()-Nbc+c << ") = " << (Y.DF(s)(i))(p, Y.EMF().Ex().numx()-Nbc+c) << "\n";
874 
875  (Y.DF(s)(i))(p, Y.EMF().Ex().numx()-Nbc+c) = (Y.DF(s)(i))(p, Nbc+c);
876 
877  // std::cout << "\n 3n: DF(" << i << "," << p << "," << Y.EMF().Ex().numx()-Nbc+c << ") = " << (Y.DF(s)(i))(p, Y.EMF().Ex().numx()-Nbc+c-100.0) << "\n";
878  // if (c==2)
879 
880 
881  }
882  }
883  }
884  }
885 
886  // Fields: x0 "Left-Bound ---> Right-Guard"
887  for(int i(0); i < Y.EMF().dim(); ++i) {
888  for(int c(0); c < Nbc; c++) {
889  // if (i == 0) std::cout << "\n 4: FLD(" << i << "," << Y.EMF().Ex().numx()-Nbc+c << ") = " << Y.FLD(i)(Y.EMF().Ex().numx()-Nbc+c) << "\n";
890  Y.FLD(i)(Y.EMF().Ex().numx()-Nbc+c) = Y.FLD(i)(Nbc+c);
891  // if (i == 0) std::cout << "\n 4n: FLD(" << i << "," << Y.EMF().Ex().numx()-Nbc+c << ") = " << Y.FLD(i)(Y.EMF().Ex().numx()-Nbc+c) << "\n";
892 
893 
894  }
895  // Y.FLD(i)(Y.EMF().Ex().numx()-1) = 0.0;
896  }
897 
898  // temp = Y.DF(0).getcurrent(0);
899  // for (size_t ix(0);ix<Y.SH(0,0,0).numx();++ix)
900  // {
901  // std::cout<<"\n new[" << ix << "] = " << temp[ix] << "\n";
902 
903  // }
904 
905 
906  if (Input::List().hydromotion)
907  {
908  // Hydro Quantities: x0 "Right-Bound ---> Left-Guard"
909  for(int c(0); c < Nbc; c++) {
910  Y.HYDRO().density(c) = Y.HYDRO().density(Y.EMF().Ex().numx()-2*Nbc+c);
911  Y.HYDRO().vx(c) = Y.HYDRO().vx(Y.EMF().Ex().numx()-2*Nbc+c);
912  Y.HYDRO().vy(c) = Y.HYDRO().vy(Y.EMF().Ex().numx()-2*Nbc+c);
913  Y.HYDRO().vz(c) = Y.HYDRO().vz(Y.EMF().Ex().numx()-2*Nbc+c);
914  Y.HYDRO().temperature(c) = Y.HYDRO().temperature(Y.EMF().Ex().numx()-2*Nbc+c);
915  Y.HYDRO().Z(c) = Y.HYDRO().Z(Y.EMF().Ex().numx()-2*Nbc+c);
916  // Y.HYDRO().kpressure(c) = Y.HYDRO().velocity(Y.EMF().Ex().numx()-2*Nbc+c);
917  // Y.HYDRO().mpressure(c) = Y.HYDRO().velocity(Y.EMF().Ex().numx()-2*Nbc+c);
918  }
919 
920  // Hydro Quantities: x0 "Left-Bound ---> Right-Guard"
921  for(int c(0); c < Nbc; c++) {
922  Y.HYDRO().density(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().density(Nbc+c);
923  Y.HYDRO().vx(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().vx(Nbc+c);
924  Y.HYDRO().vy(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().vy(Nbc+c);
925  Y.HYDRO().vz(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().vz(Nbc+c);
926  Y.HYDRO().temperature(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().temperature(Nbc+c);
927  Y.HYDRO().Z(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().Z(Nbc+c);
928  // Y.HYDRO().kpressure(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().velocity(Nbc+c);
929  // Y.HYDRO().mpressure(Y.EMF().Ex().numx()-Nbc+c) = Y.HYDRO().velocity(Nbc+c);
930 
931  }
932  }
933 
934 }
size_t numx() const
Definition: state.h:197
bool hydromotion
Definition: input.h:82
size_t dim() const
Definition: state.h:286
double & vz(size_t i)
Definition: state.h:536
size_t dim() const
Definition: state.h:395
Hydro1D & HYDRO()
Definition: state.h:613
double & temperature(size_t i)
Definition: state.h:539
double & Z(size_t i)
Definition: state.h:542
size_t nump() const
Definition: state.h:71
DistFunc1D & DF(size_t s)
Definition: state.h:602
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
Field1D & Ex()
Definition: state.h:290
double & vx(size_t i)
Definition: state.h:530
Input_List & List()
Definition: input.cpp:1585
Field1D & FLD(size_t ip) const
Definition: state.h:611
double & density(size_t i)
Definition: state.h:527
double & vy(size_t i)
Definition: state.h:533
size_t Species() const
Definition: state.h:596
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Send_left_X()

void Node_Communications::Send_left_X ( State1D Y,
int  dest 
)

Definition at line 544 of file parallel.cpp.

References Hydro1D::density(), State1D::DF(), EMF1D::dim(), DistFunc1D::dim(), State1D::EMF(), State1D::FLD(), State1D::HYDRO(), Input::Input_List::hydromotion, Input::List(), msg_bufX, msg_sizeX, Nbc, SHarmonic1D::nump(), State1D::SH(), State1D::Species(), Hydro1D::temperature(), Hydro1D::vx(), Hydro1D::vy(), Hydro1D::vz(), and Hydro1D::Z().

Referenced by Parallel_Environment_1D::Neighbor_Communications().

544  {
545 //--------------------------------------------------------------
546 // X-axis : Read data from the left boundary and send them
547 // to the node on the left
548 //--------------------------------------------------------------
549 
550  // static size_t step_h(Y.SH(s,0,0).nump()*Nbc);
551  static size_t step_f(Nbc);
552  size_t bufind(0);
553 
554  // Harmonics:x0 " <--- Left-Bound "
555  for(int s(0); s < Y.Species(); ++s) {
556  for(int i = 0; i < Y.DF(s).dim(); ++i){
557  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
558  for(int e(0); e < Nbc; e++) {
559  msg_bufX[bufind + e] = (Y.DF(s)(i))(p, Nbc+e);
560  }
561  bufind += step_f;
562  }
563  }
564  }
565  // Fields: x0 " <--- Left-Bound "
566  for(int i = 0; i < Y.EMF().dim(); ++i){
567  for(int e(0); e < Nbc; e++) {
568  msg_bufX[bufind + e] = Y.FLD(i)(Nbc+e);
569  }
570  bufind += step_f;
571  }
572 
573  if (Input::List().hydromotion)
574  {
575  // Hydro-velocity: x0 " <--- Left-Bound "
576  for(int e(0); e < Nbc; e++) {
577  msg_bufX[bufind + e] = Y.HYDRO().density(Nbc+e);
578  }
579  bufind += step_f;
580  // Hydro-velocity: x0 " <--- Left-Bound "
581  for(int e(0); e < Nbc; e++) {
582  msg_bufX[bufind + e] = Y.HYDRO().vx(Nbc+e);
583  }
584  bufind += step_f;
585 
586  // Hydro-velocity: x0 " <--- Left-Bound "
587  for(int e(0); e < Nbc; e++) {
588  msg_bufX[bufind + e] = Y.HYDRO().vy(Nbc+e);
589  }
590  bufind += step_f;
591 
592  // Hydro-velocity: x0 " <--- Left-Bound "
593  for(int e(0); e < Nbc; e++) {
594  msg_bufX[bufind + e] = Y.HYDRO().vz(Nbc+e);
595  }
596  bufind += step_f;
597 
598  // Hydro-temperature: x0 " <--- Left-Bound "
599  for(int e(0); e < Nbc; e++) {
600  msg_bufX[bufind + e] = Y.HYDRO().temperature(Nbc+e);
601  }
602  bufind += step_f;
603 
604  // Hydro-charge-fraction: x0 " <--- Left-Bound "
605  for(int e(0); e < Nbc; e++) {
606  msg_bufX[bufind + e] = Y.HYDRO().Z(Nbc+e);
607  }
608  bufind += step_f;
609  }
610 
611  MPI_Send(msg_bufX, msg_sizeX, MPI_DOUBLE_COMPLEX, dest, 1, MPI_COMM_WORLD);
612 }
complex< double > * msg_bufX
Definition: parallel.h:113
bool hydromotion
Definition: input.h:82
size_t dim() const
Definition: state.h:286
double & vz(size_t i)
Definition: state.h:536
size_t dim() const
Definition: state.h:395
Hydro1D & HYDRO()
Definition: state.h:613
double & temperature(size_t i)
Definition: state.h:539
double & Z(size_t i)
Definition: state.h:542
size_t nump() const
Definition: state.h:71
DistFunc1D & DF(size_t s)
Definition: state.h:602
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
double & vx(size_t i)
Definition: state.h:530
Input_List & List()
Definition: input.cpp:1585
Field1D & FLD(size_t ip) const
Definition: state.h:611
double & density(size_t i)
Definition: state.h:527
double & vy(size_t i)
Definition: state.h:533
size_t Species() const
Definition: state.h:596
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Send_right_X()

void Node_Communications::Send_right_X ( State1D Y,
int  dest 
)

Definition at line 396 of file parallel.cpp.

References Hydro1D::density(), State1D::DF(), EMF1D::dim(), DistFunc1D::dim(), State1D::EMF(), State1D::FLD(), State1D::HYDRO(), Input::Input_List::hydromotion, Input::List(), msg_bufX, msg_sizeX, Nbc, SHarmonic1D::nump(), Field1D::numx(), State1D::SH(), State1D::Species(), Hydro1D::temperature(), Hydro1D::vx(), Hydro1D::vy(), Hydro1D::vz(), and Hydro1D::Z().

Referenced by Parallel_Environment_1D::Neighbor_Communications().

396  {
397 //--------------------------------------------------------------
398 // X-axis : Read data from the right boundary and send them
399 // to the node on the right
400 //--------------------------------------------------------------
401 
402  // static size_t step_h(numpmax*Nbc);
403  static size_t step_f(Nbc);
404  size_t bufind(0);
405 
406  // Harmonics:x0 "Right-Bound ---> "
407  for(int s(0); s < Y.Species(); ++s) {
408  for(size_t i = 0; i < Y.DF(s).dim(); ++i){
409  for(int p(0); p < Y.SH(s,0,0).nump(); ++p) {
410  for(int e(0); e < Nbc; e++) {
411  msg_bufX[bufind + e] = (Y.DF(s)(i))(p, Y.FLD(0).numx()-2*Nbc+e);
412  }
413  bufind += step_f;
414  }
415  }
416  }
417  // Fields: x0 "Right-Bound --> "
418  for(size_t i = 0; i < Y.EMF().dim(); ++i){
419  for(int e(0); e < Nbc; e++) {
420  msg_bufX[bufind + e] = Y.FLD(i)(Y.FLD(0).numx()-2*Nbc+e);
421  }
422  bufind += step_f;
423  }
424 
425  if (Input::List().hydromotion)
426  {
427  // Hydro-velocity: x0 "Right-Bound --> "
428  for(int e(0); e < Nbc; e++) {
429  msg_bufX[bufind + e] = Y.HYDRO().density(Y.FLD(0).numx()-2*Nbc+e);
430  }
431  bufind += step_f;
432  // Hydro-velocity: x0 "Right-Bound --> "
433  for(int e(0); e < Nbc; e++) {
434  msg_bufX[bufind + e] = Y.HYDRO().vx(Y.FLD(0).numx()-2*Nbc+e);
435  }
436  bufind += step_f;
437 
438  for(int e(0); e < Nbc; e++) {
439  msg_bufX[bufind + e] = Y.HYDRO().vy(Y.FLD(0).numx()-2*Nbc+e);
440  }
441  bufind += step_f;
442 
443  for(int e(0); e < Nbc; e++) {
444  msg_bufX[bufind + e] = Y.HYDRO().vz(Y.FLD(0).numx()-2*Nbc+e);
445  }
446  bufind += step_f;
447 
448  // Hydro-temperature: x0 "Right-Bound --> "
449  for(int e(0); e < Nbc; e++) {
450  msg_bufX[bufind + e] = Y.HYDRO().temperature(Y.FLD(0).numx()-2*Nbc+e);
451  }
452  bufind += step_f;
453 
454  // Hydro-chargefraction: x0 "Right-Bound --> "
455  for(int e(0); e < Nbc; e++) {
456  msg_bufX[bufind + e] = Y.HYDRO().Z(Y.FLD(0).numx()-2*Nbc+e);
457  }
458  bufind += step_f;
459  }
460  MPI_Send(msg_bufX, msg_sizeX, MPI_DOUBLE_COMPLEX, dest, 0, MPI_COMM_WORLD);
461 }
size_t numx() const
Definition: state.h:197
complex< double > * msg_bufX
Definition: parallel.h:113
bool hydromotion
Definition: input.h:82
size_t dim() const
Definition: state.h:286
double & vz(size_t i)
Definition: state.h:536
size_t dim() const
Definition: state.h:395
Hydro1D & HYDRO()
Definition: state.h:613
double & temperature(size_t i)
Definition: state.h:539
double & Z(size_t i)
Definition: state.h:542
size_t nump() const
Definition: state.h:71
DistFunc1D & DF(size_t s)
Definition: state.h:602
SHarmonic1D & SH(size_t s, size_t lh, size_t mh)
Definition: state.h:605
double & vx(size_t i)
Definition: state.h:530
Input_List & List()
Definition: input.cpp:1585
Field1D & FLD(size_t ip) const
Definition: state.h:611
double & density(size_t i)
Definition: state.h:527
double & vy(size_t i)
Definition: state.h:533
size_t Species() const
Definition: state.h:596
EMF1D & EMF() const
Definition: state.h:610
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ bndX

int Node_Communications::bndX
private

Definition at line 108 of file parallel.h.

Referenced by BNDX().

◆ msg_bufX

complex<double>* Node_Communications::msg_bufX
private

◆ msg_sizeX

int Node_Communications::msg_sizeX
private

◆ Nbc

◆ numpmax

int Node_Communications::numpmax
private

Definition at line 109 of file parallel.h.

◆ numspec

int Node_Communications::numspec
private

Definition at line 109 of file parallel.h.

Referenced by Node_Communications().


The documentation for this class was generated from the following files: