Changeset 1691 for branches/newmole/source
- Timestamp:
- 12/17/07 17:55:05 (11 months ago)
- Location:
- branches/newmole/source
- Files:
-
- 6 modified
-
dynamics.cpp (modified) (2 diffs)
-
heat_sum.cpp (modified) (1 diff)
-
mole_newton_step.cpp (modified) (1 diff)
-
mole_species.cpp (modified) (6 diffs)
-
prt_comment.cpp (modified) (1 diff)
-
radius_next.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/newmole/source/dynamics.cpp
r1686 r1691 950 950 Old_molecules[ipUpstream][mol]/Old_density[ipUpstream])* 951 951 frac_next; 952 /* Atoms and positive ions are already counted in UpstreamElem */953 if(COmole[mol]-> n_nuclei != 1 || COmole[mol]->charge < 0)952 /* Externally represented species are already counted in UpstreamElem */ 953 if(COmole[mol]->location == NULL) 954 954 { 955 955 for( nelem=ipHYDROGEN; nelem<LIMELM; ++nelem ) … … 983 983 { 984 984 Upstream_molecules[mol] = Old_molecules[ipUpstream][mol]/Old_density[ipUpstream]; 985 if(COmole[mol]-> n_nuclei > 1 || COmole[mol]->charge < 0)985 if(COmole[mol]->location == NULL) 986 986 { 987 987 for( nelem=ipHYDROGEN; nelem<LIMELM; ++nelem ) -
branches/newmole/source/heat_sum.cpp
r1686 r1691 118 118 for( i=0; i < mole.num_calc; i++ ) 119 119 { 120 if(COmole[i]-> n_nuclei > 1 || COmole[i]->charge < 0)120 if(COmole[i]->location == NULL) 121 121 AtomicCollidDensity += COmole[i]->hevmol; 122 122 } -
branches/newmole/source/mole_newton_step.cpp
r1690 r1691 554 554 b[i] -= COmole[i]->hevmol*dynamics.Rate; 555 555 556 if (COmole[i]->n_nuclei != 1 || COmole[i]->charge < 0 )556 if (COmole[i]->n_nuclei != 1 || COmole[i]->charge < 0 || ! COmole[i]->lgGas_Phase) 557 557 { 558 558 b[i] += dynamics.molecules[i]*dynamics.Rate; -
branches/newmole/source/mole_species.cpp
r1690 r1691 585 585 for (i=0;i<mole.num_total;i++) 586 586 { 587 if(COmole[i]->location) 588 { 587 if(COmole[i]->location != NULL) 589 588 COmole[i]->hevmol = *(COmole[i]->location); 590 }591 589 } 592 590 } … … 606 604 { 607 605 if (COmole[i]->location == NULL) 608 {609 606 mole.elec += COmole[i]->hevmol*COmole[i]->charge; 610 }611 607 } 612 608 … … 687 683 for (i=0;i<mole.num_calc;++i) 688 684 { 689 if (COmole[i]->n_nuclei == 1 && COmole[i]->charge >= 0) 690 continue; 691 for( nelem=ipHYDROGEN; nelem<LIMELM; ++nelem ) 692 { 693 total[nelem] += COmole[i]->hevmol*COmole[i]->nElem[nelem]; 685 if (COmole[i]->location == NULL) 686 { 687 for( nelem=ipHYDROGEN; nelem<LIMELM; ++nelem ) 688 { 689 total[nelem] += COmole[i]->hevmol*COmole[i]->nElem[nelem]; 690 } 694 691 } 695 692 } … … 705 702 for (i=0;i<mole.num_calc;++i) 706 703 { 707 if (COmole[i]->n_nuclei == 1 && COmole[i]->charge >= 0) 708 continue; 709 total += (realnum) COmole[i]->hevmol; 704 if (COmole[i]->location == NULL) 705 total += (realnum) COmole[i]->hevmol; 710 706 } 711 707 return total; … … 721 717 for (i=0;i<mole.num_calc;++i) 722 718 { 723 if (COmole[i]->lgGas_Phase && (COmole[i]->n_nuclei != 1 || COmole[i]->charge < 0))719 if (COmole[i]->lgGas_Phase && COmole[i]->location == NULL ) 724 720 total += (realnum) COmole[i]->hevmol; 725 721 } … … 745 741 for (i=0,j=0;i<mole.num_calc;i++) 746 742 { 747 if (COmole[i]->n_nuclei != 1 || COmole[i]->charge <= 0 )743 if (COmole[i]->n_nuclei != 1 || COmole[i]->charge <= 0 || ! COmole[i]->lgGas_Phase) 748 744 { 749 745 /* Compound molecules and negative ions are represented individually */ -
branches/newmole/source/prt_comment.cpp
r1687 r1691 2316 2316 lgLots_of_moles = false; 2317 2317 lgLotsSolids = false; 2318 /* largest fraction in any heavy elementmolecule */2318 /* largest fraction in any molecule */ 2319 2319 for( i=0; i<mole.num_calc; ++i ) 2320 2320 { 2321 if( COmole[i]-> n_nuclei == 1 && COmole[i]->charge >= 0)2322 continue;2323 2324 if( COmole[i]->xMoleFracMax > 0.1 )2325 {2326 sprintf( chLine, " !The fraction of %s in %s reached %.1f%% at some point in the cloud.",2327 elementnames.chElementSym[COmole[i]->xMoleFracMaxElem],2328 COmole[i]->label,2329 COmole[i]->xMoleFracMax*100.);2330 bangin(chLine);2331 lgLots_of_moles = true;2332 /* check whether molecules are on grains */2333 if( !COmole[i]->lgGas_Phase )2334 lgLotsSolids = true;2335 }2336 else if( COmole[i]->xMoleFracMax>0.01 )2337 {2338 sprintf( chLine, " The fraction of %s in %s reached %.2f%% at some point in the cloud.",2339 elementnames.chElementSym[COmole[i]->xMoleFracMaxElem],2340 COmole[i]->label,2341 COmole[i]->xMoleFracMax*100.);2342 notein(chLine);2343 lgLots_of_moles = true;2344 /* check whether molecules are on grains */2345 if( !COmole[i]->lgGas_Phase )2346 lgLotsSolids = true;2347 }2348 else if( COmole[i]->xMoleFracMax > 1e-3 )2349 {2350 sprintf( chLine, " The fraction of %s in %s reached %.3f%% at some point in the cloud.",2351 elementnames.chElementSym[COmole[i]->xMoleFracMaxElem],2352 COmole[i]->label,2353 COmole[i]->xMoleFracMax*100.);2354 notein(chLine);2355 /* check whether molecules are on grains */2356 if( !COmole[i]->lgGas_Phase )2357 lgLotsSolids = true;2321 if( COmole[i]->location == NULL ) 2322 { 2323 if( COmole[i]->xMoleFracMax > 0.1 ) 2324 { 2325 sprintf( chLine, " !The fraction of %s in %s reached %.1f%% at some point in the cloud.", 2326 elementnames.chElementSym[COmole[i]->xMoleFracMaxElem], 2327 COmole[i]->label, 2328 COmole[i]->xMoleFracMax*100. ); 2329 bangin(chLine); 2330 lgLots_of_moles = true; 2331 /* check whether molecules are on grains */ 2332 if( !COmole[i]->lgGas_Phase ) 2333 lgLotsSolids = true; 2334 } 2335 else if( COmole[i]->xMoleFracMax>0.01 ) 2336 { 2337 sprintf( chLine, " The fraction of %s in %s reached %.2f%% at some point in the cloud.", 2338 elementnames.chElementSym[COmole[i]->xMoleFracMaxElem], 2339 COmole[i]->label, 2340 COmole[i]->xMoleFracMax*100. ); 2341 notein(chLine); 2342 lgLots_of_moles = true; 2343 /* check whether molecules are on grains */ 2344 if( !COmole[i]->lgGas_Phase ) 2345 lgLotsSolids = true; 2346 } 2347 else if( COmole[i]->xMoleFracMax > 1e-3 ) 2348 { 2349 sprintf( chLine, " The fraction of %s in %s reached %.3f%% at some point in the cloud.", 2350 elementnames.chElementSym[COmole[i]->xMoleFracMaxElem], 2351 COmole[i]->label, 2352 COmole[i]->xMoleFracMax*100. ); 2353 notein(chLine); 2354 /* check whether molecules are on grains */ 2355 if( !COmole[i]->lgGas_Phase ) 2356 lgLotsSolids = true; 2357 } 2358 2358 } 2359 2359 } -
branches/newmole/source/radius_next.cpp
r1687 r1691 885 885 abund1, 886 886 abund_limit; 887 if( COmole[i]->n_nuclei <= 1 && COmole[i]->charge >= 0) 888 continue; 889 /* >>chng 03 sep 21, add CO logic */ 890 /* >>chng 04 mar 30, generalize to any molecule at all */ 891 /* >>chng 04 mar 31 lower limit to abund had been 0.01, change 892 * to 0.001 to pick up approach to molecular fronts */ 893 abund = 0.; 894 for (nelem=ipHYDROGEN;nelem < LIMELM; nelem++) 895 { 896 if (dense.lgElmtOn[nelem]) 887 if( COmole[i]->location == NULL) 888 { 889 /* >>chng 03 sep 21, add CO logic */ 890 /* >>chng 04 mar 30, generalize to any molecule at all */ 891 /* >>chng 04 mar 31 lower limit to abund had been 0.01, change 892 * to 0.001 to pick up approach to molecular fronts */ 893 abund = 0.; 894 for (nelem=ipHYDROGEN;nelem < LIMELM; nelem++) 897 895 { 898 abund1 = (realnum)COmole[i]->hevmol*COmole[i]->nElem[nelem]/SDIV(dense.gas_phase[nelem]); 899 if (abund1 > abund) 896 if (dense.lgElmtOn[nelem]) 900 897 { 901 abund = abund1; 898 abund1 = (realnum)COmole[i]->hevmol*COmole[i]->nElem[nelem]/SDIV(dense.gas_phase[nelem]); 899 if (abund1 > abund) 900 { 901 abund = abund1; 902 } 902 903 } 903 904 } 904 } 905 /* is this an ice? need special logic for ice since density increases 906 * exponentially when grain temp falls below sublimation temperature 907 * >>chng 05 dec 06 - detect changes for smaller abundances for ices 908 * due to large changes in ice abundances */ 909 if( COmole[i]->lgGas_Phase ) 910 { 911 abund_limit = 1e-3f; 912 } 913 else 914 { 915 /* this is an ice - track its abundance at lower values so that 916 * we resolve the sublimation transition region */ 917 abund_limit = 1e-5f; 918 } 919 920 if( abund > abund_limit ) 921 { 922 double drmole_one, relative_change, relative_change_denom; 923 /* >>chng 05 dec 08, use smaller abundance for the denominator since just taking 924 * current abundance will overlook case where current density is vastly large 925 * than old density */ 926 if( struc.molecules[i][nzone-3]>SMALLFLOAT ) 905 /* is this an ice? need special logic for ice since density increases 906 * exponentially when grain temp falls below sublimation temperature 907 * >>chng 05 dec 06 - detect changes for smaller abundances for ices 908 * due to large changes in ice abundances */ 909 if( COmole[i]->lgGas_Phase ) 927 910 { 928 relative_change_denom = MIN2( COmole[i]->hevmol , struc.molecules[i][nzone-3] );911 abund_limit = 1e-3f; 929 912 } 930 913 else 931 914 { 932 relative_change_denom = COmole[i]->hevmol; 915 /* this is an ice - track its abundance at lower values so that 916 * we resolve the sublimation transition region */ 917 abund_limit = 1e-5f; 933 918 } 934 /* the relative change in the abundance */ 935 relative_change = 936 /*fabs( COmole[i]->hevmol - struc.CO_molec[i][nzone-3] ) / COmole[i]->hevmol;*/ 937 /* >>chng 05 dec 08, use smaller abundance */ 938 fabs( COmole[i]->hevmol - struc.molecules[i][nzone-3] ) / relative_change_denom; 939 /* >>chng 03 jun 16, change from 0.05 to 0.1, fine resolution of H2/H exposed 940 * small numerical oscillations in Solomon process */ 941 /* >>chng 04 jun 02, from 0.1 back to 0.05, more extensive CO etc network 942 * caused oscillations in SiO abundance and Si Si+ density. */ 943 /* >>chng 04 aug 03, from 0.05 to 0.035, leiden pdr model v2 had major 944 * jump in eden */ 945 /* >>chng 04 oct 18, from 0.035 back to 0.05, leiden pdr v2 actually due to having 946 * PAHs in fully molecular limit (??), this caused cool flow pdr grid to trip on 947 * too small dr */ 948 relative_change = SDIV(relative_change); 949 /*>>chng 05 dec 08, relative_change must be less than one - with 950 * revised logic above can be bigger than one */ 951 if( relative_change > 1. ) 952 relative_change = 1./relative_change; 953 /*drmole_one = radius.drad*MAX2(0.2,0.035/relative_change );*/ 954 /* >>chng 05 aug 23, thermal front allowed dr to become much too small 955 * chng from 0.02 to .6 */ 956 /*drmole_one = radius.drad*MAX2(0.2,0.05/relative_change );*/ 957 drmole_one = radius.drad*MAX2(0.6,0.05/relative_change ); 958 /* final dr will be the smallest we encounter */ 959 if( drmole_one < dr_mole_abund ) 919 920 if( abund > abund_limit ) 960 921 { 961 /* this is the dr used to set next dr - keep track of which moe was changing */ 962 dr_mole_abund = drmole_one; 963 mole_dr_change = i; 964 dCO_abund = relative_change; 922 double drmole_one, relative_change, relative_change_denom; 923 /* >>chng 05 dec 08, use smaller abundance for the denominator since just taking 924 * current abundance will overlook case where current density is vastly large 925 * than old density */ 926 if( struc.molecules[i][nzone-3]>SMALLFLOAT ) 927 { 928 relative_change_denom = MIN2( COmole[i]->hevmol , struc.molecules[i][nzone-3] ); 929 } 930 else 931 { 932 relative_change_denom = COmole[i]->hevmol; 933 } 934 /* the relative change in the abundance */ 935 relative_change = 936 /*fabs( COmole[i]->hevmol - struc.CO_molec[i][nzone-3] ) / COmole[i]->hevmol;*/ 937 /* >>chng 05 dec 08, use smaller abundance */ 938 fabs( COmole[i]->hevmol - struc.molecules[i][nzone-3] ) / relative_change_denom; 939 /* >>chng 03 jun 16, change from 0.05 to 0.1, fine resolution of H2/H exposed 940 * small numerical oscillations in Solomon process */ 941 /* >>chng 04 jun 02, from 0.1 back to 0.05, more extensive CO etc network 942 * caused oscillations in SiO abundance and Si Si+ density. */ 943 /* >>chng 04 aug 03, from 0.05 to 0.035, leiden pdr model v2 had major 944 * jump in eden */ 945 /* >>chng 04 oct 18, from 0.035 back to 0.05, leiden pdr v2 actually due to having 946 * PAHs in fully molecular limit (??), this caused cool flow pdr grid to trip on 947 * too small dr */ 948 relative_change = SDIV(relative_change); 949 /*>>chng 05 dec 08, relative_change must be less than one - with 950 * revised logic above can be bigger than one */ 951 if( relative_change > 1. ) 952 relative_change = 1./relative_change; 953 /*drmole_one = radius.drad*MAX2(0.2,0.035/relative_change );*/ 954 /* >>chng 05 aug 23, thermal front allowed dr to become much too small 955 * chng from 0.02 to .6 */ 956 /*drmole_one = radius.drad*MAX2(0.2,0.05/relative_change );*/ 957 drmole_one = radius.drad*MAX2(0.6,0.05/relative_change ); 958 /* final dr will be the smallest we encounter */ 959 if( drmole_one < dr_mole_abund ) 960 { 961 /* this is the dr used to set next dr - keep track of which moe was changing */ 962 dr_mole_abund = drmole_one; 963 mole_dr_change = i; 964 dCO_abund = relative_change; 965 } 965 966 } 966 967 }
