Changeset 3797 for palm/trunk/UTIL/chemistry
- Timestamp:
- Mar 15, 2019 11:15:38 AM (6 years ago)
- Location:
- palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/create_kpp_module.C
r3789 r3797 17 17 //----------------- 18 18 //$Id: create_kpp_module.C 3453 2018-10-30 13:21:51Z forkel $ 19 // OpenMP version (15.03.2019, ketelsen) 20 // 19 21 // Added vector switch Kacc,Krej,IERRV, Commented add_line for istatf, (05.03.2019, forkel) 20 22 // added ,pe after ierr_u, … … 233 235 234 236 mz_kpp.add_line(" "); 237 238 // Declare variables THREADPRIVATE for OpenMP version 239 240 mz_kpp.add_line(" ! OpenMP directives generated by kp4 "); 241 mz_kpp.add_line(" "); 242 mz_kpp.add_line(" !$OMP THREADPRIVATE (vl,vl_glo,is,ie,data_loaded)"); 243 mz_kpp.add_line(" !$OMP THREADPRIVATE (c,var,fix,rconst,time,temp,stepmin,cfactor)"); 244 mz_kpp.add_line(" !$OMP THREADPRIVATE (qvap,fakt,cs_mech,a,icntrl,rcntrl)"); 245 mz_kpp.add_line(" "); 246 if(kpp_switches.is_vector()) { 247 mz_kpp.add_line(" ! Vector mode Only "); 248 mz_kpp.add_line(" "); 249 mz_kpp.add_line(" !$OMP THREADPRIVATE (kacc,krej,ierrv)"); 250 mz_kpp.add_line(" !$OMP THREADPRIVATE (kpoints,kpoints_SAVE,index_org,done_check,index_step,cell_done)"); 251 mz_kpp.add_line(" !$OMP THREADPRIVATE (f_done,kacc_done,krej_done,ierr_done,compress_done)"); 252 mz_kpp.add_line(" "); 253 } 235 254 236 255 … … 444 463 } 445 464 mz_kpp.add_line(" logical :: data_loaded = .false. "); 465 if(kpp_switches.is_vector()) { 466 mz_kpp.add_line(" REAL(dp),POINTER,DIMENSION(:,:),CONTIGUOUS :: var "); 467 } else { 468 mz_kpp.add_line(" REAL(dp),POINTER,DIMENSION(:),CONTIGUOUS :: var "); 469 } 446 470 in.close(); 447 471 … … 547 571 kppi.add_line(" if (present (rcntrl_i) ) rcntrl = rcntrl_i "); 548 572 kppi.add_line(" "); 573 if(kpp_switches.is_vector()) { 574 kppi.add_line(" var => c(:,1:nvar) "); 575 } else { 576 kppi.add_line(" var => c(1:nvar) "); 577 } 578 kppi.add_line(" "); 549 579 kppi.add_line(" vl_glo = size(tempi,1) "); 550 580 kppi.add_line(" "); -
palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file.C
r3789 r3797 18 18 //----------------- 19 19 //$Id: 20 // OpenMP version (15.03.2019, ketelsen) 20 21 // 21 // removal of unnecessary variables (Ntotal, TSTART) 22 // removal of unnecessary variables (Ntotal, TSTART) (08.03.2019 forkel) 22 23 // 23 24 // Added vector switch and creation of dimension statement (rev. 3260, 18.09.2018, ketelsen) … … 333 334 lo_line.insert(0,"!DELETE "); 334 335 } 336 // Delete KPP-generated EQUIVALENCE line (var is POINTER now) 337 if(ip->get_token(0) == "EQUIVALENCE" && ip->get_token_size() >= 1) { 338 lo_line.insert(0,"!DELETE "); 339 } 335 340 336 341 // Remove REAL(kind=dp):: sun … … 429 434 } 430 435 431 432 433 436 // Make ind_ variables public 437 434 438 if(ip->get_token(3).substr(0,4) == "ind_") { 435 439 global_substitute (lo_line,"PARAMETER","PARAMETER, PUBLIC"); … … 670 674 ip->global_substitute(", - ",", -"); 671 675 676 // Replace Roundoff = WLAMCH('E') since WLAMCH does not work everywhere 677 ip->global_substitute("Roundoff = WLAMCH('E')","roundoff = epsilon(one)"); 678 672 679 // Now do some cosmetics to adapt the KPP generated output a bit o the looks of PALM, 673 680 // i.e. add some blanks, convert all to lowercase except Fortran language elements, etc. 674 // Replace Roundoff = WLAMCH('E') by Roundoff = epsilon(one)675 ip->global_substitute("Roundoff = WLAMCH('E')","roundoff = epsilon(one)");676 681 lo_line = ip->get_line(); 677 682 if(lo_line.find("'",0) == string::npos) { // No substitution in line with strings … … 706 711 global_substitute(lo_line,"E+ ","E+"); 707 712 global_substitute(lo_line,"E- ","E-"); 713 // Set all characters to lowercase 708 714 ip->global_subtolower(lo_line); 715 // Restore OMP directives: The next 2 lines are not only cosmetics! 716 global_substitute(lo_line,"!$omp","!$OMP"); 717 global_substitute(lo_line,"threadprivate","THREADPRIVATE"); 718 709 719 global_substitute(lo_line,"allocated","ALLOCATED"); 710 720 global_substitute(lo_line,"allocatable","ALLOCATABLE"); … … 714 724 global_substitute(lo_line,"character","CHARACTER"); 715 725 global_substitute(lo_line,"contains","CONTAINS"); 726 global_substitute(lo_line,"contiguous","CONTIGUOUS"); 716 727 global_substitute(lo_line,"deallocate","DEALLOCATE"); 717 728 global_substitute(lo_line,"allocate","ALLOCATE"); … … 728 739 global_substitute(lo_line,"tEND","tend"); 729 740 global_substitute(lo_line,"#ENDIF","#endif"); 730 global_substitute(lo_line,"equivalence","EQUIVALENCE");731 741 global_substitute(lo_line,"function","FUNCTION"); 732 742 global_substitute(lo_line,"if(","IF ("); … … 743 753 global_substitute(lo_line,"optional","OPTIONAL"); 744 754 global_substitute(lo_line,"parameter","PARAMETER"); 755 global_substitute(lo_line,"pointer","POINTER"); 745 756 global_substitute(lo_line,"present","PRESENT"); 746 757 global_substitute(lo_line,"private","PRIVATE"); … … 752 763 global_substitute(lo_line,"save","SAVE"); 753 764 global_substitute(lo_line,"subroutine","SUBROUTINE"); 765 global_substitute(lo_line,"target","TARGET"); 754 766 global_substitute(lo_line,"then","THEN"); 755 767 global_substitute(lo_line,"where","WHERE"); … … 761 773 global_substitute(lo_line,"(inout)","(INOUT)"); 762 774 global_substitute(lo_line,"\t"," "); 775 776 // Skalar Version 777 global_substitute(lo_line," REAL(kind=dp):: var(nvar)","! REAL(kind=dp):: var(nvar) var is now POINTER"); 778 global_substitute(lo_line,"REAL(kind=dp):: c(nspec)","REAL(kind=dp), TARGET :: c(nspec)"); 779 // Vektor Version 780 global_substitute(lo_line," REAL(kind=dp):: var (vl_dim, nvar)","! REAL(kind=dp):: var (vl_dim, nvar) var is now POINTER"); 781 global_substitute(lo_line,"REAL(kind=dp):: c (vl_dim, nspec)","REAL(kind=dp), TARGET :: c (vl_dim, nspec)"); 782 763 783 // cout << "HIER1 " << lo_line <<endl; 764 784 }
Note: See TracChangeset
for help on using the changeset viewer.