43 return(_ntet + _npyr + _npris + _nhex);
50 *_out <<
"********************************************************"
52 <<
"Region ID: " << _id <<
"\n"
53 <<
"Number of Nodes: (" << _nnodes <<
"," << _ngnodes <<
")" <<
"\n"
54 <<
"Number of Elements: " << nelem() <<
"\n"
55 <<
"Tets: (" << _ntet <<
"," << _ngtet <<
")" <<
"\n"
56 <<
"Pyramids: (" << _npyr <<
"," << _ngpyr <<
")" <<
"\n"
57 <<
"Prisms: (" << _npris <<
"," << _ngpris <<
")" <<
"\n"
58 <<
"Hexes: (" << _nhex <<
"," << _nghex <<
")" <<
"\n"
59 <<
"Region Borders: " <<
"\n"
60 <<
"========================================================"
62 unsigned int border = 0;
63 while(border < _borders.size()){
64 *_out <<
" Local Border #" << border+1 <<
"\n" ;
66 *_out <<
"-----------------------------------------------------" <<
"\n"
67 <<
" Region/Border: (" << fb->
_rpart <<
"," << fb->
_rbid
75 <<
"-----------------------------------------------------" <<
"\n";
78 <<
"========================================================" <<
"\n"
79 <<
"Domain Boundaries: " <<
"\n"
80 <<
"========================================================" <<
"\n";
81 unsigned int patch = 0;
82 while(patch < _patches.size()){
83 *_out <<
" Local patch #" << patch+1 <<
"\n"
84 <<
"-----------------------------------------------------" <<
"\n";
87 <<
" Patch ID: " << fp->
_id <<
"\n"
88 <<
" Triangles: (" << fp->
_ntri <<
"," << fp->
_ngtri <<
")" <<
"\n"
91 <<
"-----------------------------------------------------" <<
"\n";
94 <<
"========================================================" <<
"\n"
96 <<
"********************************************************" <<
"\n";
104 Inf.open(
"Rocflu/RocfluControl.txt");
106 Inf.open(
"RocfluControl.txt");
109 Inf >> _casename >> _casepath;
118 if(_casepath.empty())
121 pre = _casepath +
"/" + _casename;
134 if(_casename.empty())
137 pre = _casepath +
"/" + _casename +
".";
145 Ostr << pre <<
"com_";
146 Ostr << setw(5) << setfill(
'0');
148 Ouf.open(Ostr.str().c_str());
151 Ouf <<
"# ROCFLU communication lists file" << endl
152 <<
"# Dimensions" << endl
153 << setw(8) << _borders.size() << endl
154 <<
"# Information" << endl;
155 vector<FluBorder>::iterator fbi = _borders.begin();
156 while(fbi != _borders.end()){
157 Ouf << setw(8) << fbi->_rpart << setw(8) << fbi->_rbid << endl;
160 Ouf <<
"# Cells" << endl;
161 fbi = _borders.begin();
162 while(fbi != _borders.end()){
163 Ouf << setw(8) << fbi->_sendcells.size() << setw(8)
164 << fbi->_recvcells.size() << endl;
166 vector<unsigned int>::iterator sci = fbi->_sendcells.begin();
167 while(sci != fbi->_sendcells.end()){
168 Ouf << setw(8) << *sci++;
179 sci = fbi->_recvcells.begin();
180 while(sci != fbi->_recvcells.end()){
181 Ouf << setw(8) << *sci++;
194 Ouf <<
"# Vertices" << endl;
195 fbi = _borders.begin();
196 while(fbi != _borders.end()){
197 Ouf << setw(8) << fbi->_sendnodes.size() << setw(8)
198 << fbi->_recvnodes.size() << setw(8) << fbi->_sharenodes.size()
200 vector<unsigned int>::iterator
ni = fbi->_sendnodes.begin();
202 while(ni != fbi->_sendnodes.end()){
203 Ouf << setw(8) << *ni++;
210 if(line || fbi->_sendnodes.empty()){
214 ni = fbi->_recvnodes.begin();
216 while(ni != fbi->_recvnodes.end()){
217 Ouf << setw(8) << *ni++;
224 if(line || fbi->_recvnodes.empty()){
228 ni = fbi->_sharenodes.begin();
230 while(ni != fbi->_sharenodes.end()){
231 Ouf << setw(8) << *ni++;
238 if(line || fbi->_sharenodes.empty()){
244 Ouf <<
"# End" << endl;
253 if(_casename.empty())
256 pre = _casepath +
"/" + _casename;
262 Ostr << pre <<
".com_";
263 Ostr << setw(5) << setfill(
'0');
265 Inf.open(Ostr.str().c_str());
270 unsigned int nborders = 0;
273 *_out <<
"FluRegion::ReadFluCOM(" << _id <<
"): nborders: "
275 assert(nborders == _borders.size());
277 vector<FluBorder>::iterator fbi = _borders.begin();
278 while(fbi != _borders.end()){
279 unsigned int rpart,rbid;
280 Inf >> rpart >> rbid;
281 assert(fbi->_rpart == rpart && fbi->_rbid == rbid);
285 fbi = _borders.begin();
286 while(fbi != _borders.end()){
287 unsigned int rcells,scells;
288 Inf >> scells >> rcells;
289 assert(scells == fbi->_sendcells.size() &&
290 rcells == fbi->_recvcells.size());
292 int ncells = fbi->_sendcells.size();
294 Inf >> fbi->_sendcells[cell++];
296 ncells = fbi->_recvcells.size();
298 Inf >> fbi->_recvcells[cell++];
302 fbi = _borders.begin();
303 while(fbi != _borders.end()){
304 unsigned int nshare,nsend,nrecv;
305 Inf >> nsend >> nrecv >> nshare;
306 assert(nsend == fbi->_sendnodes.size() &&
307 nrecv == fbi->_recvnodes.size() &&
308 nshare == fbi->_sharenodes.size());
309 unsigned int node = 0;
310 unsigned int nnodes = fbi->_sendnodes.size();
312 Inf >> fbi->_sendnodes[node++];
314 nnodes = fbi->_recvnodes.size();
316 Inf >> fbi->_recvnodes[node++];
317 nnodes = fbi->_sharenodes.size();
320 Inf >> fbi->_sharenodes[node++];
329 unsigned int nregions)
333 if(_casename.empty())
336 pre = _casepath +
"/" + _casename +
".";
344 Ostr << pre <<
"map";
345 Ouf.open(Ostr.str().c_str());
348 Ouf <<
"# ROCFLU region mapping file" << endl
349 <<
"# Number of regions" << endl
350 << setw(8) << nregions << endl
351 <<
"# Number of processes" << endl
352 << setw(8) << nproc << endl;
353 unsigned int regpproc = nregions/nproc;
356 unsigned int left = nregions%nproc;
357 unsigned int proc = 0;
358 unsigned int reg = 0;
360 unsigned int nreg = regpproc;
365 Ouf <<
"# Process " << setw(6) << setfill(
'0') << proc+1 << endl
366 << setfill(
' ') << setw(8) << nreg << endl;
367 unsigned int uplimit = reg + nreg;
369 Ouf << setw(8) << (1+reg++) << endl;
372 Ouf <<
"# End" << endl;
382 if(_casename.empty())
385 pre = _casepath +
"/" + _casename +
".";
393 Ostr << pre <<
"dim_";
394 Ostr << setw(5) << setfill(
'0');
396 string filebase(Ostr.str());
400 Ostr <<
"_" << scientific << setprecision(5) << t;
401 string timestring(Ostr.str());
402 timestring.replace(8,1,
"E");
403 filebase+=timestring;
405 Ouf.open(filebase.c_str());
408 _ntet = _tetconn.size()/4;
409 _nnodes = _nc.size()/3;
410 _nhex = _hexconn.size()/8;
411 _npris = _prisconn.size()/6;
412 _npyr = _pyrconn.size()/5;
413 Ouf <<
"# ROCFLU dimensions file" << endl
414 <<
"# Vertices" << endl
415 << setw(8) << _nnodes - _ngnodes << setw(8) << _nnodes
416 << setw(8) << _nnodes+(_nnodes/5) << endl
418 << setw(8) << (nelem()-_ngtet-_ngpyr-_ngpris-_nghex)
419 << setw(8) << nelem()
420 << setw(8) << (nelem()+(nelem()/5)) << endl
421 <<
"# Tetrahedra" << endl
422 << setw(8) << _ntet - _ngtet << setw(8) << _ntet << setw(8)
425 <<
"# Hexahedra" << endl
426 << setw(8) << _nhex - _nghex << setw(8) << _nhex << setw(8)
429 <<
"# Prisms" << endl
430 << setw(8) << _npris - _ngpris << setw(8) << _npris << setw(8)
433 <<
"# Pyramids" << endl
434 << setw(8) << _npyr - _ngpyr << setw(8) << _npyr
435 << setw(8) << _npyr+(_npyr/5)
437 <<
"# Patches" << endl
438 << setw(8) << _patches.size() << setw(8) << _npatches_total << endl;
439 vector<FluPatch>::iterator fpi = _patches.begin();
440 while(fpi != _patches.end()){
441 Ouf << setw(8) << fpi->_id << setw(8) << fpi->_ntri - fpi->_ngtri
442 << setw(8) << fpi->_ntri << setw(8) << fpi->_nquad - fpi->_ngquad
443 << setw(8) << fpi->_nquad << endl;
446 Ouf <<
"# Borders" << endl
447 << setw(8) << _borders.size() << endl;
448 vector<FluBorder>::iterator fbi = _borders.begin();
449 while(fbi != _borders.end()){
450 Ouf << setw(8) << fbi->_rpart << setw(8) << fbi->_rbid << setw(8)
451 << fbi->_sendcells.size() << setw(8) << fbi->_recvcells.size()
453 << fbi->_sendnodes.size() << setw(8) << fbi->_recvnodes.size()
455 << fbi->_sharenodes.size() << endl;
458 Ouf <<
"# End" << endl;
467 if(_casename.empty())
470 pre = _casepath +
"/" + _casename;
475 *_out <<
"FluRegion::ReadFluDIM: Entry" <<
"\n";
476 _soln._current_time = t;
477 _soln._unsteady = unsteady;
480 Ostr << pre <<
".dim_";
481 Ostr << setw(5) << setfill(
'0');
483 string filebase(Ostr.str());
487 Ostr <<
"_" << scientific << setprecision(5) << t;
488 string timestring(Ostr.str());
489 timestring.replace(8,1,
"E");
490 filebase+=timestring;
492 Inf.open(filebase.c_str());
495 *_out <<
"FluRegion::ReadFluDIM: Unable to open " << filebase
496 <<
" for reading." << endl;
500 unsigned int nreal_cells = 0;
501 unsigned int ncells = 0;
502 unsigned int npatches = 0;
503 unsigned int nreal_tets = 0;
504 unsigned int nreal_hex = 0;
505 unsigned int nreal_pris = 0;
506 unsigned int nreal_pyr = 0;
507 unsigned int nreal_nodes = 0;
509 Inf >> nreal_nodes >> _nnodes;
511 Inf >> nreal_cells >> ncells;
513 Inf >> nreal_tets >> _ntet;
515 Inf >> nreal_hex >> _nhex;
517 Inf >> nreal_pris >> _npris;
519 Inf >> nreal_pyr >> _npyr;
521 Inf >> npatches >> _npatches_total;
522 _ngnodes = _nnodes - nreal_nodes;
523 _ngtet = _ntet - nreal_tets;
524 _nghex = _nhex - nreal_hex;
525 _ngpyr = _npyr - nreal_pyr;
526 _ngpris = _npris - nreal_pris;
527 assert(nelem() == ncells);
529 *_out <<
"FluRegion::ReadFluDIM:: Elems: (" << nelem() <<
","
530 << _ngtet+_nghex+_ngpyr+_ngpris <<
")" << endl
531 <<
"FluRegion::ReadFluDIM:: Nodes: (" << _nnodes <<
","
532 << _ngnodes <<
")" << endl
533 <<
"FluRegion::ReadFluDIM:: Patches: (" << npatches <<
","
534 << _npatches_total <<
")" << endl;
535 _patches.resize(npatches);
536 _tetconn.resize(4*_ntet);
537 _hexconn.resize(8*_nhex);
538 _prisconn.resize(6*_npris);
539 _pyrconn.resize(5*_npyr);
540 _nc.resize(3*_nnodes);
541 vector<FluPatch>::iterator fpi = _patches.begin();
542 while(fpi != _patches.end()){
543 unsigned int nreal_tri = 0;
544 unsigned int nreal_quad = 0;
545 Inf >> fpi->_id >> nreal_tri >> fpi->_ntri >> nreal_quad >> fpi->_nquad;
546 fpi->_ngtri = fpi->_ntri - nreal_tri;
547 fpi->_ngquad = fpi->_nquad - nreal_quad;
548 fpi->_triconn.resize(fpi->_ntri*3);
549 fpi->_quadconn.resize(fpi->_nquad*4);
552 unsigned int nborders = 0;
556 *_out <<
"FluRegion::ReadFluDIM:: Number of borders: " << nborders << endl;
557 _borders.resize(nborders);
558 vector<FluBorder>::iterator fbi = _borders.begin();
559 while(fbi != _borders.end()){
560 unsigned int nsend,nrecv,nshared,csend,crecv;
561 Inf >> fbi->_rpart >> fbi->_rbid >> csend >> crecv
562 >> nsend >> nrecv >> nshared;
564 *_out <<
"FluRegion::ReadFluDIM:: Border: (" << fbi->_rpart <<
","
565 << fbi->_rbid <<
"," << csend <<
"," << crecv <<
"," << nsend
566 <<
"," << nrecv <<
"," << nshared <<
")" << endl;
567 fbi->_sharenodes.resize(nshared);
568 fbi->_sendnodes.resize(nsend);
569 fbi->_recvnodes.resize(nrecv);
570 fbi->_sendcells.resize(csend);
571 fbi->_recvcells.resize(crecv);
576 *_out <<
"FluRegion::ReadFluDIM: Exit" << endl;
585 if(_casename.empty())
588 pre = _casepath +
"/" + _casename;
590 vector<FluBorder>::iterator fbi = _borders.begin();
591 while(fbi != _borders.end()){
594 Ostr << pre <<
".dim_";
595 Ostr << setw(5) << setfill(
'0');
597 string filebase(Ostr.str());
601 Ostr <<
"_" << scientific << setprecision(5) << t;
602 string timestring(Ostr.str());
603 timestring.replace(8,1,
"E");
604 filebase+=timestring;
606 Inf.open(filebase.c_str());
610 <<
"FluRegion(" << _id <<
")::PopRemBordIndFILE: Unable to open "
611 << filebase <<
" for reading.\n";
615 unsigned int fakeout = 0;
616 unsigned int nreal_cells = 0;
617 unsigned int nnodes = 0;
618 unsigned int nhex = 0;
619 unsigned int ntet = 0;
620 unsigned int npris = 0;
621 unsigned int npyr = 0;
622 unsigned int ncells = 0;
623 unsigned int npatches = 0;
624 unsigned int nreal_tets = 0;
625 unsigned int nreal_hex = 0;
626 unsigned int nreal_pris = 0;
627 unsigned int nreal_pyr = 0;
628 unsigned int nreal_nodes = 0;
629 unsigned int npatches_total = 0;
630 unsigned int ngnodes = 0;
631 unsigned int ngtet = 0;
632 unsigned int nghex = 0;
633 unsigned int ngpris = 0;
634 unsigned int ngpyr = 0;
636 Inf >> nreal_nodes >> nnodes;
638 Inf >> nreal_cells >> ncells;
640 Inf >> nreal_tets >> ntet;
642 Inf >> nreal_hex >> nhex;
644 Inf >> nreal_pris >> npris;
646 Inf >> nreal_pyr >> npyr;
648 Inf >> npatches >> npatches_total;
649 ngnodes = nnodes - nreal_nodes;
650 ngtet = ntet - nreal_tets;
651 nghex = nhex - nreal_hex;
652 ngpyr = npyr - nreal_pyr;
653 ngpris = npris - nreal_pris;
655 *_out <<
"FluRegion(" << _id <<
")::PopRemBordIndFILE::Elems: ("
656 << ntet+npris+nhex+npyr
657 <<
"," << ngtet+nghex+ngpyr+ngpris <<
")\n"
658 <<
"FluRegion(" << _id <<
")::PopRemBordIndFILE" <<
"::Nodes: ("
661 <<
"FluRegion(" << _id <<
")::PopRemBordIndFILE:: Patches: ("
663 << npatches_total <<
")\n";
664 for(
unsigned int pind = 0;pind < npatches;pind++){
665 unsigned int nreal_tri = 0;
666 unsigned int nreal_quad = 0;
667 Inf >> fakeout >> nreal_tri >> fakeout >> nreal_quad >> fakeout;
669 unsigned int nborders = 0;
673 *_out <<
"FluRegion(" << _id <<
")::PopRemBordIndFILE:: "
674 <<
"Number of borders: " << nborders
677 for(
unsigned int bind = 0;(bind < nborders && !done);bind++){
680 if(rpart == this->_id){
685 Inf >> fakeout >> fakeout >> fakeout >> fakeout >> fakeout >> fakeout;
701 if(_casename.empty())
704 pre = _casepath +
"/" + _casename +
".";
710 Ostr << pre <<
"cmp_";
711 Ostr << setw(5) << setfill(
'0');
713 Ouf.open(Ostr.str().c_str());
716 _ntet = _tetconn.size()/4;
717 _nhex = _hexconn.size()/8;
718 _npris = _prisconn.size()/6;
719 _npyr = _pyrconn.size()/5;
721 Ouf <<
"# ROCFLU cell mapping file" << endl
722 <<
"# Dimensions" << endl
723 << setw(8) << _ntet << setw(8) << _nhex << setw(8) << _npris
724 << setw(8) << _npyr << endl;
725 vector<pair<unsigned int,unsigned int> >::iterator ci = _cellmap.begin();
728 unsigned int npl = 10;
731 Ouf <<
"# Tetrahedra" << endl;
733 Ouf << setw(8) << Elem2Cell(make_pair(1,++el));
737 if(el%npl) Ouf << endl;
741 Ouf <<
"# Hexahedra" << endl;
743 Ouf << setw(8) << Elem2Cell(make_pair(4,++el));
747 if(el%npl) Ouf << endl;
751 Ouf <<
"# Prisms" << endl;
753 Ouf << setw(8) << Elem2Cell(make_pair(3,++el));
757 if(el%npl) Ouf << endl;
761 Ouf <<
"# Pyramids" << endl;
763 Ouf << setw(8) << Elem2Cell(make_pair(2,++el));
767 if(el%npl) Ouf << endl;
769 Ouf <<
"# End" << endl;
780 if(_casename.empty())
783 pre = _casepath +
"/" + _casename;
785 string fname(pre+
".inp");
787 Inf.open(fname.c_str());
798 while(getline(Inf,line)){
800 string::size_type xtime = line.find(
"STARTTIME");
801 string::size_type ftype = line.find(
"FLOWTYPE");
802 string::size_type xgamma = line.find(
"GAMMA");
803 string::size_type xpress = line.find(
"PRESS");
804 string::size_type x_dens = line.find(
"DENS");
805 string::size_type x_velx = line.find(
"VELX");
806 string::size_type x_vely = line.find(
"VELY");
807 string::size_type x_velz = line.find(
"VELZ");
808 string::size_type x_cp = line.find(
"CP");
810 istringstream Istr(line);
811 if(xtime != string::npos)
812 Istr >> tstr >> _soln._current_time;
813 if(ftype != string::npos)
814 Istr >> tstr >> _soln._unsteady;
815 if(xgamma != string::npos)
816 Istr >> tstr >> gamma;
817 if(xpress != string::npos)
818 Istr >> tstr >> press;
819 if(x_dens != string::npos)
821 if(x_velx != string::npos)
822 Istr >> tstr >> velx;
823 if(x_vely != string::npos)
824 Istr >> tstr >> vely;
825 if(x_velz != string::npos)
826 Istr >> tstr >> velz;
827 if(x_cp != string::npos)
831 if(gamma < 0 || press < 0 || rho < 0 || cp < 0)
833 _ntet = _tetconn.size()/4;
834 _npyr = _pyrconn.size()/5;
835 _nhex = _hexconn.size()/8;
836 _npris = _prisconn.size()/6;
837 unsigned int nelem = _ntet + _npyr + _npris + _nhex;
838 _soln._rhof.resize(nelem,rho);
839 double E = press/(rho*(gamma - 1.0)) +
840 (velx*velx + vely*vely + velz*velz)/2.0;
841 _soln._rhovf.resize(3*nelem,0.0);
842 if(velx != 0.0 || vely != 0.0 || velz != 0.0){
843 unsigned int index = 0;
844 for(
unsigned int el = 0;el < nelem;el++){
845 _soln._rhovf[index++] = rho*velx;
846 _soln._rhovf[index++] = rho*vely;
847 _soln._rhovf[index++] = rho*velz;
850 double R = (cp*(gamma-1.0))/gamma;
851 double Ti = press/(rho*R);
852 double C =
sqrt(gamma*press/rho);
853 _soln._rhoEf.resize(nelem,rho*E);
854 _soln._pf.resize(nelem,press);
855 _soln._Tf.resize(nelem,Ti);
856 _soln._af.resize(nelem,C);
857 _soln._gsp.resize(_nvface,0.0);
866 if(_casename.empty())
869 pre = _casepath +
"/" + _casename;
871 vector<FluPatch>::iterator fpi = _patches.begin();
872 while(fpi != _patches.end()){
886 *_out <<
"FluPatch(" << _id <<
")::InitSurfaceSoln Enter" << endl;
890 _ntri = _triconn.size()/3;
891 _nquad = _quadconn.size()/4;
893 _soln.Resize(_ntri+_nquad,surface_coordinates.size()/3);
899 int constraint_map[] = { 2 , 120, 121, 122, -122, -121, -120, 0};
901 string fname(pre+
".bc");
903 Inf.open(fname.c_str());
906 *_out <<
"FluPatch::InitSurfaceSoln: Error: could not locate bc file."
912 bool found_patch =
false;
913 while(getline(Inf,line) && !found_patch){
915 string::size_type patchx = line.find(
"PATCH");
916 if( patchx != string::npos){
918 unsigned int ubound,lbound;
919 istringstream Istr(line);
920 Istr >> tstr >> lbound >> ubound;
921 if(_id >= lbound && _id <= ubound)
928 *_out <<
"FluPatch::InitSurfaceSoln: Error: Did not find patch "
929 << _id <<
" in bc file." << endl;
934 bool end_section =
false;
937 while(getline(Inf,line) && !end_section){
938 if(line[0] ==
'#') end_section =
true;
940 string::size_type movx = line.find(
"MOVEDIR");
941 string::size_type coupx = line.find(
"COUPLED");
942 string::size_type burn = line.find(
"BFLAG");
943 if(movx != string::npos){
946 istringstream Istr(line);
947 Istr >> tstr >> mvdir;
948 _constr_type = constraint_map[mvdir];
950 if(coupx != string::npos){
952 istringstream Istr(line);
953 Istr >> tstr >> _bcflag;
955 if(burn != string::npos){
957 unsigned int burnf = 0;
958 istringstream Istr(line);
959 Istr >> tstr >> burnf;
960 _soln._bflag.resize(_ntri+_nquad,burnf);
967 *_out <<
"FluPatch(" << _id <<
")::InitSurfaceSoln Exit" << endl;
979 if(_casename.empty())
982 pre = _casepath +
"/" + _casename;
985 Ostr << pre <<
".grda_" << setw(5) << setfill(
'0') << _id;
986 string filebase(Ostr.str());
989 Ostr <<
"_" << scientific << setprecision(5) << t;
990 string timestring(Ostr.str());
991 timestring.replace(8,1,
"E");
992 if(unsteady) filebase+=timestring;
994 Inf.open(filebase.c_str());
997 *_out <<
"FluRegion::ReadFluGridASCII: Unable to open " << filebase
998 <<
" for reading.\n";
1003 unsigned int nnode,ntet,nhex,npris,npyr;
1004 Inf >> nnode >> ntet >> nhex >> npris >> npyr;
1005 assert(nnode == _nnodes && ntet == _ntet &&
1006 nhex == _nhex && npris == _npris &&
1007 npyr == _npyr && _nc.size() == _nnodes*3);
1009 for(
int i = 0;
i < 3;
i++){
1010 unsigned int node = 0;
1011 while(node < _nnodes)
1012 Inf >> _nc[(node++)*3+
i];
1015 _tetconn.resize(_ntet*4);
1017 for(
int i = 0;
i < 4;
i++){
1018 unsigned int el = 0;
1020 Inf >> _tetconn[(el++)*4+
i];
1024 _hexconn.resize(_nhex*8);
1026 for(
int i = 0;
i < 8;
i++){
1027 unsigned int el = 0;
1029 Inf >> _hexconn[(el++)*8+
i];
1033 _prisconn.resize(_npris*6);
1035 for(
int i = 0;
i < 6;
i++){
1036 unsigned int el = 0;
1038 Inf >> _prisconn[(el++)*6+
i];
1042 _pyrconn.resize(_npyr*5);
1044 for(
int i = 0;
i < 5;
i++){
1045 unsigned int el = 0;
1047 Inf >> _pyrconn[(el++)*5+
i];
1051 unsigned int npatches = 0;
1052 unsigned int patch = 0;
1054 assert(npatches == _patches.size());
1055 while(patch < npatches){
1057 unsigned int ntri,nquad;
1058 Inf >> ntri >> nquad;
1062 for(
int i = 0;
i < 3;
i++){
1063 unsigned int tri = 0;
1064 while(tri < fp.
_ntri)
1070 for(
int i = 0;
i < 4;
i++){
1071 unsigned int quad = 0;
1089 if(_casename.empty())
1092 pre = _casepath +
"/" + _casename +
".";
1097 Ostr << pre <<
"grda_" << setw(5) << setfill(
'0') << _id;
1098 string filebase(Ostr.str());
1102 Ostr <<
"_" << scientific << setprecision(5) << t;
1103 string timestring(Ostr.str());
1104 timestring.replace(8,1,
"E");
1105 filebase+=timestring;
1108 Ouf.open(filebase.c_str());
1111 _nnodes = _nc.size()/3;
1112 _ntet = _tetconn.size()/4;
1113 _nhex = _hexconn.size()/8;
1114 _npyr = _pyrconn.size()/5;
1115 _npris = _prisconn.size()/6;
1116 Ouf <<
"# ROCFLU grid file" << endl
1117 <<
"# Precision and range" << endl
1118 << setw(8) << 15 << setw(8) << 307 << endl
1119 <<
"# Physical time" << endl
1120 << scientific << setprecision(16) << setw(23)
1121 << _soln._current_time << endl
1122 <<
"# Dimensions" << endl
1123 << setw(8) << _nnodes << setw(8) << _ntet << setw(8)
1124 << _nhex << setw(8) << _npris << setw(8) << _npyr << endl
1125 <<
"# Coordinates" << endl;
1126 unsigned int ll = 5;
1127 for(
int i = 0;
i < 3;
i++){
1128 unsigned int node = 0;
1129 while(node < _nnodes){
1130 Ouf << setw(23) << scientific << setprecision(16)
1131 << _nc[(node++)*3+
i];
1140 Ouf <<
"# Tetrahedra" << endl;
1141 for(
int i = 0;
i < 4;
i++){
1142 unsigned int el = 0;
1144 Ouf << setw(8) << _tetconn[(el++)*4+
i];
1153 Ouf <<
"# Hexahedra" << endl;
1154 for(
int i = 0;
i < 8;
i++){
1155 unsigned int el = 0;
1157 Ouf << setw(8) << _hexconn[(el++)*8+
i];
1166 Ouf <<
"# Prisms" << endl;
1167 for(
int i = 0;
i < 6;
i++){
1168 unsigned int el = 0;
1170 Ouf << setw(8) << _prisconn[(el++)*6+
i];
1179 Ouf <<
"# Pyramids" << endl;
1180 for(
int i = 0;
i < 5;
i++){
1181 unsigned int el = 0;
1183 Ouf << setw(8) << _pyrconn[(el++)*5+
i];
1191 Ouf <<
"# Boundaries" << endl
1192 << setw(8) << _patches.size() << endl;
1193 unsigned int npatches = _patches.size();
1194 unsigned int patch = 0;
1195 while(patch < npatches){
1197 Ouf << setw(8) << fp.
_ntri << setw(8) << fp.
_nquad << endl;
1199 for(
int i = 0;
i < 3;
i++){
1200 unsigned int tri = 0;
1201 while(tri < fp.
_ntri){
1202 Ouf << setw(8) << fp.
_triconn[(tri++)*3+
i];
1211 for(
int i = 0;
i < 4;
i++){
1212 unsigned int quad = 0;
1214 Ouf << setw(8) << fp.
_quadconn[(quad++)*4+
i];
1223 Ouf <<
"# End" << endl;
1230 double t,
bool unsteady)
1234 if(_casename.empty())
1237 pre = _casepath +
"/" + _casename;
1240 Ostr << pre <<
".mixt.cva_" << setw(5) << setfill(
'0') << _id <<
"_";
1241 string filebase(Ostr.str());
1243 Ostr << setw(6) << setfill(
'0') <<
n;
1244 string iterstring(Ostr.str());
1247 Ostr << scientific << setprecision(5) << t;
1248 string timestring(Ostr.str());
1249 timestring.replace(7,1,
"E");
1251 if(unsteady) filebase+=timestring;
1252 else filebase+=iterstring;
1253 Inf.open(filebase.c_str());
1256 *_out <<
"FluRegion::ReadFluSolnASCII: Unable to open " << filebase
1257 <<
" for reading.\n";
1262 Inf >> _soln._resid;
1264 Inf >> _soln._current_time;
1266 unsigned int ncells = 0;
1268 assert(ncells == nelem());
1270 unsigned int cell = 0;
1271 _soln._rhof.resize(ncells,0.0);
1272 _soln._rhovf.resize(3*ncells,0.0);
1273 _soln._rhoEf.resize(ncells,0.0);
1274 while(cell < ncells)
1275 Inf >> _soln._rhof[cell++];
1277 for(
int i = 0;
i < 3;
i++){
1279 while(cell < ncells)
1280 Inf >> _soln._rhovf[(cell++)*3+
i];
1284 while(cell < ncells)
1285 Inf >> _soln._rhoEf[cell++];
1286 if(!ReadGSPASCII(pre,n,t,unsteady)){
1289 <<
"FluRegion::ReadFluSolnASCII: Unable to process grid speed file."
1299 double t,
bool unsteady)
1302 *_out <<
"FluRegion::WriteFluSolnASCII: Enter\n";
1305 if(_casename.empty())
1308 pre = _casepath +
"/" + _casename +
".";
1313 Ostr << pre <<
"mixt.cva_" << setw(5) << setfill(
'0') << _id <<
"_";
1314 string filebase(Ostr.str());
1316 Ostr << setw(6) << setfill(
'0') <<
n;
1317 string iterstring(Ostr.str());
1320 Ostr << scientific << setprecision(5) << t;
1321 string timestring(Ostr.str());
1322 timestring.replace(7,1,
"E");
1325 filebase+=iterstring;
1327 filebase+=timestring;
1328 Ouf.open(filebase.c_str());
1331 unsigned int ncells = nelem();
1332 unsigned int n_cvar = 5;
1333 Ouf <<
"# ROCFLU flow file" << endl
1334 <<
"# Precision and range" << endl
1335 << setw(8) << 15 << setw(8) << 307 << endl
1336 <<
"# Initial residual" << endl
1337 << setw(23) << scientific << setprecision(16)
1338 << _soln._resid << endl
1339 <<
"# Physical time" << endl
1340 << setw(23) << scientific << setprecision(16)
1341 << _soln._current_time << endl
1342 <<
"# Dimensions" << endl
1343 << setw(8) << ncells << setw(8) << n_cvar << endl
1344 <<
"# Mixture density" << endl;
1345 unsigned int cell = 0;
1346 unsigned int ll = 5;
1347 while(cell < ncells){
1348 Ouf << setw(23) << scientific << setprecision(16)
1349 << _soln._rhof[cell++];
1355 for(
int i = 0;
i < 3;
i++){
1357 << (
i == 0 ?
"x-momentum" :
1358 i == 1 ?
"y-momentum" :
"z-momentum")
1361 while(cell < ncells){
1362 Ouf << setw(23) << scientific << setprecision(16)
1363 << _soln._rhovf[(cell++)*3+i];
1370 Ouf <<
"# Mixture total internal energy" << endl;
1372 while(cell < ncells){
1373 Ouf << setw(23) << scientific << setprecision(16)
1374 << _soln._rhoEf[cell++];
1380 Ouf <<
"# End" << endl;
1382 WriteGSPASCII(pre,n,t);
1384 *_out <<
"FluRegion::WriteFluSolnASCII: Exit\n";
1390 double t,
bool unsteady)
1393 *_out <<
"FluRegion::WriteGSPASCII: Enter\n";
1396 if(_casename.empty())
1399 pre = _casepath +
"/" + _casename +
".";
1404 Ostr << pre <<
"gspa_" << setw(5) << setfill(
'0') << _id <<
"_";
1405 string filebase(Ostr.str());
1407 Ostr << setw(6) << setfill(
'0') <<
n;
1408 string iterstring(Ostr.str());
1411 Ostr << scientific << setprecision(5) << t;
1412 string timestring(Ostr.str());
1413 timestring.replace(7,1,
"E");
1415 if(!unsteady) filebase+=iterstring;
1416 else filebase+=timestring;
1417 Ouf.open(filebase.c_str());
1420 Ouf <<
"# ROCFLU grid speeds file" << endl
1421 <<
"# Precision and range" << endl
1422 << setw(8) << 15 << setw(8) << 307 << endl
1423 <<
"# Physical time" << endl
1424 << setw(23) << scientific << setprecision(16)
1426 <<
"# Dimensions" << endl
1427 << setw(8) << _nvface << endl
1428 <<
"# Grid speeds" << endl;
1429 unsigned int face = 0;
1430 unsigned int ll = 5;
1431 bool gsp = (_soln._gsp.size() != 0);
1433 *_out <<
"FluRegion::WriteGSPASCII: nvface = " << _nvface <<
"\n";
1436 <<
"FluRegion::WriteGSPASCII:no gridspeeds for the volume faces.\n";
1438 while(face < _nvface){
1439 Ouf << setw(23) << scientific << setprecision(16)
1440 << (gsp ? _soln._gsp[
face] : 0);
1448 *_out <<
"FluRegion::WriteGSPASCII: npatches = " << _patches.size()
1450 vector<FluPatch>::iterator fpi = _patches.begin();
1451 while(fpi != _patches.end()){
1456 *_out <<
"FluRegion::WriteGSPASCII: npatch_faces = " << nfaces <<
"\n";
1458 *_out <<
"FluRegion::WriteGSPASCII: no gridspeeds for patch faces."
1462 while(face < nfaces){
1463 Ouf << setw(23) << scientific << setprecision(16)
1472 Ouf <<
"# End" << endl;
1475 *_out <<
"FluRegion::WriteGSPASCII: Exit\n";
1481 double t,
bool unsteady)
1484 *_out <<
"FluRegion::ReadGSPASCII: Enter\n";
1487 if(_casename.empty())
1490 pre = _casepath +
"/" + _casename;
1493 Ostr << pre <<
".gspa_" << setw(5) << setfill(
'0') << _id <<
"_";
1494 string filebase(Ostr.str());
1496 Ostr << setw(6) << setfill(
'0') <<
n;
1497 string iterstring(Ostr.str());
1500 Ostr << scientific << setprecision(5) << t;
1501 string timestring(Ostr.str());
1502 timestring.replace(7,1,
"E");
1505 Inf.open((filebase+iterstring).c_str());
1507 Inf.open((filebase+timestring).c_str());
1513 _soln._gsp.resize(_nvface,0.0);
1515 unsigned int face = 0;
1516 while(face < _nvface)
1517 Inf >> _soln._gsp[face++];
1518 vector<FluPatch>::iterator fpi = _patches.begin();
1519 while(fpi != _patches.end()){
1524 while(face < nfaces)
1535 const string &prefix)
1541 if(_casename.empty())
1544 pre = _casepath +
"/" + _casename;
1546 Ostr << pre <<
".cgi";
1548 bcfile.open(Ostr.str().c_str());
1552 unsigned int nggpatch_mapping_lines;
1553 bcfile >> _npatches_total >> nggpatch_mapping_lines;
1554 unsigned int patch_line = 0;
1555 while(patch_line < nggpatch_mapping_lines){
1556 unsigned int low, high, flupatch;
1557 bcfile >> low >> high >> flupatch;
1558 unsigned int p = low;
1560 patch_mapping[p++] = flupatch;
1564 *_out <<
"FluRegion::BuildPatchMapping: Patch Mapping:\n";
1565 map<unsigned int,unsigned int>::iterator mi = patch_mapping.begin();
1566 while(mi != patch_mapping.end()){
1567 *_out <<
"FluRegion::BuildPatchMapping: (" << mi->first <<
","
1568 << mi->second <<
")\n";
1578 unsigned int n,
double t,
bool unsteady)
1581 *_out <<
"FluRegion::ReadRegionASCII:: Reading Rocflu Region "
1582 <<
"from Rocflu native files...\n";
1585 if(_casename.empty())
1588 pre = _casepath +
"/" + _casename;
1591 if(!ReadFluDIM(pre,t,unsteady))
1593 if(!ReadFluCOM(pre)){
1595 *_out <<
"FluRegion::ReadRegionASCII: ReadFluCOM failed.\n";
1598 if(!ReadFluGridASCII(pre,t,unsteady)){
1600 *_out <<
"FluRegion::ReadRegionASCII: ReadFluGridASCII failed.\n";
1603 if(!ReadFluSolnASCII(pre,n,t,unsteady)){
1605 *_out <<
"FluRegion::ReadRegionASCII: ReadFluSolnASCII failed.\n";
1609 *_out <<
"FluRegion::ReadRegionASCII:: Done reading Rocflu Region "
1610 <<
"from Rocflu native files.\n";
1618 int *local_index = NULL;
1619 int *remote_index = NULL;
1620 MPI_Request *req = NULL;
1622 MPI_Status *status = NULL;
1623 if(_borders.size() > 0){
1624 local_index =
new int [_borders.size()];
1625 req =
new MPI_Request [2*_borders.size()];
1626 remote_index =
new int [_borders.size()];
1627 status =
new MPI_Status [_borders.size()*2];
1629 vector<FluBorder>::iterator fbi = _borders.begin();
1630 while(fbi != _borders.end()){
1631 int remote_proc = fbi->_rpart - 1;
1632 local_index[ind] = ind + 1;
1633 MPI_Isend(&local_index[ind],1,MPI_INT,remote_proc,remote_proc,
1639 fbi = _borders.begin();
1640 while(fbi != _borders.end()){
1641 int remote_proc = fbi->_rpart - 1;
1642 MPI_Irecv(&remote_index[ind2++],1,MPI_INT,remote_proc,_id-1,
1647 if(_borders.size() > 0)
1648 MPI_Waitall(_borders.size()*2,req,status);
1654 int nval_cells,
double *node_data,
int nval_nodes)
1656 _ntet = _tetconn.size()/4;
1657 _nhex = _hexconn.size()/8;
1658 _npris = _prisconn.size()/6;
1659 _npyr = _pyrconn.size()/5;
1660 _nnodes = _nc.size()/3;
1661 unsigned int n_elem = nelem();
1662 _soln.Resize(n_elem,0,_nnodes);
1663 _soln._unsteady =
true;
1664 unsigned int ind = 0;
1665 unsigned int cdind = 0;
1666 unsigned int vind = 0;
1667 while(ind < n_elem){
1668 _soln._rhof[ind] = cell_data[cdind++];
1669 _soln._rhovf[vind++] = cell_data[cdind++];
1670 _soln._rhovf[vind++] = cell_data[cdind++];
1671 _soln._rhovf[vind++] = cell_data[cdind++];
1672 _soln._rhoEf[ind] = cell_data[cdind++];
1673 _soln._pf[ind] = cell_data[cdind++];
1674 _soln._Tf[ind] = cell_data[cdind++];
1675 _soln._af[ind] = cell_data[cdind++];
1679 while(ind < _nnodes){
1680 _soln._disp[ind*3] = node_data[ind*3];
1681 _soln._disp[ind*3+1] = node_data[ind*3+1];
1682 _soln._disp[ind*3+2] = node_data[ind*3+2];
1691 Create_com_volsoln(
"rhof",_soln._rhof,1,
"kg/m^3");
1692 Create_com_volsoln(
"rhovf",_soln._rhovf,3,
"kg/(m^2s)");
1693 Create_com_volsoln(
"rhoEf",_soln._rhoEf,1,
"J/m^3");
1696 if(_soln._gsp.size() != 0)
1697 COM_set_array((volume_window+
".gs"),pane_id,&(_soln._gsp[0]));
1698 Create_com_volsoln(
"pf",_soln._pf,1,
"Pa");
1699 Create_com_volsoln(
"Tf",_soln._Tf,1,
"K");
1700 Create_com_volsoln(
"af",_soln._af,1,
"m/s");
1708 *_out <<
"FluPatch(" << _id <<
")::RegisterSoln: "
1709 <<
"Registering pane " << pane_id <<
"." << endl;
1710 if(_soln._gsp.size() != 0){
1713 bool do_t0 = (t0_coords.size() != 0);
1723 COM_set_array((wname+
".constr_type"),pane_id,&_constr_type);
1726 Create_com_surfsoln(wname,
"rhofvf_alp",_soln._rhofvf_alp,3,
"kg/(m^2s)");
1727 Create_com_surfsoln(wname,
"nf_alp",_soln._nf_alp,3,
"");
1728 Create_com_surfsoln(wname,
"rhof_alp",_soln._rhof_alp,1,
"kg/m^3");
1729 Create_com_surfsoln(wname,
"pf",_soln._pf,1,
"Pa");
1730 Create_com_surfsoln(wname,
"qc",_soln._qc,1,
"W/m^2");
1731 Create_com_surfsoln(wname,
"qr",_soln._qr,1,
"W/m^2");
1732 Create_com_surfsoln(wname,
"tf",_soln._tf,3,
"Pa");
1733 Create_com_surfsoln(wname,
"Tb_alp",_soln._Tb_alp,1,
"K");
1734 Create_com_surfsoln(wname,
"mdot_alp",_soln._mdot_alp,1,
"kg/(m^2s)");
1735 Create_com_surfsoln(wname,
"Tflm_alp",_soln._Tflm_alp,1,
"K");
1746 *_out <<
"FluRegion(" << _id <<
")::RegisterSurfaceSoln Enter" << endl;
1748 if(_t0_coords.size() != 0)
1768 vector<FluPatch>::iterator fpi = _patches.begin();
1770 *_out <<
"FluRegion(" << _id <<
")::RegisterSurfaceSoln: "
1771 <<
"Registering patches..." << endl;
1772 while(fpi != _patches.end()){
1777 *_out <<
"FluRegion(" << _id <<
")::RegisterSurfaceSoln: "
1778 <<
"Registering patche done." << endl;
1790 vector<FluPatch>::iterator fpi = _patches.begin();
1791 while(fpi != _patches.end()){
bool PopRemBordIndFILE(const string &p="", double=0.0, bool=true)
bool WriteFluCOM(const string &p="")
bool ReadFluSolnASCII(const std::string &p="", unsigned int=0, double=0.0, bool=true)
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_WORLD
bool ComRemeshInitData(const string &wname, double *cell_data, int nval_cells, double *node_data, int nval_nodes)
bool WriteFluCMP(const string &p="")
bool InitSurfaceSoln(const string &prefix="", bool=false)
bool WriteFluSolnASCII(const std::string &p="", unsigned int=0, double=0.0, bool=true)
bool CreateRegionMapFile(const string &p="", unsigned int=0, unsigned int=0)
bool ReadRegionASCII(const string &p="", unsigned int=0, unsigned int=0, double=0.0, bool=true)
std::vector< unsigned int > _recvnodes
std::vector< unsigned int > _sendcells
void COM_set_size(const char *wa_str, int pane_id, int size, int ng=0)
Set sizes of for a specific attribute.
This file contains the prototypes for Roccom API.
bool ReadFluGridASCII(const std::string &p="", double=0.0, bool=true)
bool ReadFluCOM(const string &p="")
std::vector< unsigned int > _quadconn
std::vector< unsigned int > _sharenodes
std::vector< unsigned int > _recvcells
std::vector< unsigned int > _sendnodes
bool RegisterSoln(const string &, bool)
std::vector< unsigned int > _triconn
bool BuildPatchMapping(map< unsigned int, unsigned int > &, const string &p="")
bool RegisterVolumeSoln(bool)
bool WriteGSPASCII(const std::string &p="", unsigned int=0, double=0.0, bool=true)
bool WriteFluDIM(const string &p="", double=0.0, bool=true)
bool ReadFluDIM(const string &p="", double=0.0, bool=true)
bool WriteFluNative(const string &p="")
void COM_set_array(const char *wa_str, int pane_id, void *addr, int strd=0, int cap=0)
Associates an array with an attribute for a specific pane.
bool RegisterSurfaceSoln(bool)
static T_VertexSet * face
bool InitSurfaceSoln(const string &p="")
bool InitVolumeSoln(const string &p="")
void int int REAL REAL REAL *z blockDim dim * ni
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
istream & SkipLines(istream &, unsigned int=1)
bool WriteFluGridASCII(const string &pre="", double=0.0, bool=true)
bool ReadGSPASCII(const std::string &p="", unsigned int=0, double=0.0, bool=true)
bool RegisterFluSurfaceMesh()